diff --git a/doc/plan.org b/doc/plan.org index d743656..9cc50ef 100644 --- a/doc/plan.org +++ b/doc/plan.org @@ -495,6 +495,73 @@ 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 Update p4c to avoid compiler bug +***** TODO Updating p4c +****** DONE Try1 + p4@ubuntu:~/p4-learning/vm/bin$ sh update-p4c.sh + update-p4c.sh: 34: update-p4c.sh: Syntax error: "(" unexpected + p4@ubuntu:~/p4-learning/vm/bin$ git pull + Already up-to-date. + p4@ubuntu:~/p4-learning/vm/bin$ git describe --always + fb9d0ea + p4@ubuntu:~/p4-learning/vm/bin$ + + p4@ubuntu:~/p4-tools/p4c$ git checkout 1ab1c796677a3a2349df9619d82831a39a6e4437 + p4@ubuntu:~/p4-tools/p4c/build$ cmake .. + p4@ubuntu:~/p4-tools/p4c/build$ make -j8 +****** DONE Need to upgrade RAM / c++ errors / killed +****** DONE Compile error from 1ab1c79 +[ 33%] Building CXX object frontends/CMakeFiles/frontend.dir/unified_frontend_sources_4.cpp.o +[ 37%] Building CXX object frontends/CMakeFiles/frontend.dir/__/ir/ir-generated.cpp.o +[ 35%] Building CXX object frontends/CMakeFiles/frontend.dir/unified_frontend_sources_2.cpp.o +[ 43%] Built target midend +[ 45%] Linking CXX static library libfrontend.a +[ 56%] Built target frontend +Scanning dependencies of target bmv2backend +make[2]: *** No rule to make target '../control-plane/p4runtime/proto/p4/v1/p4data.proto', needed by 'control-plane/google/rpc/status.pb.cc'. Stop. +CMakeFiles/Makefile2:1197: recipe for target 'control-plane/CMakeFiles/controlplane.dir/all' failed +make[1]: *** [control-plane/CMakeFiles/controlplane.dir/all] Error 2 +make[1]: *** Waiting for unfinished jobs.... +[ 58%] Building CXX object backends/bmv2/CMakeFiles/bmv2backend.dir/unified_bmv2_backend_common_srcs_1.cpp.o +[ 59%] Building CXX object backends/bmv2/CMakeFiles/bmv2backend.dir/unified_bmv2_backend_common_srcs_2.cpp.o +[ 61%] Linking CXX static library libbmv2backend.a +[ 61%] Built target bmv2backend +Makefile:138: recipe for target 'all' failed +make: *** [all] Error 2 +p4@ubuntu:~/p4-tools/p4c/build$ cd .. +p4@ubuntu:~/p4-tools/p4c$ git describe --always +1ab1c79 +p4@ubuntu:~/p4-tools/p4c$ +****** Upgrading to latest master: 46609cd +p4@ubuntu:~/p4-tools/p4c$ git describe --always +46609cd + +p4@ubuntu:~/p4-tools/p4c$ cd build/ +p4@ubuntu:~/p4-tools/p4c/build$ make clean +frontends/CMakeFiles/frontend.dir/build.make:93: warning: overriding recipe for target 'frontends/parsers/v1/v1parser.output' +frontends/CMakeFiles/frontend.dir/build.make:74: warning: ignoring old recipe for target 'frontends/parsers/v1/v1parser.output' +p4@ubuntu:~/p4-tools/p4c/build$ cmake .. && make -j8 +[ 50%] Building CXX object frontends/CMakeFiles/frontend.dir/unified_frontend_sources_5.cpp.o +[ 51%] Building CXX object frontends/CMakeFiles/frontend.dir/unified_frontend_sources_6.cpp.o +[ 53%] Linking CXX static library libir.a +[ 53%] Built target ir +[ 54%] Building CXX object frontends/CMakeFiles/frontend.dir/unified_frontend_sources_7.cpp.o +[ 56%] Linking CXX static library libfrontend.a +[ 56%] Built target frontend +make[2]: *** No rule to make target '../control-plane/p4runtime/proto/p4/v1/p4data.proto', needed by 'control-plane/google/rpc/status.pb.cc'. Stop. +CMakeFiles/Makefile2:1197: recipe for target 'control-plane/CMakeFiles/controlplane.dir/all' failed +make[1]: *** [control-plane/CMakeFiles/controlplane.dir/all] Error 2 +make[1]: *** Waiting for unfinished jobs.... +Scanning dependencies of target bmv2backend +[ 58%] Building CXX object backends/bmv2/CMakeFiles/bmv2backend.dir/unified_bmv2_backend_common_srcs_2.cpp.o +[ 59%] Building CXX object backends/bmv2/CMakeFiles/bmv2backend.dir/unified_bmv2_backend_common_srcs_1.cpp.o +[ 61%] Linking CXX static library libbmv2backend.a +[ 61%] Built target bmv2backend +Makefile:138: recipe for target 'all' failed +make: *** [all] Error 2 +p4@ubuntu:~/p4-tools/p4c/build$ + + **** 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 diff --git a/p4src/static-mapping.p4 b/p4src/static-mapping.p4 index 22ce686..ed86bcd 100644 --- a/p4src/static-mapping.p4 +++ b/p4src/static-mapping.p4 @@ -154,21 +154,15 @@ Echo or Echo Reply Message */ - /* if replacing actions */ - action nat64_icmp6_echo_request(ipv6_addr_t v6_src, ipv4_addr_t v4_dst, ipv6_addr_t nat64_prefix) { - nat64_static(v6_src, v4_dst, nat64_prefix); - nat64_icmp6_generic(); + /* changes for icmp6 -> icmp */ + action nat46_icmp_generic() + { + hdr.icmp6.setValid(); + hdr.ipv6.protocol = PROTO_ICMP6; - hdr.icmp.type = ICMP_ECHO_REQUEST; + meta.chk_icmp6 = true; - /* fix length, sequence number, etc */ - } - - action nat64_icmp6_echo_reply(ipv6_addr_t v6_src, ipv4_addr_t v4_dst, ipv6_addr_t nat64_prefix) { - nat64_static(v6_src, v4_dst, nat64_prefix); - nat64_icmp6_generic(); - - hdr.icmp.type = ICMP_ECHO_REPLY; + hdr.icmp.setInvalid(); } /* NAT46: protocol unspecific changes */ @@ -192,14 +186,6 @@ Echo or Echo Reply Message } - action nat46_icmp_echo_request(ipv6_addr_t v6_src, ipv4_addr_t v4_dst, ipv6_addr_t nat64_prefix) { - ; /* TBD */ - } - - action nat46_icmp_echo_reply(ipv6_addr_t v6_src, ipv4_addr_t v4_dst, ipv6_addr_t nat64_prefix) { - ; /* TBD */ - } - /* matching key: v4_network specified again */ action nat46_static(ipv6_addr_t v6_src, ipv4_addr_t v4_dst, ipv6_addr_t nat64_prefix) { ipv6_addr_t src = nat64_prefix + (ipv6_addr_t) hdr.ipv4.src_addr; @@ -460,16 +446,26 @@ Echo or Echo Reply Message v6_networks.apply(); /* regular egress / routing */ } else if(hdr.ipv4.isValid()) { - // if(nat46_icmp.apply().hit) { /* v4->v6 */ - // v6_networks.apply(); /* Now apply v6 egress */ - // exit; /* no further v4 processing */ - // } - v4_networks.apply(); /* routing, egress */ + if(nat46.apply().hit) { + if(hdr.icmp.isValid()) { + nat46_icmp_generic(); + + if(hdr.icmp.type == ICMP_ECHO_REPLY) { + hdr.icmp6.type = ICMP6_ECHO_REPLY; + } + if(hdr.icmp.type == ICMP_ECHO_REQUEST) { + hdr.icmp6.type = ICMP6_ECHO_REQUEST; + } + } + + v6_networks.apply(); + exit; + } + v4_networks.apply(); /* regular routing, egress */ } } } - // if(nat64.apply().hit) { /* translating */ /************************************************************************* **************** E G R E S S P R O C E S S I N G *******************