From: Roy Marples Date: Mon, 30 Jun 2008 16:15:29 +0000 (+0000) Subject: Allow userclass to be compiled out. X-Git-Tag: v4.0.2~258 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=79f58b5d886cef4a517845062d5ba1aaae9ef421;p=thirdparty%2Fdhcpcd.git Allow userclass to be compiled out. --- diff --git a/config.h b/config.h index eb4e90a2..68846f51 100644 --- 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 @@ -82,6 +85,11 @@ # 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 f5489c75..438395ea 100644 --- 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; diff --git a/dhcpcd.c b/dhcpcd.c index c3be5d09..40f4f5c0 100644 --- 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 diff --git a/dhcpcd.h b/dhcpcd.h index 8f2224af..ea0769b8 100644 --- 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