From: Roy Marples Date: Mon, 30 Jun 2008 16:35:41 +0000 (+0000) Subject: Allow ClassID to be configured. X-Git-Tag: v4.0.2~256 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d65fd32df0506c849262e1e63611c134db267745;p=thirdparty%2Fdhcpcd.git Allow ClassID to be configured. --- diff --git a/config.h b/config.h index 39c0310d..e6f6a9b0 100644 --- 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 @@ -61,6 +64,11 @@ # 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 438395ea..3cb9cd23 100644 --- 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) { diff --git a/dhcpcd.c b/dhcpcd.c index 76ab3dfc..8bb84555 100644 --- 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 diff --git a/dhcpcd.h b/dhcpcd.h index 5b72eae9..21ddf699 100644 --- 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