]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Some option only make sense in the configuration file, so remove short
authorRoy Marples <roy@marples.name>
Wed, 15 Apr 2009 09:15:53 +0000 (09:15 +0000)
committerRoy Marples <roy@marples.name>
Wed, 15 Apr 2009 09:15:53 +0000 (09:15 +0000)
options for them for future reuse.

if-options.c
if-options.h

index c10240cccdbca13f14d04c2c2380be75f84e0645..def471c727e79d7e53aeb76241ec3dbe7cb30849 100644 (file)
 #include "if-options.h"
 #include "net.h"
 
+/* These options only make sense in the config file, so don't use any
+   valid short options for them */
+#define O_BASE         MAX('z', 'Z') + 1
+#define O_ALOWIF       O_BASE + 1
+#define O_DENYIF       O_BASE + 2
+#define O_ARPING       O_BASE + 3
+
 const struct option cf_options[] = {
-       {"arping",          required_argument, NULL, 'a'},
        {"background",      no_argument,       NULL, 'b'},
        {"script",          required_argument, NULL, 'c'},
        {"debug",           no_argument,       NULL, 'd'},
@@ -68,7 +74,6 @@ const struct option cf_options[] = {
        {"vendor",          required_argument, NULL, 'v'},
        {"exit",            no_argument,       NULL, 'x'},
        {"reboot",          required_argument, NULL, 'y'},
-       {"allowinterfaces", required_argument, NULL, 'z'},
        {"noarp",           no_argument,       NULL, 'A'},
        {"nobackground",    no_argument,       NULL, 'B'},
        {"nohook",          required_argument, NULL, 'C'},
@@ -86,7 +91,9 @@ const struct option cf_options[] = {
        {"test",            no_argument,       NULL, 'T'},
        {"variables",       no_argument,       NULL, 'V'},
        {"blacklist",       required_argument, NULL, 'X'},
-       {"denyinterfaces",  required_argument, NULL, 'Z'},
+       {"allowinterfaces", required_argument, NULL, O_ALOWIF},
+       {"denyinterfaces",  required_argument, NULL, O_DENYIF},
+       {"arping",          required_argument, NULL, O_ARPING},
        {NULL,              0,                 NULL, '\0'}
 };
 
@@ -266,7 +273,6 @@ splitv(int *argc, char **argv, const char *arg)
        return v;       
 }
 
-
 static int
 parse_addr(struct in_addr *addr, struct in_addr *net, const char *arg)
 {
@@ -312,13 +318,6 @@ parse_option(struct if_options *ifo, int opt, const char *arg)
        struct rt *rt;
 
        switch(opt) {
-       case 'a':
-               if (parse_addr(&addr, NULL, arg) != 0)
-                       return -1;
-               ifo->arping = xrealloc(ifo->arping,
-                   sizeof(in_addr_t) * (ifo->arping_len + 1));
-               ifo->arping[ifo->arping_len++] = addr.s_addr;
-               break;
        case 'e': /* FALLTHROUGH */
        case 'n': /* FALLTHROUGH */
        case 'x': /* FALLTHROUGH */
@@ -482,11 +481,6 @@ parse_option(struct if_options *ifo, int opt, const char *arg)
                        return -1;
                }
                break;
-       case 'z':
-               /* We only set this if we haven't got any interfaces */
-               if (!ifaces)
-                       ifav = splitv(&ifac, ifav, arg);
-               break;
        case 'A':
                ifo->options &= ~DHCPCD_ARP;
                /* IPv4LL requires ARP */
@@ -664,7 +658,19 @@ parse_option(struct if_options *ifo, int opt, const char *arg)
                ifo->blacklist[ifo->blacklist_len++] = addr.s_addr;
                ifo->blacklist[ifo->blacklist_len++] = addr2.s_addr;
                break;
-       case 'Z':
+       case O_ARPING:
+               if (parse_addr(&addr, NULL, arg) != 0)
+                       return -1;
+               ifo->arping = xrealloc(ifo->arping,
+                   sizeof(in_addr_t) * (ifo->arping_len + 1));
+               ifo->arping[ifo->arping_len++] = addr.s_addr;
+               break;
+       case O_ALOWIF:
+               /* We only set this if we haven't got any interfaces */
+               if (!ifaces)
+                       ifav = splitv(&ifac, ifav, arg);
+               break;
+       case O_DENYIF:
                /* We only set this if we haven't got any interfaces */
                if (!ifaces)
                        ifdv = splitv(&ifdc, ifdv, arg);
index 7fad0e5dc7d3e020e94e8b1c162bfb34b5237760..4b64e29885602fd46be76b167bd088831c667e90 100644 (file)
@@ -37,7 +37,7 @@
 
 /* Don't set any optional arguments here so we retain POSIX
  * compatibility with getopt */
-#define IF_OPTS "a:bc:def:h:i:kl:m:no:pqr:s:t:u:v:xy:z:ABC:DEF:GI:KLN:O:Q:TVX:Z:"
+#define IF_OPTS "bc:def:h:i:kl:m:no:pqr:s:t:u:v:xy:ABC:DEF:GI:KLN:O:Q:TVX:"
 
 #define DEFAULT_TIMEOUT                30
 #define DEFAULT_REBOOT         10
@@ -91,7 +91,7 @@ struct if_options {
        char **environ;
        char script[PATH_MAX];
        
-       char hostname[HOSTNAME_MAX_LEN + 1]; /* We don't store the lenth */
+       char hostname[HOSTNAME_MAX_LEN + 1]; /* We don't store the length */
        int fqdn;
        uint8_t vendorclassid[VENDORCLASSID_MAX_LEN + 2];
        char clientid[CLIENTID_MAX_LEN + 2];