From: Roy Marples Date: Wed, 13 Aug 2008 20:26:41 +0000 (+0000) Subject: Allow reqmask of numbers. X-Git-Tag: v4.0.2~42 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c22ce5910d50c60031684fb3ef654d4c819c3858;p=thirdparty%2Fdhcpcd.git Allow reqmask of numbers. --- diff --git a/dhcp.c b/dhcp.c index b0e962bd..2f1a7dd9 100644 --- a/dhcp.c +++ b/dhcp.c @@ -168,9 +168,9 @@ print_options(void) int make_reqmask(uint8_t *mask, char **opts, int add) { - char *token; - char *p = *opts; + char *token, *p = *opts, *t; const struct dhcp_opt *opt; + int match, n; while ((token = strsep(&p, ", "))) { if (*token == '\0') @@ -178,7 +178,17 @@ int make_reqmask(uint8_t *mask, char **opts, int add) for (opt = dhcp_opts; opt->option; opt++) { if (!opt->var) continue; - if (strcmp(opt->var, token) == 0) { + match = 0; + if (strcmp(opt->var, token) == 0) + match = 1; + else { + errno = 0; + n = strtol(token, &t, 0); + if (errno == 0 && !*t) + if (opt->option == n) + match = 1; + } + if (match) { if (add == 1) add_reqmask(mask, opt->option);