Skip to content

Commit d5700a4

Browse files
committed
options: Allow domain spaced options
Such as: nooption dhcp6_sol_max_rt, dhcp6_reconfigure_accept
1 parent 793289f commit d5700a4

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

src/dhcp-common.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,10 @@ make_option_mask(const struct dhcp_opt *dopts, size_t dopts_len,
200200
while ((token = strsep(&p, ", "))) {
201201
if (*token == '\0')
202202
continue;
203+
if (strncmp(token, "dhcp6_", 6) == 0)
204+
token += 6;
205+
if (strncmp(token, "nd6_", 4) == 0)
206+
token += 4;
203207
match = 0;
204208
for (i = 0, opt = odopts; i < odopts_len; i++, opt++) {
205209
if (opt->var == NULL || opt->option == 0)

src/if-options.c

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,7 @@ parse_addr(__unused struct in_addr *addr, __unused struct in_addr *net,
520520
}
521521
#endif
522522

523-
static const char *
523+
static void
524524
set_option_space(struct dhcpcd_ctx *ctx,
525525
const char *arg,
526526
const struct dhcp_opt **d, size_t *dl,
@@ -543,7 +543,7 @@ set_option_space(struct dhcpcd_ctx *ctx,
543543
*require = ifo->requiremasknd;
544544
*no = ifo->nomasknd;
545545
*reject = ifo->rejectmasknd;
546-
return arg + strlen("nd_");
546+
return;
547547
}
548548

549549
#ifdef DHCP6
@@ -556,7 +556,7 @@ set_option_space(struct dhcpcd_ctx *ctx,
556556
*require = ifo->requiremask6;
557557
*no = ifo->nomask6;
558558
*reject = ifo->rejectmask6;
559-
return arg + strlen("dhcp6_");
559+
return;
560560
}
561561
#endif
562562
#endif
@@ -576,7 +576,6 @@ set_option_space(struct dhcpcd_ctx *ctx,
576576
*require = ifo->requiremask;
577577
*no = ifo->nomask;
578578
*reject = ifo->rejectmask;
579-
return arg;
580579
}
581580

582581
void
@@ -806,7 +805,7 @@ parse_option(struct dhcpcd_ctx *ctx, const char *ifname, struct if_options *ifo,
806805
break;
807806
case 'o':
808807
ARG_REQUIRED;
809-
arg = set_option_space(ctx, arg, &d, &dl, &od, &odl, ifo,
808+
set_option_space(ctx, arg, &d, &dl, &od, &odl, ifo,
810809
&request, &require, &no, &reject);
811810
if (make_option_mask(d, dl, od, odl, request, arg, 1) != 0 ||
812811
make_option_mask(d, dl, od, odl, no, arg, -1) != 0 ||
@@ -818,7 +817,7 @@ parse_option(struct dhcpcd_ctx *ctx, const char *ifname, struct if_options *ifo,
818817
break;
819818
case O_REJECT:
820819
ARG_REQUIRED;
821-
arg = set_option_space(ctx, arg, &d, &dl, &od, &odl, ifo,
820+
set_option_space(ctx, arg, &d, &dl, &od, &odl, ifo,
822821
&request, &require, &no, &reject);
823822
if (make_option_mask(d, dl, od, odl, reject, arg, 1) != 0 ||
824823
make_option_mask(d, dl, od, odl, request, arg, -1) != 0 ||
@@ -1053,7 +1052,7 @@ parse_option(struct dhcpcd_ctx *ctx, const char *ifname, struct if_options *ifo,
10531052
break;
10541053
case 'O':
10551054
ARG_REQUIRED;
1056-
arg = set_option_space(ctx, arg, &d, &dl, &od, &odl, ifo,
1055+
set_option_space(ctx, arg, &d, &dl, &od, &odl, ifo,
10571056
&request, &require, &no, &reject);
10581057
if (make_option_mask(d, dl, od, odl, request, arg, -1) != 0 ||
10591058
make_option_mask(d, dl, od, odl, require, arg, -1) != 0 ||
@@ -1065,7 +1064,7 @@ parse_option(struct dhcpcd_ctx *ctx, const char *ifname, struct if_options *ifo,
10651064
break;
10661065
case 'Q':
10671066
ARG_REQUIRED;
1068-
arg = set_option_space(ctx, arg, &d, &dl, &od, &odl, ifo,
1067+
set_option_space(ctx, arg, &d, &dl, &od, &odl, ifo,
10691068
&request, &require, &no, &reject);
10701069
if (make_option_mask(d, dl, od, odl, require, arg, 1) != 0 ||
10711070
make_option_mask(d, dl, od, odl, request, arg, 1) != 0 ||
@@ -1253,7 +1252,7 @@ parse_option(struct dhcpcd_ctx *ctx, const char *ifname, struct if_options *ifo,
12531252
break;
12541253
case O_DESTINATION:
12551254
ARG_REQUIRED;
1256-
arg = set_option_space(ctx, arg, &d, &dl, &od, &odl, ifo,
1255+
set_option_space(ctx, arg, &d, &dl, &od, &odl, ifo,
12571256
&request, &require, &no, &reject);
12581257
if (make_option_mask(d, dl, od, odl,
12591258
ifo->dstmask, arg, 2) != 0)

0 commit comments

Comments
 (0)