VirtualBox

Changeset 15447 in vbox for trunk/src/VBox/Devices


Ignore:
Timestamp:
Dec 13, 2008 7:10:21 PM (16 years ago)
Author:
vboxsync
Message:

slirp:icmp: support traceroute default on Unix hosts (UDP)
detaching sockets we've received ICMP message

File:
1 edited

Legend:

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

    r15445 r15447  
    7979        udp_last_so = &udb;
    8080
    81     m_free(pData, so->so_m);
     81    /* check if mbuf haven't been already freed  */
     82    if (so->so_m != NULL)
     83        m_free(pData, so->so_m);
    8284
    8385    if(so->so_next && so->so_prev)
     
    802804
    803805    LogRel(("ICMP:received msg(t:%d, c:%d)\n", icp->icmp_type, icp->icmp_code));
    804     if (icp->icmp_type != ICMP_ECHOREPLY && icp->icmp_type != ICMP_TIMXCEED)
     806    if (icp->icmp_type != ICMP_ECHOREPLY
     807        && icp->icmp_type != ICMP_TIMXCEED
     808        && icp->icmp_type != ICMP_UNREACH)
    805809    {
    806810        return;
    807811    }
    808812
    809     if (icp->icmp_type == ICMP_TIMXCEED)
     813    if (icp->icmp_type == ICMP_TIMXCEED
     814        || icp->icmp_type == ICMP_UNREACH )
    810815        ip = &icp->icmp_ip;
    811816
     
    826831    proto = ip->ip_p;
    827832    /* Now ip is pointing on header we've sent from guest */
    828     if (icp->icmp_type == ICMP_TIMXCEED)
     833    if (icp->icmp_type == ICMP_TIMXCEED
     834        ||  icp->icmp_type == ICMP_UNREACH)
    829835    {
    830836        old_ip_len = (ip->ip_hl << 2) + 64;
     
    845851
    846852    icp = (struct icmp *)((char *)ip + (ip->ip_hl << 2));
    847     if (icp->icmp_type == ICMP_TIMXCEED)
     853    if (icp->icmp_type == ICMP_TIMXCEED
     854        || icp->icmp_type == ICMP_UNREACH)
    848855    {
    849856        /* according RFC 793 error messages required copy of initial IP header + 64 bit */
     
    857864    LIST_REMOVE(icm, im_list);
    858865    /* Don't call m_free here*/
    859 #if 0
    860     if (icp->icmp_type == ICMP_TIMXCEED)
    861     {
     866
     867    if (icp->icmp_type == ICMP_TIMXCEED
     868        || icp->icmp_type == ICMP_UNREACH)
     869    {
     870        icm->im_so->so_m = NULL;
    862871        switch (proto)
    863872        {
    864873            case  IPPROTO_UDP:
    865874                /*XXX: so->so_m already freed so we shouldn't call sofree */
    866                 if (so == udp_last_so)
    867                     udp_last_so = &udb;
    868                 closesocket(icm->im_so->s);
    869                 icm->im_so->s = 1;
    870                 icm->im_so->so_state = SS_NOFDREF;
    871                 if(so->so_next && so->so_prev) {
    872                     remque(pData, so);
    873                     free(icm->im_so);
    874                 }
     875                udp_detach(pData, icm->im_so);
    875876            break;
    876877            case  IPPROTO_TCP:
     
    882883        }
    883884    }
    884 #endif
    885885    free(icm);
    886886}
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