2019-07-29 19:35:40 +00:00
|
|
|
bool apply_v6networks = false;
|
|
|
|
bool apply_v4networks = false;
|
|
|
|
|
|
|
|
if(hdr.ipv6.isValid()) {
|
2019-07-31 09:30:56 +00:00
|
|
|
apply_v6networks = true;
|
|
|
|
|
|
|
|
if(nat64.apply().hit) { /* generic / static nat64 done */
|
|
|
|
if(hdr.icmp6.isValid()) {
|
|
|
|
nat64_icmp6_generic();
|
|
|
|
|
|
|
|
if(hdr.icmp6.type == ICMP6_ECHO_REPLY) {
|
|
|
|
hdr.icmp.type = ICMP_ECHO_REPLY;
|
|
|
|
hdr.icmp.code = 0;
|
2019-07-28 10:16:48 +00:00
|
|
|
}
|
2019-07-31 09:30:56 +00:00
|
|
|
if(hdr.icmp6.type == ICMP6_ECHO_REQUEST) {
|
|
|
|
hdr.icmp.type = ICMP_ECHO_REQUEST;
|
|
|
|
hdr.icmp.code = 0;
|
2019-07-28 10:16:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-07-31 09:30:56 +00:00
|
|
|
if(hdr.udp.isValid()) {
|
|
|
|
delta_udp_from_v6_to_v4
|
2019-07-28 10:16:48 +00:00
|
|
|
}
|
|
|
|
|
2019-07-31 09:30:56 +00:00
|
|
|
if(hdr.tcp.isValid()) {
|
|
|
|
delta_tcp_from_v6_to_v4
|
|
|
|
}
|
|
|
|
apply_v4networks = false;
|
|
|
|
apply_v6networks = true;
|
|
|
|
}
|
|
|
|
} else if(hdr.ipv4.isValid()) {
|
|
|
|
apply_v4networks = true;
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(hdr.udp.isValid()) {
|
|
|
|
delta_udp_from_v4_to_v6
|
|
|
|
}
|
|
|
|
if(hdr.tcp.isValid()) {
|
|
|
|
delta_tcp_from_v4_to_v6
|
2019-07-28 10:16:48 +00:00
|
|
|
}
|
2019-07-31 09:30:56 +00:00
|
|
|
apply_v4networks = true;
|
|
|
|
apply_v6networks = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(apply_v4networks == true) {
|
|
|
|
v4_networks.apply();
|
|
|
|
}
|
|
|
|
|
|
|
|
if(apply_v6networks == true) {
|
|
|
|
v6_networks.apply();
|
|
|
|
}
|