VirtualBox

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


Ignore:
Timestamp:
Mar 16, 2010 5:10:15 PM (15 years ago)
Author:
vboxsync
Message:

NAT: ICMP checks minimal sizes of ICMP datagrams received from socket according rfc792
(for types echo reply, time exceed, unreachable).

File:
1 edited

Legend:

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

    r27399 r27417  
    10671067    }
    10681068
     1069    /*
     1070     * ICMP_ECHOREPLY, ICMP_TIMXCEED, ICMP_UNREACH minimal header size is
     1071     * ICMP_ECHOREPLY assuming data 0
     1072     * icmp_{type(8), code(8), cksum(16),identifier(16),seqnum(16)}
     1073     */
     1074    if (RT_N2H_U16(ip->ip_len) < hlen + 8)
     1075    {
     1076        Log(("send_icmp_to_guest: NAT accept ICMP_{ECHOREPLY, TIMXCEED, UNREACH} the minimum size is 64 (see rfc792)\n"));
     1077        return;
     1078    }
     1079
    10691080    type = icp->icmp_type;
    10701081    if (   type == ICMP_TIMXCEED
    10711082        || type == ICMP_UNREACH)
    10721083    {
     1084        /*
     1085         * ICMP_TIMXCEED, ICMP_UNREACH minimal header size is
     1086         * icmp_{type(8), code(8), cksum(16),unused(32)} + IP header + 64 bit of original datagram
     1087         */
     1088        if (RT_N2H_U16(ip->ip_len) < hlen + 2*8 + sizeof(struct ip))
     1089        {
     1090            Log(("send_icmp_to_guest: NAT accept ICMP_{TIMXCEED, UNREACH} the minimum size of ipheader + 64 bit of data (see rfc792)\n"));
     1091            return;
     1092        }
    10731093        ip = &icp->icmp_ip;
    10741094    }
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