Order of actions matters
This commit is contained in:
parent
7c8f019b2a
commit
ab8e328dd3
1 changed files with 22 additions and 19 deletions
|
@ -66,25 +66,7 @@ control MyIngress(inout headers hdr,
|
|||
meta.cast_length = (bit<32>) hdr.ipv6.payload_length;
|
||||
}
|
||||
|
||||
/* nat64_prefix is the same as the matching key, but without the mask */
|
||||
action nat64_static(ipv4_addr_t v6_network, ipv4_addr_t v4_network, ipv6_addr_t nat64_prefix) {
|
||||
ipv6_addr_t src_offset = hdr.ipv6.src_addr - v6_network;
|
||||
ipv4_addr_t src = v4_network + (ipv4_addr_t) src_offset;
|
||||
|
||||
ipv6_addr_t dst = (ipv4_addr_t) hdr.ipv6.dst_addr - nat64_prefix;
|
||||
|
||||
nat64_generic(src, dst);
|
||||
}
|
||||
|
||||
/* matching key: v4_network specified again */
|
||||
action nat46_static(ipv6_addr_t v6_network, ipv4_addr_t v4_network, ipv6_addr_t nat64_prefix ) {
|
||||
ipv6_addr_t src = nat64_prefix + (ipv6_addr_t) hdr.ipv4.src_addr;
|
||||
|
||||
ipv4_addr_t dst_offset = hdr.ipv4.dst_addr - v4_network;
|
||||
ipv6_addr_t dst = v6_network + (ipv6_addr_t) dst_offset;
|
||||
|
||||
nat46_generic(src, dst);
|
||||
}
|
||||
/********************** NAT64 / NAT46 ACTIONS ***********************************/
|
||||
|
||||
/* NAT64 protocol unspecific changes */
|
||||
action nat64_generic(ipv4_addr_t src, ipv4_addr_t dst) {
|
||||
|
@ -133,6 +115,27 @@ control MyIngress(inout headers hdr,
|
|||
}
|
||||
|
||||
|
||||
/* nat64_prefix is the same as the matching key, but without the mask */
|
||||
action nat64_static(ipv4_addr_t v6_network, ipv4_addr_t v4_network, ipv6_addr_t nat64_prefix) {
|
||||
ipv6_addr_t src_offset = hdr.ipv6.src_addr - v6_network;
|
||||
ipv4_addr_t src = v4_network + (ipv4_addr_t) src_offset;
|
||||
|
||||
ipv6_addr_t dst = (ipv4_addr_t) hdr.ipv6.dst_addr - nat64_prefix;
|
||||
|
||||
nat64_generic(src, dst);
|
||||
}
|
||||
|
||||
/* matching key: v4_network specified again */
|
||||
action nat46_static(ipv6_addr_t v6_network, ipv4_addr_t v4_network, ipv6_addr_t nat64_prefix ) {
|
||||
ipv6_addr_t src = nat64_prefix + (ipv6_addr_t) hdr.ipv4.src_addr;
|
||||
|
||||
ipv4_addr_t dst_offset = hdr.ipv4.dst_addr - v4_network;
|
||||
ipv6_addr_t dst = v6_network + (ipv6_addr_t) dst_offset;
|
||||
|
||||
nat46_generic(src, dst);
|
||||
}
|
||||
|
||||
|
||||
/********************** Reply to NDP for US ***********************************/
|
||||
table ndp_answer {
|
||||
key = {
|
||||
|
|
Loading…
Reference in a new issue