]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
options: Allow domain spaced options
authorRoy Marples <roy@marples.name>
Thu, 19 Sep 2019 19:44:44 +0000 (20:44 +0100)
committerRoy Marples <roy@marples.name>
Thu, 19 Sep 2019 19:44:44 +0000 (20:44 +0100)
Such as:
nooption dhcp6_sol_max_rt, dhcp6_reconfigure_accept

src/dhcp-common.c
src/if-options.c

index dab20a2e92a2db0578bb08282643889b040ef130..e26ddd021c74aa9dd462c6bbc09580c77552a5a7 100644 (file)
@@ -200,6 +200,10 @@ make_option_mask(const struct dhcp_opt *dopts, size_t dopts_len,
        while ((token = strsep(&p, ", "))) {
                if (*token == '\0')
                        continue;
+               if (strncmp(token, "dhcp6_", 6) == 0)
+                       token += 6;
+               if (strncmp(token, "nd6_", 4) == 0)
+                       token += 4;
                match = 0;
                for (i = 0, opt = odopts; i < odopts_len; i++, opt++) {
                        if (opt->var == NULL || opt->option == 0)
index f0165c13b7ca47741ff713e13c05e196eef2cb4d..f3f12316a2b3f0cf64c68848439f94c8ebbc0306 100644 (file)
@@ -520,7 +520,7 @@ parse_addr(__unused struct in_addr *addr, __unused struct in_addr *net,
 }
 #endif
 
-static const char *
+static void
 set_option_space(struct dhcpcd_ctx *ctx,
     const char *arg,
     const struct dhcp_opt **d, size_t *dl,
@@ -543,7 +543,7 @@ set_option_space(struct dhcpcd_ctx *ctx,
                *require = ifo->requiremasknd;
                *no = ifo->nomasknd;
                *reject = ifo->rejectmasknd;
-               return arg + strlen("nd_");
+               return;
        }
 
 #ifdef DHCP6
@@ -556,7 +556,7 @@ set_option_space(struct dhcpcd_ctx *ctx,
                *require = ifo->requiremask6;
                *no = ifo->nomask6;
                *reject = ifo->rejectmask6;
-               return arg + strlen("dhcp6_");
+               return;
        }
 #endif
 #endif
@@ -576,7 +576,6 @@ set_option_space(struct dhcpcd_ctx *ctx,
        *require = ifo->requiremask;
        *no = ifo->nomask;
        *reject = ifo->rejectmask;
-       return arg;
 }
 
 void
@@ -806,7 +805,7 @@ parse_option(struct dhcpcd_ctx *ctx, const char *ifname, struct if_options *ifo,
                break;
        case 'o':
                ARG_REQUIRED;
-               arg = set_option_space(ctx, arg, &d, &dl, &od, &odl, ifo,
+               set_option_space(ctx, arg, &d, &dl, &od, &odl, ifo,
                    &request, &require, &no, &reject);
                if (make_option_mask(d, dl, od, odl, request, arg, 1) != 0 ||
                    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,
                break;
        case O_REJECT:
                ARG_REQUIRED;
-               arg = set_option_space(ctx, arg, &d, &dl, &od, &odl, ifo,
+               set_option_space(ctx, arg, &d, &dl, &od, &odl, ifo,
                    &request, &require, &no, &reject);
                if (make_option_mask(d, dl, od, odl, reject, arg, 1) != 0 ||
                    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,
                break;
        case 'O':
                ARG_REQUIRED;
-               arg = set_option_space(ctx, arg, &d, &dl, &od, &odl, ifo,
+               set_option_space(ctx, arg, &d, &dl, &od, &odl, ifo,
                    &request, &require, &no, &reject);
                if (make_option_mask(d, dl, od, odl, request, arg, -1) != 0 ||
                    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,
                break;
        case 'Q':
                ARG_REQUIRED;
-               arg = set_option_space(ctx, arg, &d, &dl, &od, &odl, ifo,
+               set_option_space(ctx, arg, &d, &dl, &od, &odl, ifo,
                    &request, &require, &no, &reject);
                if (make_option_mask(d, dl, od, odl, require, arg, 1) != 0 ||
                    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,
                break;
        case O_DESTINATION:
                ARG_REQUIRED;
-               arg = set_option_space(ctx, arg, &d, &dl, &od, &odl, ifo,
+               set_option_space(ctx, arg, &d, &dl, &od, &odl, ifo,
                    &request, &require, &no, &reject);
                if (make_option_mask(d, dl, od, odl,
                    ifo->dstmask, arg, 2) != 0)