VirtualBox

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


Ignore:
Timestamp:
Dec 18, 2008 10:22:45 PM (16 years ago)
Author:
vboxsync
Message:

slirp:makes icmp support unaware of synchronization method on Windows
(need to be checked on Vista)

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

Legend:

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

    r15636 r15672  
    4242#endif
    4343
     44#ifdef RT_OS_WINDOWS
     45# ifdef VBOX_WITH_SIMPLIFIED_SLIRP_SYNC
     46# define ICMP_SEND_ECHO(event, routine, addr, data, datasize, ipopt)                                        \
     47                IcmpSendEcho2(pData->icmp_socket.sh, (event), NULL, NULL, (addr), (data), (datasize),       \
     48                               (ipopt), pData->pvIcmpBuffer, pData->szIcmpBuffer, 1)
     49# else /* VBOX_WITH_SIMPLIFIED_SLIRP_SYNC */
     50# define ICMP_SEND_ECHO(event, routine, addr, data, datasize, ipopt)                                                        \
     51                IcmpSendEcho2(pData->icmp_socket.s, NULL, (FARPROC)(routine), (void *)pData, (addr), (data), (datasize),    \
     52                             (ipopt), pData->pvIcmpBuffer, pData->szIcmpBuffer, 1)
     53static void WINAPI notify_slirp(void *);
     54# endif /* !VBOX_WITH_SIMPLIFIED_SLIRP_SYNC */
     55#endif /* RT_OS_WINDOWS */
    4456
    4557/* The message sent when emulating PING */
     
    124136    }
    125137    pData->icmp_socket.sh = IcmpCreateFile();
     138# ifdef VBOX_WITH_SIMPLIFIED_SLIRP_SYNC
    126139    pData->phEvents[VBOX_ICMP_EVENT_INDEX] = CreateEvent(NULL, FALSE, FALSE, NULL);
     140# endif /* VBOX_WITH_SIMPLIFIED_SLIRP_SYNC */
    127141    pData->szIcmpBuffer = sizeof(ICMP_ECHO_REPLY) * 10;
    128142    pData->pvIcmpBuffer = malloc(pData->szIcmpBuffer);
     
    389403                memset(&ipopt, 0, sizeof(IP_OPTION_INFORMATION));
    390404                ipopt.Ttl = ip->ip_ttl;
    391                 status = IcmpSendEcho2(pData->icmp_socket.sh, pData->phEvents[VBOX_ICMP_EVENT_INDEX],
    392                                        NULL, NULL, addr.sin_addr.s_addr, icp->icmp_data,
    393                                        icmplen - offsetof(struct icmp, icmp_data) , &ipopt,
    394                                        pData->pvIcmpBuffer, pData->szIcmpBuffer, 1);
     405                status = ICMP_SEND_ECHO(pData->phEvents[VBOX_ICMP_EVENT_INDEX], notify_slirp, addr.sin_addr.s_addr,
     406                                icp->icmp_data, icmplen - ICMP_MINLEN, &ipopt);
    395407                if (status == 0 && (error = GetLastError()) != ERROR_IO_PENDING)
    396408                {
     
    615627    icmpstat.icps_reflect++;
    616628}
     629#if defined(RT_OS_WINDOWS) && !defined(VBOX_WITH_SIMPLIFIED_SLIRP_SYNC)
     630static void WINAPI 
     631notify_slirp(void *ctx)
     632{
     633    /* pData name is important see slirp_state.h */
     634    PNATState pData = (PNATState)ctx;
     635    fIcmp = 1;
     636}
     637#endif
  • trunk/src/VBox/Devices/Network/slirp/slirp.c

    r15636 r15672  
    706706    {
    707707#if defined(RT_OS_WINDOWS)
     708        /*XXX: before renaming please make see define
     709         * fIcmp in slirp_state.h
     710         */
    708711        if (fIcmp)
    709712            sorecvfrom(pData, &pData->icmp_socket);
  • trunk/src/VBox/Devices/Network/slirp/slirp_state.h

    r15638 r15672  
    134134    HANDLE phEvents[VBOX_EVENT_COUNT];
    135135#endif
     136#if !defined(VBOX_WITH_SIMPLIFIED_SLIRP_SYNC) && defined(RT_OS_WINDOWS)
     137    int fIcmp;
     138#endif
    136139    STAMPROFILE StatFill;
    137140    STAMPROFILE StatPoll;
     
    247250#define tcp_reass_overflows pData->tcp_reass_overflows
    248251
     252#if !defined(VBOX_WITH_SIMPLIFIED_SLIRP_SYNC) && defined(RT_OS_WINDOWS)
     253# define fIcmp pData->fIcmp
     254#endif
     255
    249256#endif /* !_slirp_state_h_ */
  • trunk/src/VBox/Devices/Network/slirp/socket.c

    r15636 r15672  
    914914
    915915    len = pData->pfIcmpParseReplies(pData->pvIcmpBuffer, pData->szIcmpBuffer);
     916#ifndef VBOX_WITH_SIMPLIFIED_SLIRP_SYNC
     917    fIcmp = 0;  /* reply processed */
     918#endif
    916919    if (len < 0)
    917920    {
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