VirtualBox

Changeset 53776 in vbox


Ignore:
Timestamp:
Jan 12, 2015 4:38:11 PM (10 years ago)
Author:
vboxsync
Message:

NAT: Make it possible to use privileged helper to obtain raw ICMP
socket when debugging unprivileged. Conditional on
VBOX_RAWSOCK_DEBUG_HELPER that is added to the makefile but is
commented out.

Location:
trunk/src/VBox/Devices
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Makefile.kmk

    r53755 r53776  
    677677 ifeq ($(KBUILD_TARGET), win)
    678678  VBOX_SLIRP_SOURCES += Network/slirp/ip_icmpwin.c
     679 else ifneq ($(KBUILD_TARGET),darwin)
     680  # helper for debugging unprivileged
     681#  Network/slirp/ip_icmp.c_DEFS += VBOX_RAWSOCK_DEBUG_HELPER
     682#  VBOX_SLIRP_SOURCES += ../NetworkServices/NAT/getrawsock.c
    679683 endif
    680684
  • trunk/src/VBox/Devices/Network/slirp/ip_icmp.c

    r53399 r53776  
    5656#include "slirp.h"
    5757#include "ip_icmp.h"
     58
     59#ifdef VBOX_RAWSOCK_DEBUG_HELPER
     60int getrawsock(int type);
     61#endif
     62
    5863
    5964/* The message sent when emulating PING */
     
    108113    {
    109114        int rc = RTErrConvertFromErrno(errno);
     115#  if defined(RT_OS_DARWIN) || !defined(VBOX_RAWSOCK_DEBUG_HELPER)
    110116        LogRel(("NAT: ICMP/ping not available (could not open ICMP socket, error %Rrc)\n", rc));
    111117        return 1;
     118#  else
     119        /* try to get it from privileged helper */
     120        LogRel(("NAT: ICMP/ping raw socket error %Rrc, asking helper...\n", rc));
     121        pData->icmp_socket.s = getrawsock(AF_INET);
     122        if (pData->icmp_socket.s == -1)
     123        {
     124            LogRel(("NAT: ICMP/ping not available\n"));
     125            return 1;
     126        }
     127#  endif /* !RT_OS_DARWIN && VBOX_RAWSOCK_DEBUG_HELPER */
    112128    }
    113129    fd_nonblock(pData->icmp_socket.s);
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