Changeset 5182 in vbox
- Timestamp:
- Oct 8, 2007 1:08:59 PM (17 years ago)
- svn:sync-xref-src-repo-rev:
- 25103
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/DrvTAP.cpp
r5134 r5182 95 95 /** The actual TAP device name. */ 96 96 char *pszDeviceNameActual; 97 /** IP device file handle (/dev/udp). */ 98 RTFILE IPFileDevice; 97 99 #endif 98 100 /** TAP setup application. */ … … 560 562 561 563 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) 569 566 return PDMDrvHlpVMSetError(pDrvIns, VERR_PDM_HIF_OPEN_FAILED, RT_SRC_POS, 570 567 N_("Failed to open /dev/udp. errno=%d"), errno); … … 637 634 638 635 /* IP */ 639 if (ioctl( s_IPFileDes, I_POP, NULL) == -1)636 if (ioctl(IPFileDes, I_POP, NULL) == -1) 640 637 LogRel(("TAP#%d: Failed I_POP from IP FD. errno=%d\n", pDrvIns->iInstance, errno)); 641 638 642 if (ioctl( s_IPFileDes, I_PUSH, "arp") == -1)639 if (ioctl(IPFileDes, I_PUSH, "arp") == -1) 643 640 LogRel(("TAP#%d: Failed to push ARP to IP FD. errno=%d\n", pDrvIns->iInstance, errno)); 644 641 … … 663 660 * Even 'unplumb' won't work after that. 664 661 */ 665 int IPMuxID = ioctl( s_IPFileDes, I_LINK, InterfaceFD);662 int IPMuxID = ioctl(IPFileDes, I_LINK, InterfaceFD); 666 663 if (IPMuxID == -1) 667 664 { … … 676 673 677 674 #ifdef VBOX_SOLARIS_TAP_ARP 678 int ARPMuxID = ioctl( s_IPFileDes, I_LINK, ARPFileDes);675 int ARPMuxID = ioctl(IPFileDes, I_LINK, ARPFileDes); 679 676 if (ARPMuxID == -1) 680 677 LogRel(("TAP#%d: Failed to link TAP device to ARP\n", pDrvIns->iInstance)); … … 692 689 #endif 693 690 694 if (ioctl( s_IPFileDes, SIOCSLIFMUXID, &ifReq) == -1)691 if (ioctl(IPFileDes, SIOCSLIFMUXID, &ifReq) == -1) 695 692 { 696 693 #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); 702 698 LogRel(("TAP#%d: Failed to set Mux ID.\n", pDrvIns->iInstance)); 703 699 return PDMDrvHlpVMSetError(pDrvIns, VERR_HOSTIF_IOCTL, RT_SRC_POS, … … 705 701 } 706 702 707 /* what's the point? */708 703 pData->FileDevice = (RTFILE)TapFileDes; 704 pData->IPFileDevice = (RTFILE)IPFileDes; 709 705 pData->pszDeviceNameActual = RTStrDup(pszDevName); 710 706 … … 792 788 drvTAPTerminateApplication(pData); 793 789 790 if (pData->IPFileDevice != NIL_RTFILE) 791 { 792 int rc = RTFileClose(pData->IPFileDevice); 793 AssertRC(rc); 794 pData->IPFileDevice = NIL_RTFILE; 795 } 796 794 797 RTStrFree(pData->pszDeviceNameActual); 795 798 #endif … … 822 825 #ifdef RT_OS_SOLARIS 823 826 pData->pszDeviceNameActual = NULL; 827 pData->IPFileDevice = NIL_RTFILE; 824 828 #endif 825 829 pData->pszSetupApplication = NULL;
Note:
See TracChangeset
for help on using the changeset viewer.