VirtualBox

Changeset 15367 in vbox for trunk/src/VBox/Devices/Network


Ignore:
Timestamp:
Dec 12, 2008 2:04:01 PM (16 years ago)
Author:
vboxsync
Message:

icmp:slirp: attempt to fix darwin

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Network/slirp/socket.c

    r15365 r15367  
    795795    struct icmp_msg *icm;
    796796    uint8_t proto;
    797 
     797    int hlen;
     798
     799#ifndef RT_OS_DARWIN
    798800    ip = (struct ip *)buff;
    799801    icp = (struct icmp *)((char *)ip + (ip->ip_hl << 2));
     802#else
     803    icp = (struct icmp *)buff;
     804#endif
    800805
    801806    LogRel(("ICMP:received msg(t:%d, c:%d)\n", icp->icmp_type, icp->icmp_code));
     
    824829    proto = ip->ip_p;
    825830    /* Now ip is pointing on header we've sent from guest */
     831    hlen = ip->ip_hl << 2;
    826832    if (icp->icmp_type == ICMP_TIMXCEED)
    827833    {
    828         old_ip_len = (ip->ip_hl << 2) + 64;
     834        old_ip_len = hlen + 64;
    829835        memcpy(ip_copy, ip, old_ip_len);
    830836    }
     
    834840
    835841    /* overide ther tail of old packet */
     842#ifdef RT_OS_DARWIN
     843    /* on Darwin don't have IP header in the buffer */
     844    m->m_data += hlen;
     845    m->m_len -= hlen;
     846#endif
    836847    memcpy(m->m_data, buff, len);
    837848    m->m_len = len;
     849#ifdef RT_OS_DARWIN
     850    /* on Darwin don't have IP header in the buffer */
     851    m->m_data -= hlen;
     852    m->m_len += hlen;
     853#endif
    838854    ip = mtod(m, struct ip *); /* ip is from mbuf we've overrided */
    839855
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