Arp is not IPv4

This commit is contained in:
Nico Schottelius 2019-03-31 16:37:21 +02:00
parent e0f828fe3e
commit 26605a43e7
3 changed files with 10 additions and 1 deletions

View file

@ -29,6 +29,7 @@ const bit<16> TYPE_IPV4 = 0x0800;
const bit<16> TYPE_IPV6 = 0x86DD; const bit<16> TYPE_IPV6 = 0x86DD;
const bit<16> TYPE_CPU = 0x4242; const bit<16> TYPE_CPU = 0x4242;
const bit<16> TYPE_DEBUG = 0x2323; const bit<16> TYPE_DEBUG = 0x2323;
const bit<16> TYPE_ARP = 0x0806;
const bit<8> PROTO_ICMP = 1; const bit<8> PROTO_ICMP = 1;

View file

@ -22,6 +22,7 @@ parser MyParser(packet_in packet,
transition select(hdr.ethernet.ethertype){ transition select(hdr.ethernet.ethertype){
TYPE_IPV4: ipv4; TYPE_IPV4: ipv4;
TYPE_IPV6: ipv6; TYPE_IPV6: ipv6;
TYPE_ARP: arp;
default: accept; default: accept;
} }
@ -91,6 +92,11 @@ parser MyParser(packet_in packet,
transition accept; transition accept;
} }
state arp {
packet.extract(hdr.arp);
transition accept;
}
} }
/************************************************************************* /*************************************************************************

View file

@ -430,9 +430,11 @@ Echo or Echo Reply Message
v6_networks.apply(); v6_networks.apply();
exit; exit;
} }
v4_arp.apply();
v4_networks.apply(); /* regular routing, egress */ v4_networks.apply(); /* regular routing, egress */
} }
if(hdr.arp.isValid()) {
v4_arp.apply();
}
} }
} }