Opened 6 years ago
Closed 5 years ago
#17963 closed defect (fixed)
Trunk interface names truncated to 7 characters on macOS hosts
Reported by: | DWPoon | Owned by: | |
---|---|---|---|
Component: | network | Version: | VirtualBox 5.2.18 |
Keywords: | Cc: | ||
Guest type: | all | Host type: | Mac OS X |
Description
If the name of a trunk interface on a macOS host is 8 characters or longer, then it causes an error when starting a VirtualBox guest:
Change History (7)
comment:2 by , 6 years ago
I just wanted to say "KUDOS!!!" for a perfectly documented and formatted ticket. It's a rarity these days, so much so, that it almost brought tears in my eyes! :D
I'm building VirtualBox for OSX on a 10.9.6 VM that I have just for that purpose. I'll try your suggestion, which pretty boils down to:
- char szTrunk[8]; + char szTrunk[INTNET_MAX_TRUNK_NAME];
Right? I can't run not even DOS after I'm done building VirtualBox (nested virtualization, blah, blah...) but I can definitely see if it's going to work at the configuration level.
Will keep you posted...
comment:3 by , 6 years ago
The command
sudo ifconfig vlan1387 vlan 1387 vlan en0
didn't work for me, I had to issue the command
sudo ifconfig vlan1387 vlan 1387
vlandev
en0
maybe it was a typo. Anyway, after that, ifconfig
shows:
vlan1387: flags=8842<BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500 options=23<RXCSUM,TXCSUM,TSO4> ether 08:00:27:8a:5a:42 vlan: 1387 parent interface: en0 media: autoselect (1000baseT <full-duplex>) status: active
and if I start the VM, the VBox.log shows that vlan1387
is indeed chopped off:
00:00:10.546906 [/Devices/pcnet/0/LUN#0/Config/] (level 5) 00:00:10.546909 IfPolicyPromisc <string> = "deny" (cb=5) 00:00:10.546911 IgnoreConnectFailure <integer> = 0x0000000000000000 (0) 00:00:10.546914 Network <string> = "HostInterfaceNetworking-vlan138" (cb=32) 00:00:10.546916 Trunk <string> = "vlan138" (cb=8) 00:00:10.546918 TrunkType <integer> = 0x0000000000000003 (3)
Applying the patch described in my previous post, I get:
00:00:01.501953 [/Devices/pcnet/0/LUN#0/Config/] (level 5) 00:00:01.501956 IfPolicyPromisc <string> = "deny" (cb=5) 00:00:01.501957 IgnoreConnectFailure <integer> = 0x0000000000000000 (0) 00:00:01.501959 Network <string> = "HostInterfaceNetworking-vlan1387" (cb=33) 00:00:01.501960 Trunk <string> = "vlan1387" (cb=9) 00:00:01.501962 TrunkType <integer> = 0x0000000000000003 (3)
Success! \o/
And just for completion, here's the full patch. Not sure if it's going to be applied as is. Maybe there needs to be a change in the INTNET_MAX_TRUNK_NAME to 256, and applied "globally" for Win, OSX, Linux and Solaris (which is fixed at 256).
Index: src/VBox/Main/src-client/ConsoleImpl2.cpp =================================================================== --- src/VBox/Main/src-client/ConsoleImpl2.cpp (revision 73978) +++ src/VBox/Main/src-client/ConsoleImpl2.cpp (working copy) @@ -5308,7 +5308,7 @@ # if defined(RT_OS_DARWIN) /* The name is on the form 'ifX: long name', chop it off at the colon. */ - char szTrunk[8]; + char szTrunk[INTNET_MAX_TRUNK_NAME]; RTStrCopy(szTrunk, sizeof(szTrunk), pszBridgedIfName); char *pszColon = (char *)memchr(szTrunk, ':', sizeof(szTrunk)); // Quick fix for @bugref{5633}
comment:4 by , 6 years ago
Thanks for the confirmation and patch. You're right, I had intended to write sudo ifconfig vlan1387 vlan 1387 vlandev en0
.
comment:5 by , 6 years ago
Related discussion in the forums: https://forums.virtualbox.org/viewtopic.php?f=10&t=90129
comment:7 by , 5 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
If the name of a trunk interface on a macOS host is 8 characters or longer, then it causes an error when starting a VirtualBox guest:
Steps to reproduce
vlan1387
:If I try the same steps with a shorter interface name (e.g.
vlan0
), it works.Dumps
Excerpts from
Logs/VBox.log
:Excerpt from the
.vbox
XML:Diagnosis
In
src/VBox/Main/src-client/ConsoleImpl2.cpp
, at line 5309:The 8-byte buffer
char szTrunk[8]
is much too short. The Solaris port uses a 256-byte buffer. Another decent choice would beINTNET_MAX_TRUNK_NAME
(include/VBox/intnet.h):