From 658227cd5b54fa233b78d40ddcd6b0e3c45574e3 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 26 Mar 2019 22:06:35 +0100 Subject: [PATCH 1/3] Clarify execution order in nat64/nat46 case --- doc/plan.org | 9 +++++++++ p4src/static-mapping.p4 | 13 +++++++++---- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/doc/plan.org b/doc/plan.org index dd121bb..0738494 100644 --- a/doc/plan.org +++ b/doc/plan.org @@ -467,6 +467,15 @@ 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 +INFO:main:unhandled reassambled=>> from table TABLE_V4_NETWORKS +**** TODO Solve logic problem: Valid headers +- If ipv6 header is valid && nat64 will be made and afterwards v4 egress needs to be applied +- If ipv4 header is valid && nat46 will be made and afterwards v6 egress needs to be applied + **** 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 971c30f..c2634d9 100644 --- a/p4src/static-mapping.p4 +++ b/p4src/static-mapping.p4 @@ -335,11 +335,16 @@ control MyIngress(inout headers hdr, apply { if(hdr.ipv6.isValid()) { icmp6.apply(); /* icmp6 echo, icmp6 ndp */ - nat64.apply(); /* translating */ + if(nat64.apply().hit) { /* translating */ + v4_networks.apply(); /* apply egress */ + exit; /* no further v6 processing */ + } v6_networks.apply(); /* egress / routing */ - } - if(hdr.ipv4.isValid()) { - nat46.apply(); /* v4->v6 */ + } else if(hdr.ipv4.isValid()) { + if(nat46.apply().hit) { /* v4->v6 */ + v6_networks.apply(); /* Now apply v6 egress */ + exit; /* no further v4 processing */ + } v4_networks.apply(); /* routing, egress */ } } From 74420d8bbdf4ef7ea8a53f810f57392832a9b48e Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 26 Mar 2019 22:13:17 +0100 Subject: [PATCH 2/3] Uncomment region to check flow --- p4src/static-mapping.p4 | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/p4src/static-mapping.p4 b/p4src/static-mapping.p4 index c2634d9..d259643 100644 --- a/p4src/static-mapping.p4 +++ b/p4src/static-mapping.p4 @@ -340,13 +340,14 @@ control MyIngress(inout headers hdr, exit; /* no further v6 processing */ } v6_networks.apply(); /* egress / routing */ - } else if(hdr.ipv4.isValid()) { - if(nat46.apply().hit) { /* v4->v6 */ - v6_networks.apply(); /* Now apply v6 egress */ - exit; /* no further v4 processing */ - } - v4_networks.apply(); /* routing, egress */ } + // else if(hdr.ipv4.isValid()) { + // if(nat46.apply().hit) { /* v4->v6 */ + // v6_networks.apply(); /* Now apply v6 egress */ + // exit; /* no further v4 processing */ + // } + // v4_networks.apply(); /* routing, egress */ + // } } } From 29296a30e4769fa03c2f5ff163af53f79d14e048 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 26 Mar 2019 22:16:53 +0100 Subject: [PATCH 3/3] verify again --- p4src/static-mapping.p4 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/p4src/static-mapping.p4 b/p4src/static-mapping.p4 index d259643..41178a6 100644 --- a/p4src/static-mapping.p4 +++ b/p4src/static-mapping.p4 @@ -336,8 +336,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 */ }