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

index eb4e90a24b4e46c3fefce3dbfcaf52a5a160de45..68846f513b85bc8f70b5da94a687e31dbdd741c6 100644 (file)
--- a/config.h
+++ b/config.h
@@ -45,6 +45,9 @@
 # ifndef DISABLE_DUID
 #  define DISABLE_DUID
 # endif
+# ifndef DISABLE_USERCLASS
+#  define DISABLE_USERCLASS
+# endif
 # ifndef DISABLE_VENDOR
 #  define DISABLE_VENDOR
 # endif
 # define ENABLE_DUID
 #endif
 
+/* Allow dhcpcd to send user class options. */
+#ifndef DISABLE_USERCLASS
+# define ENABLE_USERCLASS
+#endif
+
 /* Allow dhcpcd to send encapsulated vendor options (code 43).
  * Although this is enabled by default, only custom networks would really
  * need it. */
diff --git a/dhcp.c b/dhcp.c
index f5489c75f90e53d91aa46329f1436c110687a8a9..438395ea72208bfaa5d8264c11eef2374a09c8d8 100644 (file)
--- a/dhcp.c
+++ b/dhcp.c
@@ -782,11 +782,13 @@ make_message(struct dhcp_message **message,
        }
 
        if (type != DHCP_DECLINE && type != DHCP_RELEASE) {
+#ifdef ENABLE_USERCLASS
                if (options->userclass[0]) {
                        *p++ = DHCP_USERCLASS;
                        memcpy(p, options->userclass, options->userclass[0] + 1);
                        p += options->userclass[0] + 1;
                }
+#endif
 
                if (options->classid[0]) {
                        *p++ = DHCP_CLASSID;
index c3be5d09161d7f8ce9fe1b9fc51dffa60644ad4d..40f4f5c0c76733bccf415d16bf96007010668451 100644 (file)
--- a/dhcpcd.c
+++ b/dhcpcd.c
@@ -320,6 +320,7 @@ parse_option(int opt, char *oarg, struct options *options)
                }
                break;
        case 'u':
+#ifdef ENABLE_USERCLASS
                if (options->userclass[0] + olen + 1 >= USERCLASS_MAX_LEN) {
                        logger(LOG_ERR,
                               "userclass overrun, max is %d",
@@ -330,6 +331,7 @@ parse_option(int opt, char *oarg, struct options *options)
                *u++ = olen;
                memcpy(u, oarg, olen);
                options->userclass[0] += olen + 1;
+#endif
                break;
        case 'v':
 #ifdef ENABLE_VENDOR
index 8f2224af28bb11727aa60cebb0682ff8c2d9ef5a..ea0769b82caadccba55bf221df3bb4e4246e2814 100644 (file)
--- a/dhcpcd.h
+++ b/dhcpcd.h
@@ -75,7 +75,9 @@ struct options {
        int fqdn;
        uint8_t classid[CLASSID_MAX_LEN + 1];
        char clientid[CLIENTID_MAX_LEN + 1];
+#ifdef ENABLE_USERCLASS
        uint8_t userclass[USERCLASS_MAX_LEN + 1];
+#endif
 #ifdef ENABLE_VENDOR
        uint8_t vendor[VENDOR_MAX_LEN + 1];
 #endif