Begin NAT46 translation of ICMP->ICMP6
This commit is contained in:
parent
7d3acfc06a
commit
92163d46ef
2 changed files with 90 additions and 27 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue