From 591175db7a83984e27ac339771ba421df7607bdb Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 6 Mar 2019 15:15:46 +0100 Subject: [PATCH] Re-re-re-try to do checkumming based on a meta field --- doc/plan.org | 9 ++++++--- p4src/checksums.p4 | 24 ++++++++++++------------ p4src/static-mapping.p4 | 10 ++++++++++ 3 files changed, 28 insertions(+), 15 deletions(-) diff --git a/doc/plan.org b/doc/plan.org index 8af1377..dfcb249 100644 --- a/doc/plan.org +++ b/doc/plan.org @@ -51,6 +51,7 @@ | | * Summary on Slack | | | | * 1130 meeting now | | | | | | +| | | | | 2019-03-01 | Feature list / priority list / roadmap clear | x | | | Joining P4 Slack | | | | | | @@ -86,7 +87,7 @@ | | - Multiple branches: | | | | * Work on checksumming / p4 | | | | * Work on metadata passing / p4 | | -| | * Work on static mapping (w/ incorrect checksum) | | +| | * Work on static mapping (w/ incorrect checksum) 1:1 | | | | | | | | | | | 2019-03-08 | NAT46 1:1 table ICMP, ICMPv6 working | | @@ -198,6 +199,10 @@ p4@ubuntu:~/master-thesis$ **** TODO Translate ipv6 --> ipv4 with a (freely programmable) prefix ***** TODO Insert prefix into switch ***** TODO Implement the calculation +***** TODO Sketch the flow for session handling for icmp6 w/o packet loss + - switch receives icmp6 packet for known prefix + - controller needs to create session entry (?) + **** TODO Translate icmp <-> icmp6 **** TODO Create table entry for mapping v4->v6 [net] **** TODO Create table entry for mapping v6->v4 [net] @@ -539,8 +544,6 @@ performance, security and adaptivity of the solutions. - Milestone 1: Stateless NAT64/NAT46 translations in P4 - Milestone 2: Stateful (dynamic) NAT64/NAT46 translations - Milestone 3: Hardware adaption - - ** Original ideas Proposal 1: Automating NAT64 with P4 diff --git a/p4src/checksums.p4 b/p4src/checksums.p4 index 231c65c..973031b 100644 --- a/p4src/checksums.p4 +++ b/p4src/checksums.p4 @@ -21,18 +21,18 @@ control MyVerifyChecksum(inout headers hdr, inout metadata meta) { control MyComputeChecksum(inout headers hdr, inout metadata meta) { apply { - // GRRRRR update_checksum_with_payload(meta.do_cksum, - // GRRRRR { - // GRRRRR hdr.ipv6.src_addr, /* 128 */ - // GRRRRR hdr.ipv6.dst_addr, /* 128 */ - // GRRRRR 16w0, /* 16 try implicit cast */ - // GRRRRR hdr.ipv6.payload_length, /* 16 */ - // GRRRRR 24w0, /* 24 0's */ - // GRRRRR PROTO_ICMP6 /* 8 */ - // GRRRRR }, - // GRRRRR hdr.icmp6.checksum, - // GRRRRR HashAlgorithm.csum16 - // GRRRRR ); + update_checksum_with_payload(meta.do_cksum == 1, + { + hdr.ipv6.src_addr, /* 128 */ + hdr.ipv6.dst_addr, /* 128 */ + 16w0, /* 16 try implicit cast */ + hdr.ipv6.payload_length, /* 16 */ + 24w0, /* 24 0's */ + PROTO_ICMP6 /* 8 */ + }, + hdr.icmp6.checksum, + HashAlgorithm.csum16 + ); } } diff --git a/p4src/static-mapping.p4 b/p4src/static-mapping.p4 index a3c8dd5..f496aa4 100644 --- a/p4src/static-mapping.p4 +++ b/p4src/static-mapping.p4 @@ -66,6 +66,16 @@ control MyIngress(inout headers hdr, //meta.cast_length = (bit<32>) hdr.ipv6.payload_length; } + /* this needs SESSIONS!! + - icmp6: (src addr, dst addr, ID??, ) + - tcp: (src port, dst port, dst_addr, src addr) + - udp: (src port, dst port, dst_addr, src addr) + */ + action nat64_static(ipv4_addr_t nataddr, ipv6_addr_t nat64_prefix) { + hdr.ipv4.dst_addr = hdr.ipv6.dst_addr - nat64_prefix; + hdr.ipv4.dst_addr = hdr.ipv6.dst_addr - nat64_prefix; + } + /********************** Reply to NDP for US ***********************************/ table ndp_answer { key = {