Changeset 105163 in vbox for trunk/src/VBox/Main/src-server
- Timestamp:
- Jul 5, 2024 2:26:46 PM (9 months ago)
- svn:sync-xref-src-repo-rev:
- 163803
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.