]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Allow reqmask of numbers.
authorRoy Marples <roy@marples.name>
Wed, 13 Aug 2008 20:26:41 +0000 (20:26 +0000)
committerRoy Marples <roy@marples.name>
Wed, 13 Aug 2008 20:26:41 +0000 (20:26 +0000)
dhcp.c

diff --git a/dhcp.c b/dhcp.c
index b0e962bd7ddbbf050951bd454e59412723d9297c..2f1a7dd9c8e1935f8f0b3ce0cd4ee3547bc9862f 100644 (file)
--- 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);