VirtualBox

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


Ignore:
Timestamp:
Nov 27, 2008 8:13:25 AM (16 years ago)
Author:
vboxsync
Message:

Linux ICMP works now (ping, traceroute required fix ttl things)
Still require root privileges to test

Location:
trunk/src/VBox/Devices/Network/slirp
Files:
3 edited

Legend:

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

    r14633 r14684  
    7070icmp_attach(PNATState pData, struct socket *so) {
    7171    AssertRelease(so != NULL);
    72     if (pData->icmp_socket == 0)
    73         pData->icmp_socket = socket(PF_INET, SOCK_RAW, IPPROTO_ICMP);
    74     AssertRelease(pData->icmp_socket != -1);
    75     so->s = pData->icmp_socket;
     72    so->s = socket(PF_INET, SOCK_RAW, IPPROTO_ICMP);
     73    insque(pData, so, &udb); /*adding it udb queue*/
    7674    return (so->s);
    7775}
     
    187185                    errno,strerror(errno)));
    188186        icmp_error(pData, m, ICMP_UNREACH,ICMP_UNREACH_NET, 0,strerror(errno));
     187        udp_detach(pData, so);
    189188      }
    190189
     
    385384
    386385  ip->ip_ttl = MAXTTL;
     386#ifndef VBOX_WITH_SLIRP_ICMP
    387387  { /* swap */
    388388    struct in_addr icmp_dst;
     
    391391    ip->ip_src = icmp_dst;
    392392  }
     393#endif
    393394
    394395  (void ) ip_output(pData, (struct socket *)NULL, m);
  • trunk/src/VBox/Devices/Network/slirp/slirp_state.h

    r14641 r14684  
    129129    struct socket udb;
    130130    struct socket *udp_last_so;
    131 #ifdef VBOX_WITH_SLIRP_ICMP
    132     int icmp_socket;
    133 #endif
    134131#if defined(VBOX_WITH_SIMPLIFIED_SLIRP_SYNC) && defined(RT_OS_WINDOWS)
    135132# define VBOX_SOCKET_EVENT (pData->phEvents[VBOX_SOCKET_EVENT_INDEX])
  • trunk/src/VBox/Devices/Network/slirp/socket.c

    r14470 r14684  
    412412            icmp_error(pData, so->so_m, ICMP_UNREACH,code, 0,strerror(errno));
    413413          } else {
     414#ifdef VBOX_WITH_SLIRP_ICMP
     415            struct ip *ip;
     416            uint32_t dst;
     417            ip = mtod(so->so_m, struct ip *);
     418            dst = ip->ip_src.s_addr;
     419            memcpy(so->so_m->m_data, buff, len); /* ovveride ther tail of old packet */
     420            /* the low level expects fields to be in host format so let's convert them*/
     421            ip = mtod(so->so_m, struct ip *);
     422            NTOHS(ip->ip_len);
     423            NTOHS(ip->ip_off);
     424            NTOHS(ip->ip_id);
     425            ip->ip_dst.s_addr = dst;
     426#endif
    414427            icmp_reflect(pData, so->so_m);
    415428            so->so_m = 0; /* Don't m_free() it again! */
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