VirtualBox

Changeset 51690 in vbox for trunk/src/VBox/NetworkServices


Ignore:
Timestamp:
Jun 23, 2014 2:58:11 PM (11 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
94469
Message:

NAT/Net: OS X reports IP datagrams on raw sockets with IP header
fragment offset field in host byte order too.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/NetworkServices/NAT/pxping.c

    r51684 r51690  
    11121112    struct ip_hdr *iph;
    11131113    struct icmp_echo_hdr *icmph;
    1114     u16_t iplen;
     1114    u16_t iplen, ipoff;
    11151115
    11161116    memset(&sin, 0, sizeof(sin));
     
    11421142
    11431143    /* no fragmentation */
    1144     if ((IPH_OFFSET(iph) & PP_HTONS(IP_OFFMASK | IP_MF)) != 0) {
    1145         DPRINTF2(("%s: dropping fragmented datagram\n", __func__));
     1144    ipoff = IPH_OFFSET(iph);
     1145#if defined(RT_OS_DARWIN)
     1146    /* darwin reports IPH_OFFSET in host byte order */
     1147    ipoff = htons(ipoff);
     1148    IPH_OFFSET_SET(iph, ipoff);
     1149#endif
     1150    if ((ipoff & PP_HTONS(IP_OFFMASK | IP_MF)) != 0) {
     1151        DPRINTF2(("%s: dropping fragmented datagram (0x%04x)\n",
     1152                  __func__, ntohs(IPH_OFFSET(iph))));
    11461153        return;
    11471154    }
     
    11671174    /* darwin and solaris change IPH_LEN to payload length only */
    11681175    iplen += IP_HLEN;           /* we verified there are no options */
    1169     IPH_LEN(iph) = htons(iplen);
     1176    IPH_LEN_SET(iph, htons(iplen));
    11701177#endif
    11711178    if (nread < iplen) {
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette