From e349de5859d36187c66d43fa86363bbaf5f4d3ec Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 27 Mar 2019 13:49:39 +0100 Subject: [PATCH] Change protocol in case of icmp6->icmp --- doc/plan.org | 10 ++++++++-- p4src/static-mapping.p4 | 19 +++++++++++++++---- 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/doc/plan.org b/doc/plan.org index 0738494..8affa87 100644 --- a/doc/plan.org +++ b/doc/plan.org @@ -467,7 +467,7 @@ DEBUG:main:v6 reassambled=>>> from table TABLE_V6_NETWORKS INFO:main:unhandled reassambled=>>> from table TABLE_V6_NETWORKS INFO:main:unhandled reassambled=>>> from table TABLE_NAT64 @@ -475,7 +475,13 @@ INFO:main:unhandled reassambled= pings h3 +***** DONE egress is correct, comes out at h3 +***** TODO protocol 58 is wrong -> should be 1 +**** TODO transform protocol specific: icmp6 -> icmp +**** TODO transform protocol specific: icmp -> icmp6 **** TODO Make switch answer IPv4 icmp echo request for **** TODO Add / check default route for v4 hosts *** TODO Get p4 VM / vagrant running diff --git a/p4src/static-mapping.p4 b/p4src/static-mapping.p4 index af00b49..0c52d42 100644 --- a/p4src/static-mapping.p4 +++ b/p4src/static-mapping.p4 @@ -71,11 +71,25 @@ control MyIngress(inout headers hdr, hdr.ipv4.src_addr = src; hdr.ipv4.ttl = hdr.ipv6.hop_limit; + hdr.ipv4.protocol = hdr.ipv6.next_header; + switch(hdr.ipv6.next_header) { + PROTO_ICMP6: { + nat64_icmp6; + } + } + hdr.ipv6.setInvalid(); } + action nat64_icmp6() + { + + hdr.ipv4.protocol = PROTO_ICMP; // overwrite generic same protocol assumption + + } + /* NAT46: protocol unspecific changes */ action nat46_generic(ipv6_addr_t src, ipv6_addr_t dst) { hdr.ipv6.setValid(); @@ -383,7 +397,4 @@ MyIngress(), MyEgress(), MyComputeChecksum(), MyDeparser() -) main; - - - // truncate((bit<32>)22); //ether+cpu header +) main; \ No newline at end of file