VirtualBox

Changeset 27447 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Mar 17, 2010 2:14:00 PM (15 years ago)
Author:
vboxsync
Message:

NAT: ICMP sanity checks of matching ECHO-ECHOREPLY communication. mbuf expanding calculation was changed.

File:
1 edited

Legend:

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

    r27443 r27447  
    11111111
    11121112    src = addr->sin_addr.s_addr;
     1113    if (type == ICMP_ECHOREPLY)
     1114    {
     1115        struct ip *ip0 = mtod(m, struct ip *);
     1116        struct icmp *icp0 = (struct icmp *)((char *)ip0 + (ip0->ip_hl << 2));
     1117        if (icp0->icmp_type != ICMP_ECHO)
     1118        {
     1119            Log(("NAT: we haven't found echo for this reply\n"));
     1120            return;
     1121        }
     1122        if (   (RT_N2H_U16(ip->ip_len) - hlen )
     1123            != (ip0->ip_len - (ip0->ip_hl << 2))) /* the IP header in the list is in host format */
     1124        {
     1125            Log(("NAT: ECHO lenght doesn't match ECHOREPLY\n"));
     1126            return;
     1127        }
     1128    }
    11131129
    11141130    ip = mtod(m, struct ip *);
     
    11381154    {
    11391155        int size = m->m_size;
    1140         m_inc(m, len); /*increase the room of the mbuf up to len*/
     1156        /* we need involve ether header lenght into new buffer buffer calculation */
     1157        m_inc(m, if_maxlinkhdr + len - hlen + original_hlen);
    11411158        if (size == m->m_size)
    11421159        {
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