VirtualBox

Changeset 61201 in vbox


Ignore:
Timestamp:
May 26, 2016 1:49:38 AM (9 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
107489
Message:

NAT: Drop packets to multicast and reserved destinations earlier,
so that we don't spam TTL exceeded messages in response to multicast
membership report. Only decrement TTL if a packet is not for us.
If a packet is for another node of our private network, drop it.
The latter should address ticketref:15303, though at IP level.

File:
1 edited

Legend:

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

    r59063 r61201  
    191191        goto free_m;
    192192
    193     /* check ip_ttl for a correct ICMP reply */
    194     if (ip->ip_ttl==0 || ip->ip_ttl == 1)
    195     {
    196         /* XXX: if we're in destination so perhaps we need to send ICMP_TIMXCEED_REASS */
    197         icmp_error(pData, m, ICMP_TIMXCEED, ICMP_TIMXCEED_INTRANS, 0, "ttl");
    198         goto no_free_m;
    199     }
    200 
    201     ip->ip_ttl--;
    202     if (ip->ip_sum > RT_H2N_U16_C(0xffffU - (1 << 8)))
    203         ip->ip_sum += RT_H2N_U16_C(1 << 8) + 1;
    204     else
    205         ip->ip_sum += RT_H2N_U16_C(1 << 8);
    206 
    207193    /*
    208194     * Drop multicast (class d) and reserved (class e) here.  The rest
     
    215201        goto free_m;
    216202    }
     203
     204
     205    /* do we need to "forward" this packet? */
     206    if (!CTL_CHECK_MINE(ip->ip_dst.s_addr))
     207    {
     208        if (ip->ip_ttl <= 1)
     209        {
     210            icmp_error(pData, m, ICMP_TIMXCEED, ICMP_TIMXCEED_INTRANS, 0, "ttl");
     211            goto no_free_m;
     212        }
     213
     214        /* ignore packets to other nodes from our private network */
     215        if (   CTL_CHECK_NETWORK(ip->ip_dst.s_addr)
     216            && !CTL_CHECK_BROADCAST(ip->ip_dst.s_addr))
     217        {
     218            /* XXX: send ICMP_REDIRECT_HOST to be pedantic? */
     219            goto free_m;
     220        }
     221
     222        ip->ip_ttl--;
     223        if (ip->ip_sum > RT_H2N_U16_C(0xffffU - (1 << 8)))
     224            ip->ip_sum += RT_H2N_U16_C(1 << 8) + 1;
     225        else
     226            ip->ip_sum += RT_H2N_U16_C(1 << 8);
     227    }
     228
    217229
    218230    /*
Note: See TracChangeset for help on using the changeset viewer.

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