-
Notifications
You must be signed in to change notification settings - Fork 21
feat: Allow specifying vmnet network UUID to disable DHCP #140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
c49d5b0
to
9de6fa5
Compare
let me know if you want to create a correspondent |
df1f00b
to
f912515
Compare
@AkihiroSuda hey can you guys let me know what you think of this when you get a chance? :) |
Thanks, but please sign the commit for DCO (run |
|
||
### No DHCP mode | ||
|
||
By passing `--vmnet-mode=host` without `--vmnet-gateway` to `socket_vmnet`, the internal DHCP will be disabled. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ia this a breaking change or just an explanation of the existing behavior?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's an explanation of what happens when you do that, as I explained in #139.
From vmnet.framework/Headers/vmnet.h
:
/*!
* @constant vmnet_network_identifier_key
* The identifier (uuid) to uniquely identify the network.
*
* This property is only applicable to a vmnet_interface in
* VMNET_HOST_MODE.
*
* If this property is set, the vmnet_interface is added to
* an isolated network with the specified identifier.
*
* No DHCP service is provided on this network.
*/
extern const char * const
vmnet_network_identifier_key API_AVAILABLE(macos(11.0)) API_UNAVAILABLE(ios, watchos, tvos);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, this is a breaking change, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we just keep the behavior of v1.2.1 for compatibility, and require explicitly setting --vmnet-network-identifier
(UUID string, "random", or "")?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not think it is breaking change because by default your launchd/.plist config always specifies --vmnet-gateway
and that keeps dhcp on:
❯ sudo ./socket_vmnet "/opt/homebrew/var/run/socket_vmnet" --vmnet-mode=host --vmnet-gateway=192.168.111.1
INFO | Initializing vmnet.framework (mode 1000)
INFO | * vmnet_write_max_packets: 256
INFO | * vmnet_read_max_packets: 256
INFO | * vmnet_subnet_mask: 255.255.255.0
INFO | * vmnet_mtu: 1500
INFO | * vmnet_end_address: 192.168.111.254
INFO | * vmnet_start_address: 192.168.111.1
INFO | * vmnet_interface_id: 52F9E326-9D2B-4F82-B695-39071E9C1A7F
INFO | * vmnet_max_packet_size: 1514
INFO | * vmnet_mac_address: f6:a1:bd:dd:39:23
vs running w/o other options:
❯ sudo ./socket_vmnet "/opt/homebrew/var/run/socket_vmnet" --vmnet-mode=host
INFO | Initializing vmnet.framework (mode 1000)
INFO | Using network identifier "EAAE7252-D205-4D97-A9DA-5B7A02808BE2" and no vmnet gateway -> NO DHCP will be enabled on this vmnet
INFO | * vmnet_write_max_packets: 256
INFO | * vmnet_read_max_packets: 256
INFO | * vmnet_subnet_mask: 0.0.0.0
INFO | * vmnet_mtu: 1500
INFO | * vmnet_end_address: 255.255.255.254
INFO | * vmnet_start_address: 0.0.0.0
INFO | * vmnet_interface_id: B5D1817C-D455-4EDF-B329-E484C4115195
INFO | * vmnet_max_packet_size: 1514
INFO | * vmnet_mac_address: 4a:d0:f8:94:9b:b3
that said, I can make the change you propose if you think it's better for backward compatibility and users :)
I was wondering at this point if we shuoldn't just have a --no-dhcp
option that only works when --vmnet-mode=host
is provided and conflicts with --vmnet-gateway
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for the comments, and sorry about the signature mishap.
I was using my corporate laptop and the setup there is a bit messy. Will fix.
I think my commits are all good yet but I dunno why DCO is failing now :( ![]() |
c843af1
to
f7bdb95
Compare
my last commit has the sign-off but I dunno why DCO is failing... :(
|
Yes, please |
…ost network only) This commit introduces a new `--vmnet-network-uuid` command-line option to allow setting the `vmnet_network_identifier_key` for vmnet. This property is only applicable to a vmnet_interface in VMNET_HOST_MODE. If this property is set, the vmnet_interface is added to an isolated network with the specified identifier. No DHCP service is provided on this network. This is useful for certain applications where the users need an isolated network and are running their own dhcp to assign IPs in such network. See issue [lima-vm#139](lima-vm#139) ``` ❯ sudo ./socket_vmnet "/opt/homebrew/var/run/socket_vmnet" --vmnet-mode=host --vmnet-gateway=192.168.100.1 --vmnet-network-uuid=99eddb74-3193-48e3-bafb-b3ca99e949c1 Password: INFO | Initializing vmnet.framework (mode 1000) INFO | * vmnet_write_max_packets: 256 INFO | * vmnet_read_max_packets: 256 INFO | * vmnet_subnet_mask: 0.0.0.0 INFO | * vmnet_mtu: 1500 INFO | * vmnet_end_address: 255.255.255.254 INFO | * vmnet_start_address: 0.0.0.0 INFO | * vmnet_interface_id: 0E21C1D4-43D9-4363-B767-A64FE591EA7D INFO | * vmnet_max_packet_size: 1514 INFO | * vmnet_mac_address: 66:77:98:e1:52:9c ``` I could run my LAB vms, I saw no DHCP been handed over by MacOS/bootp, my Lab runs a special VM with DHCPD and I saw that not colliding. ``` ❯ sudo ./socket_vmnet "/opt/homebrew/var/run/socket_vmnet" --vmnet-gateway=192.168.100.1 --vmnet-network-uuid=99eddb74-3193-48e3-bafb-b3ca99e949c1 INFO | Initializing vmnet.framework (mode 1001) INFO | * vmnet_write_max_packets: 256 INFO | * vmnet_read_max_packets: 256 INFO | * vmnet_subnet_mask: 255.255.255.0 INFO | * vmnet_mtu: 1500 INFO | * vmnet_end_address: 192.168.100.254 INFO | * vmnet_start_address: 192.168.100.1 INFO | * vmnet_interface_id: 99AC02F6-59D3-4192-820B-C8DAED0F2B81 INFO | * vmnet_max_packet_size: 1514 INFO | * vmnet_nat66_prefix: fd86:9a96:2682:1344:: INFO | * vmnet_mac_address: 3a:be:d4:0d:33:11 ``` Signed-off-by: Angelo Failla <[email protected]>
f7bdb95
to
534d141
Compare
ok I fixed DCO, squashes all commits and made sure there is sign off. |
// --vmnet-interface-id, corresponds to vmnet_interface_id_key | ||
uuid_t vmnet_interface_id; | ||
// --vmnet-network-uuid, corresponds to vmnet_network_identifier_key | ||
uuid_t vmnet_network_uuid; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not consistently call this vmnet_network_identifier
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like a breaking change
What
This commit introduces a new
--vmnet-network-uuid
command-line option to allow setting thevmnet_network_identifier_key
for vmnet.This property is only applicable to a vmnet_interface in VMNET_HOST_MODE.
If this property is set, the vmnet_interface is added to an isolated network with the specified identifier.
No DHCP service is provided on this network.
Why
This is useful for certain applications where the users need an isolated network and are running their own dhcp to assign IPs in such network.
See issue #139
Testing
Printed new --help
Ran locally in host mode and network UUID provided:
I could run my LAB vms, I saw no DHCP been handed over by MacOS/bootp, my Lab runs a special VM with DHCPD and I saw that not colliding.
Ran locally in shared mode:
Ran local in host mode + deafault gw (show dhcp should be enabled)