logopts |= LOGERR_ERR;
i = 0;
+
while ((opt = getopt_long(argc, argv,
ctx.options & DHCPCD_PRINT_PIDFILE ? NOERR_IF_OPTS : IF_OPTS,
cf_options, &oi)) != -1)
}
}
+ if (optind != argc - 1)
+ ctx.options |= DHCPCD_MASTER;
+
logsetopts(logopts);
logopen(ctx.logfile);
goto printpidfile;
goto exit_failure;
}
+
opt = add_options(&ctx, NULL, ifo, argc, argv);
if (opt != 1) {
if (ctx.options & DHCPCD_PRINT_PIDFILE)
goto exit_success;
}
ctx.options |= ifo->options;
+
if (i == 1 || i == 3) {
if (i == 1)
ctx.options |= DHCPCD_TEST;
{"noipv6", no_argument, NULL, O_NOIPV6},
{"noalias", no_argument, NULL, O_NOALIAS},
{"iaid", required_argument, NULL, O_IAID},
- {"ia_na", no_argument, NULL, O_IA_NA},
- {"ia_ta", no_argument, NULL, O_IA_TA},
- {"ia_pd", no_argument, NULL, O_IA_PD},
+ {"ia_na", optional_argument, NULL, O_IA_NA},
+ {"ia_ta", optional_argument, NULL, O_IA_TA},
+ {"ia_pd", optional_argument, NULL, O_IA_PD},
{"hostname_short", no_argument, NULL, O_HOSTNAME_SHORT},
{"dev", required_argument, NULL, O_DEV},
{"nodev", no_argument, NULL, O_NODEV},
#endif
case O_IAID:
ARG_REQUIRED;
- if (!IN_CONFIG_BLOCK(ifo)) {
+ if (ctx->options & DHCPCD_MASTER && !IN_CONFIG_BLOCK(ifo)) {
logerrx("IAID must belong in an interface block");
return -1;
}
logwarnx("%s: IA_PD not compiled in", ifname);
return -1;
#else
- if (!IN_CONFIG_BLOCK(ifo)) {
+ if (ctx->options & DHCPCD_MASTER &&
+ !IN_CONFIG_BLOCK(ifo))
+ {
logerrx("IA PD must belong in an "
"interface block");
return -1;
i = D6_OPTION_IA_PD;
#endif
}
- if (!IN_CONFIG_BLOCK(ifo) && arg) {
+ if (ctx->options & DHCPCD_MASTER &&
+ !IN_CONFIG_BLOCK(ifo) && arg)
+ {
logerrx("IA with IAID must belong in an "
"interface block");
return -1;