diff --git a/doc/plan.org b/doc/plan.org index 0003f17..7ba0279 100644 --- a/doc/plan.org +++ b/doc/plan.org @@ -1433,7 +1433,6 @@ Please make sure that it is installed and available in your $PATH: - Longer than /96: suffix support - ** Motivation TBD ** Translation mechanisms @@ -1478,7 +1477,7 @@ user@T:~# iptables -t mangle -A PREROUTING \ ``` 5656 *** Cisco (?) -** P4 based implementation +** TODO P4 based implementation *** General - IPv6 subnet 2001:db8::/32 @@ -1856,7 +1855,11 @@ libnanomsg-dev libjudy-dev ***** TODO Case IPv4 initiator - Needs upper level protol +**** TODO General network matching +***** TODO Create table +***** TODO Fill it up from the controller **** TODO tcp session + **** TODO udp session **** TODO tcp session ** TODO Comparison with existing tools (Performance, Features) diff --git a/p4src/static-mapping.p4 b/p4src/nat64.p4 similarity index 95% rename from p4src/static-mapping.p4 rename to p4src/nat64.p4 index 67d9b0a..4dc222a 100644 --- a/p4src/static-mapping.p4 +++ b/p4src/nat64.p4 @@ -234,6 +234,10 @@ Echo or Echo Reply Message /********************** NAT64 sessions ***********************************/ + /* Create a session: + - Send data to controller + => controller creates entry in the session table (?) + action nat64_create_session() { @@ -252,7 +256,7 @@ Echo or Echo Reply Message default_action = controller_debug_table_id(TABLE_NAT64_SESSION); } - table nat64_tcp { + table nat64_tcp_session { key = { hdr.ipv6.src_addr: exact; hdr.ipv6.dst_addr: exact; @@ -469,6 +473,23 @@ Echo or Echo Reply Message /********************** APPLYING TABLES ***********************************/ apply { if(hdr.ipv6.isValid()) { + /* We hit an entry in the dynamic IPv6 range */ + if(nat64_session.apply().hit) { + // if(hdr.icmp6.isValid()) { + // /* If this is not a hit => will escalate to controller + // * If this is a hit, it has a mapping */ + // nat64_icmp6_session.apply(); + // } + // if(hdr.udp.isValid()) { + // nat64_udp_session.apply(); + // meta.chk_udp_v4 = 1; + // } + if(hdr.tcp.isValid()) { + nat64_tcp_session.apply(); + meta.chk_tcp_v4 = 1; + } + } + if(nat64.apply().hit) { /* generic / static nat64 done */ if(hdr.icmp6.isValid()) { nat64_icmp6_generic();