[refactor] nat64 now - not only static mapping anymore

This commit is contained in:
Nico Schottelius 2019-05-05 13:48:05 +02:00
parent 02fc065c1d
commit b972accc73
2 changed files with 27 additions and 3 deletions

View file

@ -1433,7 +1433,6 @@ Please make sure that it is installed and available in your $PATH:
- Longer than /96: suffix support - Longer than /96: suffix support
** Motivation ** Motivation
TBD TBD
** Translation mechanisms ** Translation mechanisms
@ -1478,7 +1477,7 @@ user@T:~# iptables -t mangle -A PREROUTING \
``` ```
5656 5656
*** Cisco (?) *** Cisco (?)
** P4 based implementation ** TODO P4 based implementation
*** General *** General
- IPv6 subnet 2001:db8::/32 - IPv6 subnet 2001:db8::/32
@ -1856,7 +1855,11 @@ libnanomsg-dev libjudy-dev
***** TODO Case IPv4 initiator ***** TODO Case IPv4 initiator
- Needs upper level protol - Needs upper level protol
**** TODO General network matching
***** TODO Create table
***** TODO Fill it up from the controller
**** TODO tcp session **** TODO tcp session
**** TODO udp session **** TODO udp session
**** TODO tcp session **** TODO tcp session
** TODO Comparison with existing tools (Performance, Features) ** TODO Comparison with existing tools (Performance, Features)

View file

@ -234,6 +234,10 @@ Echo or Echo Reply Message
/********************** NAT64 sessions ***********************************/ /********************** NAT64 sessions ***********************************/
/* Create a session:
- Send data to controller
=> controller creates entry in the session table (?)
action nat64_create_session() action nat64_create_session()
{ {
@ -252,7 +256,7 @@ Echo or Echo Reply Message
default_action = controller_debug_table_id(TABLE_NAT64_SESSION); default_action = controller_debug_table_id(TABLE_NAT64_SESSION);
} }
table nat64_tcp { table nat64_tcp_session {
key = { key = {
hdr.ipv6.src_addr: exact; hdr.ipv6.src_addr: exact;
hdr.ipv6.dst_addr: exact; hdr.ipv6.dst_addr: exact;
@ -469,6 +473,23 @@ Echo or Echo Reply Message
/********************** APPLYING TABLES ***********************************/ /********************** APPLYING TABLES ***********************************/
apply { apply {
if(hdr.ipv6.isValid()) { 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(nat64.apply().hit) { /* generic / static nat64 done */
if(hdr.icmp6.isValid()) { if(hdr.icmp6.isValid()) {
nat64_icmp6_generic(); nat64_icmp6_generic();