Skip to content
Snippets Groups Projects
Commit 263f223e authored by Erik Alexandre Pucci's avatar Erik Alexandre Pucci Committed by Danilo K. S. Yorinori
Browse files

client.c: Added "--nic" option


The client now can be bound to a specific network interface device by using
the "--nic=device_name" ("-n" for short) option, where device_name is the
NIC name (e.g. eth0, wlan0).

Signed-off-by: default avatarErik Alexandre Pucci <eap08@c3sl.ufpr.br>
Acked-by: default avatarRicardo Tavares de Oliveira <rto07@c3sl.ufpr.br>
Signed-off-by: default avatarDanilo K. S. Yorinori <danilok@c3sl.ufpr.br>
parent 90e4c69e
Branches
Tags
No related merge requests found
......@@ -121,6 +121,7 @@ void print_help(void)
ERROR("-U, --puid=userid Proxy user id\n");
ERROR("-w, --ppasswd=pswd Proxy password\n");
ERROR("-h, --help Show this help\n");
ERROR("-n, --nic=eth0 Network interface to be bound\n");
}
/*----------------------------------------------------------------------------
......@@ -152,14 +153,15 @@ int verify_parameters(int argc, char **argv, struct soap *soap, char **url,
{"pport", required_argument, 0, 'p'},
{"puid", required_argument, 0, 'U'},
{"ppasswd", required_argument, 0, 'w'},
{"nic", required_argument, 0, 'n'},
{0, 0, 0, 0}
};
inventory = update = help = invalid_option = 0;
/* Parse command line */
while ((option = getopt_long(argc, argv, "hiul:I:H:p:U:w:", long_options,
&option_index)) != -1)
while ((option = getopt_long(argc, argv, "hiul:I:H:p:U:w:n:",
long_options, &option_index)) != -1)
{
switch(option)
{
......@@ -199,6 +201,11 @@ int verify_parameters(int argc, char **argv, struct soap *soap, char **url,
/* Print help message */
help = 1;
break;
case 'n':
soap->device = malloc(sizeof(char) * strlen(optarg));
strcpy(soap->device, optarg);
DEBUG("Network interface device \"%s\" used\n", soap->device);
break;
case '?':
/* Invalid option(s) passed in command line */
invalid_option = 1;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment