Begin NAT46 translation of ICMP->ICMP6
This commit is contained in:
parent
7d3acfc06a
commit
92163d46ef
2 changed files with 90 additions and 27 deletions
67
doc/plan.org
67
doc/plan.org
|
@ -495,6 +495,73 @@ INFO:main:unhandled reassambled=<Ether dst=33:33:ff:00:00:42 src=00:00:0a:00:00
|
|||
INFO:main:unhandled reassambled=<Ether dst=33:33:ff:00:00:42 src=00:00:0a:00:00:01 type=0x86dd |<IPv6 version=6 tc=0 fl=0 plen=32 nh=ICMPv6 hlim=255 src=fe80::200:aff:fe00:1 dst=ff02::1:ff00:42 |<ICMPv6ND_NS type=Neighbor Solicitation code=0 cksum=0x37df res=0 tgt=2001:db8::42 |<ICMPv6NDOptSrcLLAddr type=1 len=1 lladdr=00:00:0a:00:00:01 |>>>> from table TABLE_V6_NETWORKS
|
||||
INFO:main:unhandled reassambled=<Ether dst=33:33:ff:00:00:42 src=00:00:0a:00:00:01 type=0x86dd |<IPv6 version=6 tc=0 fl=0 plen=32 nh=ICMPv6 hlim=255 src=2001:db8::1 dst=ff02::1:ff00:42 |<ICMPv6ND_NS type=Neighbor Solicitation code=0 cksum=0x13a7 res=0 tgt=2001:db8::42 |<ICMPv6NDOptSrcLLAddr type=1 len=1 lladdr=00:00:0a:00:00:01 |>>>> from table TABLE_NAT64
|
||||
INFO:main:unhandled reassambled=<Ether dst=00:00:0a:00:00:42 src=00:00:0a:00:00:01 type=0x86dd |<IPv6 version=6 tc=0 fl=920946 plen=64 nh=ICMPv6 hlim=64 src=2001:db8::1 dst=2001:db8:1::a00:1 |<ICMPv6EchoRequest type=Echo Request code=0 cksum=0x3d1a id=0xade seq=0x1 data='\x1f\x92\x9a\\\x00\x00\x00\x00WU\x02\x00\x00\x00\x00\x00\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f !"#$%&\'()*+,-./01234567' |>>> 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
|
||||
|
|
|
@ -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 *******************
|
||||
|
|
Loading…
Reference in a new issue