@@ -48,6 +48,16 @@ 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 (
52+ "--vmnet-network-identifier=UUID The identifier(uuid) to uniquely identify the network. "
53+ "\n"
54+ " This property is only applicable to a vmnet_interface\n"
55+ " in VMNET_HOST_MODE.\n"
56+ " If this property is set, the vmnet_interface is added "
57+ "to \n"
58+ " an isolated network with the specified\n"
59+ " identifier. No DHCP service is provided on this "
60+ "network.\n" );
5161 printf ("--vmnet-nat66-prefix=PREFIX:: The IPv6 prefix to use with "
5262 "shared mode.\n" );
5363 printf (" The prefix must be a ULA i.e. "
7282 CLI_OPT_VMNET_MASK ,
7383 CLI_OPT_VMNET_INTERFACE_ID ,
7484 CLI_OPT_VMNET_NAT66_PREFIX ,
85+ CLI_OPT_VMNET_NETWORK_IDENTIFIER ,
7586};
7687
7788struct cli_options * cli_options_parse (int argc , char * argv []) {
@@ -82,18 +93,19 @@ struct cli_options *cli_options_parse(int argc, char *argv[]) {
8293 }
8394
8495 const struct option longopts [] = {
85- {"socket-group" , required_argument , NULL , CLI_OPT_SOCKET_GROUP },
86- {"vmnet-mode" , required_argument , NULL , CLI_OPT_VMNET_MODE },
87- {"vmnet-interface" , required_argument , NULL , CLI_OPT_VMNET_INTERFACE },
88- {"vmnet-gateway" , required_argument , NULL , CLI_OPT_VMNET_GATEWAY },
89- {"vmnet-dhcp-end" , required_argument , NULL , CLI_OPT_VMNET_DHCP_END },
90- {"vmnet-mask" , required_argument , NULL , CLI_OPT_VMNET_MASK },
91- {"vmnet-interface-id" , required_argument , NULL , CLI_OPT_VMNET_INTERFACE_ID },
92- {"vmnet-nat66-prefix" , required_argument , NULL , CLI_OPT_VMNET_NAT66_PREFIX },
93- {"pidfile" , required_argument , NULL , 'p' },
94- {"help" , no_argument , NULL , 'h' },
95- {"version" , no_argument , NULL , 'v' },
96- {0 , 0 , 0 , 0 },
96+ {"socket-group" , required_argument , NULL , CLI_OPT_SOCKET_GROUP },
97+ {"vmnet-mode" , required_argument , NULL , CLI_OPT_VMNET_MODE },
98+ {"vmnet-interface" , required_argument , NULL , CLI_OPT_VMNET_INTERFACE },
99+ {"vmnet-gateway" , required_argument , NULL , CLI_OPT_VMNET_GATEWAY },
100+ {"vmnet-dhcp-end" , required_argument , NULL , CLI_OPT_VMNET_DHCP_END },
101+ {"vmnet-mask" , required_argument , NULL , CLI_OPT_VMNET_MASK },
102+ {"vmnet-interface-id" , required_argument , NULL , CLI_OPT_VMNET_INTERFACE_ID },
103+ {"vmnet-nat66-prefix" , required_argument , NULL , CLI_OPT_VMNET_NAT66_PREFIX },
104+ {"vmnet-network-identifier" , required_argument , NULL , CLI_OPT_VMNET_NETWORK_IDENTIFIER },
105+ {"pidfile" , required_argument , NULL , 'p' },
106+ {"help" , no_argument , NULL , 'h' },
107+ {"version" , no_argument , NULL , 'v' },
108+ {0 , 0 , 0 , 0 },
97109 };
98110 int opt = 0 ;
99111 while ((opt = getopt_long (argc , argv , "hvp:" , longopts , NULL )) != -1 ) {
@@ -134,6 +146,12 @@ struct cli_options *cli_options_parse(int argc, char *argv[]) {
134146 case CLI_OPT_VMNET_NAT66_PREFIX :
135147 res -> vmnet_nat66_prefix = strdup (optarg );
136148 break ;
149+ case CLI_OPT_VMNET_NETWORK_IDENTIFIER :
150+ if (uuid_parse (optarg , res -> vmnet_network_identifier ) < 0 ) {
151+ ERRORF ("Failed to parse network identifier UUID \"%s\"" , optarg );
152+ goto error ;
153+ }
154+ break ;
137155 case 'p' :
138156 res -> pidfile = strdup (optarg );
139157 break ;
@@ -191,7 +209,7 @@ struct cli_options *cli_options_parse(int argc, char *argv[]) {
191209 goto error ;
192210 }
193211 if (res -> vmnet_gateway == NULL ) {
194- if (res -> vmnet_mode != VMNET_BRIDGED_MODE ) {
212+ if (res -> vmnet_mode != VMNET_BRIDGED_MODE && res -> vmnet_mode != VMNET_HOST_MODE ) {
195213 WARN ("--vmnet-gateway=IP should be explicitly specified to "
196214 "avoid conflicting with other applications" );
197215 }
0 commit comments