Changeset View
Changeset View
Standalone View
Standalone View
sys/netpfil/ipfw/nat64/nat64_translate.c
Show First 20 Lines • Show All 1,286 Lines • ▼ Show 20 Lines | nat64_do_handle_ip4(struct mbuf *m, struct in6_addr *saddr, | ||||
ip6.ip6_hlim = ip->ip_ttl; | ip6.ip6_hlim = ip->ip_ttl; | ||||
if (*V_nat64ipstealth == 0) | if (*V_nat64ipstealth == 0) | ||||
ip6.ip6_hlim -= IPTTLDEC; | ip6.ip6_hlim -= IPTTLDEC; | ||||
ip6.ip6_plen = htons(plen); | ip6.ip6_plen = htons(plen); | ||||
ip6.ip6_nxt = (proto == IPPROTO_ICMP) ? IPPROTO_ICMPV6: proto; | ip6.ip6_nxt = (proto == IPPROTO_ICMP) ? IPPROTO_ICMPV6: proto; | ||||
/* Handle delayed checksums if needed. */ | /* Handle delayed checksums if needed. */ | ||||
if (m->m_pkthdr.csum_flags & CSUM_DELAY_DATA) { | if (m->m_pkthdr.csum_flags & CSUM_DELAY_DATA) { | ||||
m = mb_unmapped_to_ext(m); | |||||
if (m == NULL) { | |||||
NAT64STAT_INC(&cfg->stats, nomem); | |||||
return (NAT64RETURN); | |||||
} | |||||
in_delayed_cksum(m); | in_delayed_cksum(m); | ||||
m->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA; | m->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA; | ||||
} | } | ||||
/* Convert checksums. */ | /* Convert checksums. */ | ||||
switch (proto) { | switch (proto) { | ||||
case IPPROTO_TCP: | case IPPROTO_TCP: | ||||
csum = &TCP(mtodo(m, hlen))->th_sum; | csum = &TCP(mtodo(m, hlen))->th_sum; | ||||
if (lport != 0) { | if (lport != 0) { | ||||
▲ Show 20 Lines • Show All 361 Lines • ▼ Show 20 Lines | if (nh->nh_mtu < plen + sizeof(ip)) { | ||||
nat64_icmp6_reflect(m, ICMP6_PACKET_TOO_BIG, 0, nh->nh_mtu, | nat64_icmp6_reflect(m, ICMP6_PACKET_TOO_BIG, 0, nh->nh_mtu, | ||||
&cfg->stats, logdata); | &cfg->stats, logdata); | ||||
return (NAT64RETURN); | return (NAT64RETURN); | ||||
} | } | ||||
nat64_init_ip4hdr(ip6, frag, plen, proto, &ip); | nat64_init_ip4hdr(ip6, frag, plen, proto, &ip); | ||||
/* Handle delayed checksums if needed. */ | /* Handle delayed checksums if needed. */ | ||||
if (m->m_pkthdr.csum_flags & CSUM_DELAY_DATA_IPV6) { | if (m->m_pkthdr.csum_flags & CSUM_DELAY_DATA_IPV6) { | ||||
m = mb_unmapped_to_ext(m); | |||||
if (m == NULL) { | |||||
NAT64STAT_INC(&cfg->stats, nomem); | |||||
return (NAT64RETURN); | |||||
} | |||||
in6_delayed_cksum(m, plen, hlen); | in6_delayed_cksum(m, plen, hlen); | ||||
m->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA_IPV6; | m->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA_IPV6; | ||||
} | } | ||||
/* Convert checksums. */ | /* Convert checksums. */ | ||||
switch (proto) { | switch (proto) { | ||||
case IPPROTO_TCP: | case IPPROTO_TCP: | ||||
csum = &TCP(mtodo(m, hlen))->th_sum; | csum = &TCP(mtodo(m, hlen))->th_sum; | ||||
if (aport != 0) { | if (aport != 0) { | ||||
▲ Show 20 Lines • Show All 43 Lines • Show Last 20 Lines |