diff options
| author | Roy Marples <roy@marples.name> | 2008-08-13 20:26:41 +0000 |
|---|---|---|
| committer | Roy Marples <roy@marples.name> | 2008-08-13 20:26:41 +0000 |
| commit | c22ce5910d50c60031684fb3ef654d4c819c3858 (patch) | |
| tree | 0cae8e932d2fa3ca571f41ecafa5fda3bd7419db /dhcp.c | |
| parent | 4cec793b2485516c1bd8f6405c08166e7ac73a67 (diff) | |
| download | dhcpcd-c22ce5910d50c60031684fb3ef654d4c819c3858.tar.xz | |
Allow reqmask of numbers.
Diffstat (limited to 'dhcp.c')
| -rw-r--r-- | dhcp.c | 16 |
1 files changed, 13 insertions, 3 deletions
@@ -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); |
