void
dhcp6_printoptions(void)
{
+ size_t i;
const struct dhcp_opt *opt;
- for (opt = dhcp6_opts; opt->option; opt++)
- if (opt->v.var)
- printf("%05d %s\n", opt->option, opt->v.var);
+ for (i = 0, opt = dhcp6_opts; i < dhcp6_opts_len; i++, opt++)
+ printf("%05d %s\n", opt->option, opt->v.var);
}
static int
len = 0;
si = NULL;
if (state->state != DH6S_RELEASE) {
- for (opt = dhcp6_opts; opt->option; opt++) {
+ for (l = 0, opt = dhcp6_opts; l < dhcp6_opts_len ; l++, opt++) {
if (!(opt->type & NOREQ) &&
(opt->type & REQUEST ||
has_option_mask(ifo->requestmask6, opt->option)))
o->code = htons(D6_OPTION_ORO);
o->len = 0;
u16 = (uint16_t *)(void *)D6_OPTION_DATA(o);
- for (opt = dhcp6_opts; opt->option; opt++) {
+ for (l = 0, opt = dhcp6_opts;
+ l < dhcp6_opts_len;
+ l++, opt++)
+ {
if (!(opt->type & NOREQ) &&
(opt->type & REQUEST ||
has_option_mask(ifo->requestmask6,
dhcp6_handledata(__unused void *arg)
{
ssize_t len;
+ size_t i;
struct cmsghdr *cm;
struct in6_pktinfo pkt;
struct interface *ifp;
}
ifo = ifp->options;
- for (opt = dhcp6_opts; opt->option; opt++) {
+ for (i = 0, opt = dhcp6_opts; i < dhcp6_opts_len; i++, opt++) {
if (has_option_mask(ifo->requiremask6, opt->option) &&
dhcp6_getmoption(opt->option, r, len) == NULL)
{
i = 2;
break;
case 'V':
- printf("Interface options:\n");
- if_printoptions();
-#ifdef INET
- if (family == 0 || family == AF_INET) {
- printf("\nDHCPv4 options:\n");
- dhcp_printoptions();
- }
-#endif
-#ifdef INET6
- if (family == 0 || family == AF_INET6) {
- printf("\nDHCPv6 options:\n");
- dhcp6_printoptions();
- }
-#endif
- exit(EXIT_SUCCESS);
+ i = 3;
+ break;
case '?':
usage();
exit(EXIT_FAILURE);
usage();
exit(EXIT_FAILURE);
}
+ if (i == 3) {
+ printf("Interface options:\n");
+ if_printoptions();
+#ifdef INET
+ if (family == 0 || family == AF_INET) {
+ printf("\nDHCPv4 options:\n");
+ dhcp_printoptions();
+ }
+#endif
+#ifdef INET6
+ if (family == 0 || family == AF_INET6) {
+ printf("\nDHCPv6 options:\n");
+ dhcp6_printoptions();
+ }
+#endif
+#ifdef DEBUG_MEMORY
+ cleanup();
+#endif
+ exit(EXIT_SUCCESS);
+ }
options = if_options->options;
if (i != 0) {
if (i == 1)
case 'n': /* FALLTHROUGH */
case 'x': /* FALLTHROUGH */
case 'T': /* FALLTHROUGH */
- case 'U': /* We need to handle non interface options */
+ case 'U': /* FALLTHROUGH */
+ case 'V': /* We need to handle non interface options */
break;
case 'b':
ifo->options |= DHCPCD_BACKGROUND;