From f59c35c41b8eacf59f4d511991c39046da551adc Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 27 Mar 2019 13:26:50 +0100 Subject: [PATCH] setValid() before filling in the values --- p4src/static-mapping.p4 | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/p4src/static-mapping.p4 b/p4src/static-mapping.p4 index 41178a6..0713858 100644 --- a/p4src/static-mapping.p4 +++ b/p4src/static-mapping.p4 @@ -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 */ }