Skip to content

Commit e463209

Browse files
committed
fixed README.md wrong formatting
2 parents ed6d459 + 1bf33dc commit e463209

File tree

4 files changed

+32
-32
lines changed

4 files changed

+32
-32
lines changed

.github/workflows/lima.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,14 @@ jobs:
6565
limactl shell vm1 sudo apt-get update
6666
limactl shell vm1 sudo apt-get install -y iperf3
6767
limactl shell vm1 sudo systemctl start iperf3.service
68+
echo "Waiting for iperf3 server ..."
69+
limactl shell vm1 bash -s << EOF
70+
if ! timeout 10s bash -c "until ss -tln | grep -q :5201; do sleep 1; done"; then
71+
echo >&2 "Timeout waiting for iperf3 port"
72+
exit 1
73+
fi
74+
EOF
75+
echo "iperf3 server is ready"
6876
- name: "Lima: vm1: get the IP"
6977
run: |
7078
limactl shell vm1 ip -4 -json addr show dev lima0 | jq -r .[0].addr_info[0].local | tee /tmp/vm1_iP

README.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ Unlike `vde_vmnet`, `socket_vmnet` does not depend on VDE.
1212
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
1313
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
1414

15-
- [socket_vmnet: vmnet.framework support for rootless and VDE-less QEMU](#socket_vmnet-vmnetframework-support-for-rootless-and-vde-less-qemu)
1615
- [Install](#install)
1716
- [From binary](#from-binary)
1817
- [From source](#from-source)
@@ -124,7 +123,8 @@ Run the following command to start the daemon:
124123
sudo /opt/socket_vmnet/bin/socket_vmnet --vmnet-gateway=192.168.105.1 /var/run/socket_vmnet
125124
```
126125

127-
> [!TIP] > `sudo make install` is also available in addition to `sudo make install.bin`.
126+
> [!TIP]
127+
> `sudo make install` is also available in addition to `sudo make install.bin`.
128128
> The former one installs the launchd service (see below) too.
129129
130130
<details>
@@ -433,14 +433,17 @@ sudo /usr/libexec/ApplicationFirewall/socketfilterfw --add /usr/libexec/bootpd
433433

434434
### How to setup a vmnet host network without DHCP?
435435

436-
You may need to disable the vmnet framework's DHCP to:
436+
Some users may need to disable the vmnet framework's DHCP for various scenarios, such as:
437437

438438
- Create a host network where all VMs have static IPs.
439439
- Run a custom DHCP server on one VM to assign IPs to others on the same network.
440440

441-
To disable the macOS DHCP you must use `--vmnet-mode=host` and provide a `--vmnet-network-idenfitier` UUID.
442-
You **_must not_** provide `--vmnet-gateway`. That is the signal to Apple's vmnet.framework to enable MacOS DHCP.
443-
You can use `--vmnet-network-idenfitier=random` to get a random UUID assigned.
441+
Disabling macOS DHCP only works in `--vmnet-mode=host` if you provide a `--vmnet-network-idenfitier`.
442+
For example, to create a host network without DHCP on `socket_vmnet`:
443+
444+
```bash
445+
sudo /opt/socket_vmnet/bin/socket_vmnet --vmnet-mode=host --vmnet-network-identifier=$(uuidgen)
446+
```
444447

445448
## Links
446449

cli.c

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,12 @@ static void print_usage(const char *argv0) {
4848
"specified\n");
4949
printf("--vmnet-interface-id=UUID vmnet interface ID (default: "
5050
"random)\n");
51-
printf("--vmnet-network-identifier=UUID vmnet network identifier (UUID string, \"random\", "
52-
"or \"\")\n"
53-
" When vmnet mode is \"host\" and --vmnet-gateway is "
54-
"not set, the internal DHCP will be disabled.\n"
55-
" (default: \"\")\n");
51+
printf("--vmnet-network-identifier=UUID The identifier(uuid) to uniquely identify the network. \n"
52+
" This property is only applicable to a vmnet_interface\n"
53+
" in VMNET_HOST_MODE.\n"
54+
" If this property is set, the vmnet_interface is added to \n"
55+
" an isolated network with the specified\n"
56+
" identifier. No DHCP service is provided on this network.\n");
5657

5758
printf("--vmnet-nat66-prefix=PREFIX:: The IPv6 prefix to use with "
5859
"shared mode.\n");
@@ -143,12 +144,8 @@ struct cli_options *cli_options_parse(int argc, char *argv[]) {
143144
res->vmnet_nat66_prefix = strdup(optarg);
144145
break;
145146
case CLI_OPT_VMNET_NETWORK_IDENTIFIER:
146-
if (strcmp(optarg, "random") == 0) {
147-
uuid_generate_random(res->vmnet_network_identifier);
148-
} else if (strcmp(optarg, "") == 0) {
149-
uuid_clear(res->vmnet_network_identifier);
150-
} else if (uuid_parse(optarg, res->vmnet_network_identifier) < 0) {
151-
ERRORF("Failed to parse UUID \"%s\"", optarg);
147+
if (uuid_parse(optarg, res->vmnet_network_identifier) < 0) {
148+
ERRORF("Failed to parse network identifier UUID \"%s\"", optarg);
152149
goto error;
153150
}
154151
break;

main.c

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -231,22 +231,14 @@ static interface_ref start(struct state *state, struct cli_options *cliopt) {
231231
xpc_dictionary_set_string(dict, vmnet_shared_interface_name_key, cliopt->vmnet_interface);
232232
}
233233

234-
// no dhcp
235-
if (cliopt->vmnet_mode == VMNET_HOST_MODE && cliopt->vmnet_gateway == NULL) {
236-
if (!uuid_is_null(cliopt->vmnet_network_identifier)) {
234+
if (!uuid_is_null(cliopt->vmnet_network_identifier)) {
237235
xpc_dictionary_set_uuid(dict, vmnet_network_identifier_key, cliopt->vmnet_network_identifier);
238-
uuid_string_t uuid_str;
239-
uuid_unparse(cliopt->vmnet_network_identifier, uuid_str);
240-
INFOF("Using network identifier \"%s\" and no vmnet gateway -> NO DHCP will be enabled on "
241-
"this vmnet",
242-
uuid_str);
243-
}
244-
} else {
245-
if (cliopt->vmnet_gateway != NULL) {
246-
xpc_dictionary_set_string(dict, vmnet_start_address_key, cliopt->vmnet_gateway);
247-
xpc_dictionary_set_string(dict, vmnet_end_address_key, cliopt->vmnet_dhcp_end);
248-
xpc_dictionary_set_string(dict, vmnet_subnet_mask_key, cliopt->vmnet_mask);
249-
}
236+
}
237+
238+
if (cliopt->vmnet_gateway != NULL) {
239+
xpc_dictionary_set_string(dict, vmnet_start_address_key, cliopt->vmnet_gateway);
240+
xpc_dictionary_set_string(dict, vmnet_end_address_key, cliopt->vmnet_dhcp_end);
241+
xpc_dictionary_set_string(dict, vmnet_subnet_mask_key, cliopt->vmnet_mask);
250242
}
251243

252244
xpc_dictionary_set_uuid(dict, vmnet_interface_id_key, cliopt->vmnet_interface_id);

0 commit comments

Comments
 (0)