]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Allow ClassID to be configured.
authorRoy Marples <roy@marples.name>
Mon, 30 Jun 2008 16:35:41 +0000 (16:35 +0000)
committerRoy Marples <roy@marples.name>
Mon, 30 Jun 2008 16:35:41 +0000 (16:35 +0000)
config.h
dhcp.c
dhcpcd.c
dhcpcd.h

index 39c0310d2e6df12c7f7db59988dd2a0ae80e3c5b..e6f6a9b0b1ff359adfabdcd7d689b117bd4bc433 100644 (file)
--- a/config.h
+++ b/config.h
@@ -39,6 +39,9 @@
 # ifndef DISABLE_ARP
 #  define DISABLE_ARP
 # endif
+# ifndef DISABLE_CLASSID
+#  define DISABLE_CLASSID
+# endif
 # ifndef DISABLE_CLIENTID
 #  define DISABLE_CLIENTID
 # endif
 # define ENABLE_ARP
 #endif
 
+/* Allow dhcpcd to send a ClassID */
+#ifndef DISABLE_CLASSID
+# define ENABLE_CLASSID
+#endif
+
 /* Send a ClientID in all messages. */
 #ifndef DISABLE_CLIENTID
 # define ENABLE_CLIENTID
diff --git a/dhcp.c b/dhcp.c
index 438395ea72208bfaa5d8264c11eef2374a09c8d8..3cb9cd23f128d64a3660307c977a76a34d52a96e 100644 (file)
--- a/dhcp.c
+++ b/dhcp.c
@@ -790,11 +790,13 @@ make_message(struct dhcp_message **message,
                }
 #endif
 
+#ifdef ENABLE_CLASSID
                if (options->classid[0]) {
                        *p++ = DHCP_CLASSID;
                        memcpy(p, options->classid, options->classid[0] + 1);
                        p += options->classid[0] + 1;
                }
+#endif
        }
 
        if (type == DHCP_DISCOVER || type == DHCP_REQUEST) {
index 76ab3dfcbef780efa103cb13e73ab75a355071c5..8bb84555564e424f455dddce3b3e5a90486d13fa 100644 (file)
--- a/dhcpcd.c
+++ b/dhcpcd.c
@@ -238,6 +238,7 @@ parse_option(int opt, char *oarg, struct options *options)
                                sizeof(options->hostname));
                break;
        case 'i':
+#ifdef ENABLE_CLASSID
                if (!oarg) {
                        *options->classid = '\0';
                } else if (olen >= CLASSID_MAX_LEN) {
@@ -250,6 +251,7 @@ parse_option(int opt, char *oarg, struct options *options)
                        strlcpy((char *)options->classid + 1, oarg,
                                sizeof(options->classid));
                }
+#endif
                break;
        case 'l':
                if (*oarg == '-') {
@@ -520,8 +522,10 @@ main(int argc, char **argv)
 
        options = xzalloc(sizeof(*options));
        strlcpy(options->script, SCRIPT, sizeof(options->script));
+#ifdef ENABLE_CLASSID
        options->classid[0] = snprintf((char *)options->classid + 1, CLASSID_MAX_LEN,
                                       "%s %s", PACKAGE, VERSION);
+#endif
 
        options->options |= DHCPCD_GATEWAY | DHCPCD_DAEMONISE;
 #ifdef ENABLE_ARP
@@ -596,6 +600,9 @@ main(int argc, char **argv)
 #ifdef ENABLE_ARP
                       " ARP"
 #endif
+#ifdef ENABLE_CLASSID
+                      " CLASSID"
+#endif
 #ifdef ENABLE_CLIENTID
                       " CLIENTID"
 #endif
index 5b72eae999bdb4a241729a05d4459c9e6847a033..21ddf699d38e40ddc4a694ab6525cc791dfb94f2 100644 (file)
--- a/dhcpcd.h
+++ b/dhcpcd.h
@@ -73,7 +73,9 @@ struct options {
        char interface[IF_NAMESIZE];
        char hostname[MAXHOSTNAMELEN];
        int fqdn;
+#ifdef ENABLE_CLASSID
        uint8_t classid[CLASSID_MAX_LEN + 1];
+#endif
 #ifdef ENABLE_CLIENTID
        char clientid[CLIENTID_MAX_LEN + 1];
 #endif