Commit sketch tables for reference

This commit is contained in:
Nico Schottelius 2019-03-27 18:59:35 +01:00
parent c551b944f8
commit ac96fe467d
2 changed files with 63 additions and 4 deletions

View File

@ -1414,8 +1414,14 @@ I could work around this by using if(! .. .hit) { my_action(table_id)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Compilation Error Compilation Error
p4@ubuntu:~/master-thesis/p4app$ p4@ubuntu:~/master-thesis/p4app$
#+END_SRC
Code:
#+BEGIN_SRC
if(hdr.ipv6.next_header == PROTO_ICMP6) {
nat64_icmp6();
}
#+END_SRC #+END_SRC
*** Implementation limitations *** Implementation limitations

View File

@ -160,8 +160,8 @@ control MyIngress(inout headers hdr,
table nat64 { table nat64 {
key = { key = {
// hdr.ipv6.src_addr: lpm;
hdr.ipv6.dst_addr: lpm; hdr.ipv6.dst_addr: lpm;
hdr.ipv6.next_header: exact;
} }
actions = { actions = {
controller_debug; controller_debug;
@ -370,12 +370,63 @@ control MyIngress(inout headers hdr,
/********************** APPLYING TABLES ***********************************/ /********************** APPLYING TABLES ***********************************/
apply { apply {
/* V2: matching all protocols in same table */
if(hdr.ipv6.isValid()) { if(hdr.ipv6.isValid()) {
icmp6.apply(); /* icmp6 echo, icmp6 ndp */ switch(nat64.apply().action_run) {
if(nat64.apply().hit) { /* translating */ nat64_icmp6: { nat64_icmp6_if_table.apply() }
v4_networks.apply(); /* apply egress */ nat64_tcp: { ... } // nothing, directly handled
nat64_udp: { ... } // nothing, directly handled
}
/* not sure how to get .hit & .action_run */
if(there_was_a_hit_in_nat64) {
v4_networks.apply(); /* apply egress for IPv4 */
exit; /* no further v6 processing */ exit; /* no further v6 processing */
} }
}
/* V3: matching protocols in distinct tables */
if(hdr.ipv6.isValid()) {
switch(nat64_icmp6.apply().hit) {
v4_networks.apply(); /* apply egress for IPv4 */
exit; /* no further v6 processing */
}
/* the next two might be able to be merged */
switch(nat64_udp.apply().hit) {
v4_networks.apply(); /* apply egress for IPv4 */
exit; /* no further v6 processing */
}
switch(nat64_tcp.apply().hit) {
v4_networks.apply(); /* apply egress for IPv4 */
exit; /* no further v6 processing */
}
}
switch(nat64.apply().action_run) {
nat64_icmp6: { nat64_icmp6_if_table.apply() }
nat64_tcp: { ... } // nothing, directly handled
nat64_udp: { ... } // nothing, directly handled
}
/* not sure how to get .hit & .action_run */
if(there_was_a_hit_in_nat64) {
v4_networks.apply(); /* apply egress for IPv4 */
exit; /* no further v6 processing */
}
}
apply {
if(hdr.ipv6.isValid()) {
icmp6.apply(); /* icmp6 echo, icmp6 ndp */
switch(nat64.apply().action_run) {
nat64_icmp6: { nat64_icmp6_if_table.apply() }
}
v4_networks.apply(); /* apply egress */
exit; /* no further v6 processing */
}
v6_networks.apply(); /* egress / routing */ v6_networks.apply(); /* egress / routing */
} else if(hdr.ipv4.isValid()) { } else if(hdr.ipv4.isValid()) {
if(nat46.apply().hit) { /* v4->v6 */ if(nat46.apply().hit) { /* v4->v6 */
@ -387,6 +438,8 @@ control MyIngress(inout headers hdr,
} }
} }
// if(nat64.apply().hit) { /* translating */
/************************************************************************* /*************************************************************************
**************** E G R E S S P R O C E S S I N G ******************* **************** E G R E S S P R O C E S S I N G *******************
*************************************************************************/ *************************************************************************/