summaryrefslogtreecommitdiffstats
path: root/dhcp.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2008-08-13 20:26:41 +0000
committerRoy Marples <roy@marples.name>2008-08-13 20:26:41 +0000
commitc22ce5910d50c60031684fb3ef654d4c819c3858 (patch)
tree0cae8e932d2fa3ca571f41ecafa5fda3bd7419db /dhcp.c
parent4cec793b2485516c1bd8f6405c08166e7ac73a67 (diff)
downloaddhcpcd-c22ce5910d50c60031684fb3ef654d4c819c3858.tar.xz
Allow reqmask of numbers.
Diffstat (limited to 'dhcp.c')
-rw-r--r--dhcp.c16
1 files changed, 13 insertions, 3 deletions
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);