Changeset 105163 in vbox for trunk/src/VBox/Main
- Timestamp:
- Jul 5, 2024 2:26:46 PM (7 months ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/include/netif.h
r98103 r105163 43 43 # include <stdio.h> 44 44 #endif /* !RT_OS_WINDOWS */ 45 46 #ifdef RT_OS_LINUX 47 # include <linux/version.h> 48 # if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0) /* proc_ns introduced */ 49 # define VBOXNETFLT_LINUX_NAMESPACE_SUPPORT 50 # endif 51 #endif 45 52 46 53 #define VBOXNET_IPV4ADDR_DEFAULT 0x0138A8C0 /* 192.168.56.1 */ -
trunk/src/VBox/Main/src-client/ConsoleImplConfigCommon.cpp
r104946 r105163 2660 2660 } 2661 2661 } 2662 # ifdef VBOXNETFLT_LINUX_NAMESPACE_SUPPORT 2663 RTUUID IfaceUuid; 2664 Bstr IfId; 2665 hrc = hostInterface->COMGETTER(Id)(IfId.asOutParam()); H(); 2666 vrc = RTUuidFromUtf16(&IfaceUuid, IfId.raw()); 2667 AssertRCReturn(vrc, vrc); 2668 char szTrunkNameWithNamespace[INTNET_MAX_TRUNK_NAME]; 2669 RTStrPrintf(szTrunkNameWithNamespace, sizeof(szTrunkNameWithNamespace), "%u/%s", 2670 IfaceUuid.au32[0], pszTrunk); 2671 pszTrunk = szTrunkNameWithNamespace; 2672 # endif 2662 2673 2663 2674 # else -
trunk/src/VBox/Main/src-server/linux/NetIf-linux.cpp
r98288 r105163 44 44 #include <unistd.h> 45 45 #include <iprt/asm.h> 46 #include <errno.h> 46 47 47 48 #include "HostNetworkInterfaceImpl.h" … … 155 156 RTUUID uuid; 156 157 RTUuidClear(&uuid); 158 #ifdef VBOXNETFLT_LINUX_NAMESPACE_SUPPORT 159 uuid.au32[0] = 0; /* Use 0 as the indicator of missing namespace info. */ 160 /* 161 * Namespace links use the following naming convention: "net:[1234567890]". 162 * The maximum value of inode number is 4294967295, which gives up precisely 163 * 16 characters without terminating zero. 164 */ 165 char szBuf[24]; 166 ssize_t len = readlink("/proc/self/ns/net", szBuf, sizeof(szBuf) - 1); 167 if (len == -1) 168 Log(("NetIfList: Failed to get namespace for VBoxSVC, error %d\n", errno)); 169 else if (!RTStrStartsWith(szBuf, "net:[")) 170 Log(("NetIfList: Failed to get network namespace inode from %s\n", szBuf)); 171 else 172 uuid.au32[0] = RTStrToUInt32(szBuf + 5); 173 Log(("NetIfList: VBoxSVC namespace inode %u\n", uuid.au32[0])); 174 /* Hashing the name is probably an overkill as MAC addresses should ensure uniqueness */ 175 uuid.au32[1] = RTStrHash1(pszName); 176 #else /* !VBOXNETFLT_LINUX_NAMESPACE_SUPPORT */ 157 177 memcpy(&uuid, Req.ifr_name, RT_MIN(sizeof(Req.ifr_name), sizeof(uuid))); 178 #endif /* !VBOXNETFLT_LINUX_NAMESPACE_SUPPORT */ 158 179 uuid.Gen.u8ClockSeqHiAndReserved = (uint8_t)((uuid.Gen.u8ClockSeqHiAndReserved & 0x3f) | 0x80); 159 180 uuid.Gen.u16TimeHiAndVersion = (uint16_t)((uuid.Gen.u16TimeHiAndVersion & 0x0fff) | 0x4000);
Note:
See TracChangeset
for help on using the changeset viewer.