VirtualBox

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


Ignore:
Timestamp:
Dec 7, 2008 11:44:04 AM (16 years ago)
Author:
vboxsync
Message:

introducing ICMP support in Windows (not working)

File:
1 edited

Legend:

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

    r15060 r15062  
    3737#include "slirp.h"
    3838#include "ip_icmp.h"
     39#ifdef RT_OS_WINDOWS
     40#include <Icmpapi.h>
     41#include <Iphlpapi.h>
     42#endif
    3943
    4044
     
    7276        pData->icmp_socket.so_type = IPPROTO_ICMP;
    7377        pData->icmp_socket.so_state = SS_ISFCONNECTED;
     78#ifndef RT_OS_WINDOWS
    7479        pData->icmp_socket.s = socket(PF_INET, SOCK_RAW, IPPROTO_ICMP);
     80#else
     81        pData->icmp_socket.s = IcmpCreateFile();
     82#endif
    7583        insque(pData, &pData->icmp_socket, &udb);
    7684        LIST_INIT(&pData->icmp_msg_head);
     
    236244      }
    237245#else /* !VBOX_WITH_SLIRP_ICMP */
     246#ifdef RT_OS_WINDOWS     
     247      IP_OPTION_INFORMATION ipopt;
     248#endif
    238249      addr.sin_family = AF_INET;
    239250      if ((ip->ip_dst.s_addr & htonl(pData->netmask)) == special_addr.s_addr) {
     
    253264      icmp_attach(pData, m);
    254265      /* Send the packet */
     266#ifndef RT_OS_WINDOWS
    255267      status = setsockopt(pData->icmp_socket.s, IPPROTO_IP, IP_TTL, (void *)&ip->ip_ttl, sizeof(ip->ip_ttl));
    256268      if (status < 0) {
     
    264276        m_free(pData, m);
    265277      }
     278#else
     279      memset(&ipopt, 0, sizeof(IP_OPTION_INFORMATION));
     280      ipopt.Ttl = ip->ip_ttl;
     281      m->m_ext = malloc(1500);
     282      status = IcmpSendEcho(pData->icmp_socket.s, VBOX_SOCKET_EVENT, &addr, icp, icmplen, m->m_ext, 1500, 0);
     283      if (status == 0) {
     284            LogRel(("error(%d) occured while sending ICMP\n", GetLastError()));
     285      }
     286#endif
    266287
    267288#endif /* VBOX_WITH_SLIRP_ICMP */
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