]> git.saurik.com Git - apple/xnu.git/blobdiff - bsd/netinet6/udp6_usrreq.c
xnu-3248.40.184.tar.gz
[apple/xnu.git] / bsd / netinet6 / udp6_usrreq.c
index 1e0f9eb37d52770d0a7eeb34dc1f3b8c1b83a0bb..f4b1f11cca45f952c32b507218d420677ba2d194 100644 (file)
@@ -1012,8 +1012,16 @@ udp6_input_checksum(struct mbuf *m, struct udphdr *uh, int off, int ulen)
        struct ifnet *ifp = m->m_pkthdr.rcvif;
        struct ip6_hdr *ip6 = mtod(m, struct ip6_hdr *);
 
-       if (uh->uh_sum == 0) {
+       if (!(m->m_pkthdr.csum_flags & CSUM_DATA_VALID) &&
+               uh->uh_sum == 0) {
                /* UDP/IPv6 checksum is mandatory (RFC2460) */
+
+               /* 
+                * If checksum was already validated, ignore this check.
+                * This is necessary for transport-mode ESP, which may be 
+                * getting UDP payloads without checksums when the network
+                * has a NAT64.
+                */
                udpstat.udps_nosum++;
                goto badsum;
        }