summaryrefslogtreecommitdiffstats
path: root/dhcpcd.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2014-07-03 23:11:00 +0000
committerRoy Marples <roy@marples.name>2014-07-03 23:11:00 +0000
commitee8a3b3428999c2e01fb1dac4caefb42d0b32c9b (patch)
tree3415fd0a51a67da3a942612164308e200e4edf2e /dhcpcd.c
parent5ddec3d36cec965c32f544bee2bf6375459504b3 (diff)
downloaddhcpcd-ee8a3b3428999c2e01fb1dac4caefb42d0b32c9b.tar.xz
Print user defined options via -V
Diffstat (limited to 'dhcpcd.c')
-rw-r--r--dhcpcd.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/dhcpcd.c b/dhcpcd.c
index 294364cf..3ed932b1 100644
--- a/dhcpcd.c
+++ b/dhcpcd.c
@@ -1282,6 +1282,8 @@ main(int argc, char **argv)
ctx.ifv = argv + optind;
ifo = read_config(&ctx, NULL, NULL, NULL);
+ if (ifo == NULL)
+ goto exit_failure;
opt = add_options(&ctx, NULL, ifo, argc, argv);
if (opt != 1) {
if (opt == 0)
@@ -1290,17 +1292,26 @@ main(int argc, char **argv)
}
if (i == 3) {
printf("Interface options:\n");
+ if (optind == argc - 1) {
+ free_options(ifo);
+ ifo = read_config(&ctx, argv[optind], NULL, NULL);
+ if (ifo == NULL)
+ goto exit_failure;
+ add_options(&ctx, NULL, ifo, argc, argv);
+ }
if_printoptions();
#ifdef INET
if (family == 0 || family == AF_INET) {
printf("\nDHCPv4 options:\n");
- dhcp_printoptions(&ctx);
+ dhcp_printoptions(&ctx,
+ ifo->dhcp_override, ifo->dhcp_override_len);
}
#endif
#ifdef INET6
if (family == 0 || family == AF_INET6) {
printf("\nDHCPv6 options:\n");
- dhcp6_printoptions(&ctx);
+ dhcp6_printoptions(&ctx,
+ ifo->dhcp6_override, ifo->dhcp6_override_len);
}
#endif
goto exit_success;
@@ -1399,7 +1410,7 @@ main(int argc, char **argv)
ifp->ctx = &ctx;
TAILQ_INSERT_HEAD(ctx.ifaces, ifp, next);
}
- configure_interface(ifp, 0, NULL);
+ configure_interface(ifp, ctx.argc, ctx.argv);
if (family == 0 || family == AF_INET) {
if (dhcp_dump(ifp) == -1)
i = 1;