File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import scapy.all as scapy
22
33eth_header = scapy.Ether(src='02:1e:67:9f:4d:ae', dst='ff:ff:ff:ff:ff:ff')
4- arp_header = scapy.ARP(op=1, pdst='1.1.1.1 ')
4+ arp_header = scapy.ARP(op=1, pdst='1.2.3.4 ')
55pkt = eth_header/arp_header
66packets = [str(pkt)]
77
8- arp = ArpResponder(name="arp" )
9- arp.add(ip='1.1.1.1 ', mac_addr='11 :22:33:44:55:66')
8+ arp:: ArpResponder()
9+ arp.add(ip='1.2.3.4 ', mac_addr='A0 :22:33:44:55:66')
1010
1111Source() -> Rewrite(templates=packets) -> arp -> Sink()
Original file line number Diff line number Diff line change @@ -31,13 +31,12 @@ CommandResponse ArpResponder::CommandAdd(const bess::pb::ArpResponderArg &arg) {
3131
3232void ArpResponder::ProcessBatch (bess::PacketBatch *batch) {
3333 gate_idx_t out_gates[bess::PacketBatch::kMaxBurst ];
34- gate_idx_t incoming_gate = get_igate ();
3534
3635 int cnt = batch->cnt ();
3736 for (int i = 0 ; i < cnt; i++) {
3837 bess::Packet *pkt = batch->pkts ()[i];
3938
40- out_gates[i] = incoming_gate ;
39+ out_gates[i] = 0 ;
4140
4241 Ethernet *eth = pkt->head_data <Ethernet *>();
4342 if (eth->ether_type != be16_t (Ethernet::Type::kArp )) {
@@ -64,11 +63,17 @@ void ArpResponder::ProcessBatch(bess::PacketBatch *batch) {
6463
6564 arp->target_ip_addr = arp->sender_ip_addr ;
6665 arp->sender_ip_addr = entry.ip_addr ;
66+ } else {
67+ // Did not find an ARP entry in cache, drop packet
68+ // TODO(galsagie) Optinally continue packet to next module here
69+ out_gates[i] = DROP_GATE ;
6770 }
6871 } else if (arp->opcode == be16_t (Arp::Opcode::kReply )) {
6972 // TODO(galsagie) When learn is added, learn SRC MAC here
73+ out_gates[i] = DROP_GATE ;
7074 } else {
7175 // TODO(galsagie) Other opcodes are not handled yet.
76+ out_gates[i] = DROP_GATE ;
7277 }
7378 }
7479
Original file line number Diff line number Diff line change @@ -974,7 +974,8 @@ message WildcardMatchArg {
974974}
975975
976976/**
977- * The ARP Responder module is responding to ARP requests and can optionally learn new MAC's-IP's mapping
977+ * The ARP Responder module is responding to ARP requests
978+ * TODO: Dynamic learn new MAC's-IP's mapping
978979 *
979980 * __Input Gates__: 1
980981 * __Output Gates__: 1
You can’t perform that action at this time.
0 commit comments