setValid() before filling in the values

This commit is contained in:
Nico Schottelius 2019-03-27 13:26:50 +01:00
parent 29296a30e4
commit f59c35c41b

View file

@ -50,6 +50,8 @@ control MyIngress(inout headers hdr,
/* NAT64 protocol unspecific changes */
action nat64_generic(ipv4_addr_t src, ipv4_addr_t dst) {
hdr.ipv4.setValid();
/* Stuff that might need to be fixed */
hdr.ipv4.version = (bit<4>)4;
hdr.ipv4.diff_serv = (bit<6>)0; // no ToS
@ -72,11 +74,11 @@ control MyIngress(inout headers hdr,
hdr.ipv4.protocol = hdr.ipv6.next_header;
hdr.ipv6.setInvalid();
hdr.ipv4.setValid();
}
/* NAT46: protocol unspecific changes */
action nat46_generic(ipv6_addr_t src, ipv6_addr_t dst) {
hdr.ipv6.setValid();
hdr.ethernet.ethertype = TYPE_IPV6;
hdr.ipv6.dst_addr = dst;
@ -91,7 +93,6 @@ control MyIngress(inout headers hdr,
hdr.ipv6.hop_limit = hdr.ipv4.ttl;
hdr.ipv4.setInvalid();
hdr.ipv6.setValid();
}
@ -336,8 +337,8 @@ control MyIngress(inout headers hdr,
if(hdr.ipv6.isValid()) {
icmp6.apply(); /* icmp6 echo, icmp6 ndp */
if(nat64.apply().hit) { /* translating */
// v4_networks.apply(); /* apply egress */
// exit; /* no further v6 processing */
v4_networks.apply(); /* apply egress */
exit; /* no further v6 processing */
}
v6_networks.apply(); /* egress / routing */
}