VirtualBox

Changeset 5182 in vbox


Ignore:
Timestamp:
Oct 8, 2007 1:08:59 PM (17 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
25103
Message:

Solaris

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Network/DrvTAP.cpp

    r5134 r5182  
    9595    /** The actual TAP device name. */
    9696    char                   *pszDeviceNameActual;
     97    /** IP device file handle (/dev/udp). */
     98    RTFILE                  IPFileDevice;
    9799#endif
    98100    /** TAP setup application. */
     
    560562   
    561563   
    562     /* Close previously opened file desc., if any. */
    563     static int s_IPFileDes = -1;
    564     if (s_IPFileDes >= 0)
    565         close(s_IPFileDes);
    566    
    567     s_IPFileDes = open("/dev/udp", O_RDWR, 0);
    568     if (s_IPFileDes < 0)
     564    int IPFileDes = open("/dev/udp", O_RDWR, 0);
     565    if (IPFileDes < 0)
    569566        return PDMDrvHlpVMSetError(pDrvIns, VERR_PDM_HIF_OPEN_FAILED, RT_SRC_POS,
    570567                                   N_("Failed to open /dev/udp. errno=%d"), errno);
     
    637634
    638635    /* IP */
    639     if (ioctl(s_IPFileDes, I_POP, NULL) == -1)
     636    if (ioctl(IPFileDes, I_POP, NULL) == -1)
    640637        LogRel(("TAP#%d: Failed I_POP from IP FD. errno=%d\n", pDrvIns->iInstance, errno));
    641638
    642     if (ioctl(s_IPFileDes, I_PUSH, "arp") == -1)
     639    if (ioctl(IPFileDes, I_PUSH, "arp") == -1)
    643640        LogRel(("TAP#%d: Failed to push ARP to IP FD. errno=%d\n", pDrvIns->iInstance, errno));
    644641   
     
    663660     * Even 'unplumb' won't work after that.
    664661     */
    665     int IPMuxID = ioctl(s_IPFileDes, I_LINK, InterfaceFD);
     662    int IPMuxID = ioctl(IPFileDes, I_LINK, InterfaceFD);
    666663    if (IPMuxID == -1)
    667664    {
     
    676673   
    677674#ifdef VBOX_SOLARIS_TAP_ARP
    678     int ARPMuxID = ioctl(s_IPFileDes, I_LINK, ARPFileDes);
     675    int ARPMuxID = ioctl(IPFileDes, I_LINK, ARPFileDes);
    679676    if (ARPMuxID == -1)
    680677        LogRel(("TAP#%d: Failed to link TAP device to ARP\n", pDrvIns->iInstance));
     
    692689#endif
    693690
    694     if (ioctl(s_IPFileDes, SIOCSLIFMUXID, &ifReq) == -1)
     691    if (ioctl(IPFileDes, SIOCSLIFMUXID, &ifReq) == -1)
    695692    {
    696693#ifdef VBOX_SOLARIS_TAP_ARP
    697         ioctl(s_IPFileDes, I_PUNLINK, ARPMuxID);
    698 #endif
    699         ioctl(s_IPFileDes, I_PUNLINK, IPMuxID);
    700         close(s_IPFileDes);
    701         s_IPFileDes = -1;
     694        ioctl(IPFileDes, I_PUNLINK, ARPMuxID);
     695#endif
     696        ioctl(IPFileDes, I_PUNLINK, IPMuxID);
     697        close(IPFileDes);
    702698        LogRel(("TAP#%d: Failed to set Mux ID.\n", pDrvIns->iInstance));
    703699        return PDMDrvHlpVMSetError(pDrvIns, VERR_HOSTIF_IOCTL, RT_SRC_POS,
     
    705701    }
    706702
    707     /* what's the point? */
    708703    pData->FileDevice = (RTFILE)TapFileDes;
     704    pData->IPFileDevice = (RTFILE)IPFileDes;
    709705    pData->pszDeviceNameActual = RTStrDup(pszDevName);
    710706   
     
    792788        drvTAPTerminateApplication(pData);
    793789
     790    if (pData->IPFileDevice != NIL_RTFILE)
     791    {
     792        int rc = RTFileClose(pData->IPFileDevice);
     793        AssertRC(rc);
     794        pData->IPFileDevice = NIL_RTFILE;
     795    }
     796
    794797    RTStrFree(pData->pszDeviceNameActual);
    795798#endif
     
    822825#ifdef RT_OS_SOLARIS
    823826    pData->pszDeviceNameActual          = NULL;
     827    pData->IPFileDevice                 = NIL_RTFILE;
    824828#endif
    825829    pData->pszSetupApplication          = NULL;
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette