From: Roy Marples Date: Wed, 13 Aug 2008 21:29:30 +0000 (+0000) Subject: classid -> vendorclassid to match the RFC description. X-Git-Tag: v4.0.2~41 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7b1ae6d97bfd6191bba5108ff6b2dea8237b9cbb;p=thirdparty%2Fdhcpcd.git classid -> vendorclassid to match the RFC description. --- diff --git a/dhcp.c b/dhcp.c index 2f1a7dd9..460d7c5f 100644 --- a/dhcp.c +++ b/dhcp.c @@ -828,10 +828,11 @@ make_message(struct dhcp_message **message, p += options->userclass[0] + 1; } - if (options->classid[0]) { - *p++ = DHO_CLASSID; - memcpy(p, options->classid, options->classid[0] + 1); - p += options->classid[0] + 1; + if (options->vendorclassid[0]) { + *p++ = DHO_VENDORCLASSID; + memcpy(p, options->vendorclassid, + options->vendorclassid[0] + 1); + p += options->vendorclassid[0] + 1; } } diff --git a/dhcp.h b/dhcp.h index 2e14818a..f135f649 100644 --- a/dhcp.h +++ b/dhcp.h @@ -87,7 +87,7 @@ enum DHO DHO_MAXMESSAGESIZE = 57, DHO_RENEWALTIME = 58, DHO_REBINDTIME = 59, - DHO_CLASSID = 60, + DHO_VENDORCLASSID = 60, DHO_CLIENTID = 61, DHO_USERCLASS = 77, /* RFC 3004 */ DHO_FQDN = 81, diff --git a/dhcpcd.8.in b/dhcpcd.8.in index 67724a29..90586310 100644 --- a/dhcpcd.8.in +++ b/dhcpcd.8.in @@ -22,7 +22,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd August 12, 2008 +.Dd August 13, 2008 .Dt DHCPCD 8 SMM .Sh NAME .Nm dhcpcd @@ -33,7 +33,7 @@ .Op Fl c , -script Ar script .Op Fl f , -config Ar file .Op Fl h , -hostname Ar hostname -.Op Fl i , -classid Ar classid +.Op Fl i , -vendorclassid Ar vendorclassid .Op Fl l , -leasetime Ar seconds .Op Fl m , -metric Ar metric .Op Fl o , -option Ar option @@ -154,9 +154,9 @@ sent, or an empty string to stop any .Ar hostname from being sent. -.It Fl i , -classid Ar classid +.It Fl i , -vendorclassid Ar vendorclassid Override the -.Ar classid +.Ar vendorclassid field sent. The default is dhcpcd . If not set then none is sent. diff --git a/dhcpcd.c b/dhcpcd.c index 4336f84b..c559ce58 100644 --- a/dhcpcd.c +++ b/dhcpcd.c @@ -58,48 +58,49 @@ const char copyright[] = "Copyright (c) 2006-2008 Roy Marples"; static int doversion = 0; static int dohelp = 0; static const struct option longopts[] = { - {"background", no_argument, NULL, 'b'}, - {"script", required_argument, NULL, 'c'}, - {"debug", no_argument, NULL, 'd'}, - {"config", required_argument, NULL, 'f'}, - {"hostname", optional_argument, NULL, 'h'}, - {"classid", optional_argument, NULL, 'i'}, - {"release", no_argument, NULL, 'k'}, - {"leasetime", required_argument, NULL, 'l'}, - {"metric", required_argument, NULL, 'm'}, - {"renew", no_argument, NULL, 'n'}, - {"option", required_argument, NULL, 'o'}, - {"persistent", no_argument, NULL, 'p'}, - {"quiet", no_argument, NULL, 'q'}, - {"request", optional_argument, NULL, 'r'}, - {"inform", optional_argument, NULL, 's'}, - {"timeout", required_argument, NULL, 't'}, - {"userclass", required_argument, NULL, 'u'}, - {"vendor", required_argument, NULL, 'v'}, - {"exit", no_argument, NULL, 'x'}, - {"noarp", no_argument, NULL, 'A'}, - {"nobackground",no_argument, NULL, 'B'}, - {"nohook", required_argument, NULL, 'C'}, - {"duid", no_argument, NULL, 'D'}, - {"lastlease", no_argument, NULL, 'E'}, - {"fqdn", optional_argument, NULL, 'F'}, - {"nogateway", no_argument, NULL, 'G'}, - {"clientid", optional_argument, NULL, 'I'}, - {"nolink", no_argument, NULL, 'K'}, - {"noipv4ll", no_argument, NULL, 'L'}, - {"nooption", optional_argument, NULL, 'O'}, - {"test", no_argument, NULL, 'T'}, - {"variables", no_argument, NULL, 'V'}, - {"blacklist", required_argument, NULL, 'X'}, - {"help", no_argument, &dohelp, 1}, - {"version", no_argument, &doversion, 1}, + {"background", no_argument, NULL, 'b'}, + {"script", required_argument, NULL, 'c'}, + {"debug", no_argument, NULL, 'd'}, + {"config", required_argument, NULL, 'f'}, + {"hostname", optional_argument, NULL, 'h'}, + {"vendorclassid", optional_argument, NULL, 'i'}, + {"release", no_argument, NULL, 'k'}, + {"leasetime", required_argument, NULL, 'l'}, + {"metric", required_argument, NULL, 'm'}, + {"renew", no_argument, NULL, 'n'}, + {"option", required_argument, NULL, 'o'}, + {"persistent", no_argument, NULL, 'p'}, + {"quiet", no_argument, NULL, 'q'}, + {"request", optional_argument, NULL, 'r'}, + {"inform", optional_argument, NULL, 's'}, + {"timeout", required_argument, NULL, 't'}, + {"userclass", required_argument, NULL, 'u'}, + {"vendor", required_argument, NULL, 'v'}, + {"exit", no_argument, NULL, 'x'}, + {"noarp", no_argument, NULL, 'A'}, + {"nobackground", no_argument, NULL, 'B'}, + {"nohook", required_argument, NULL, 'C'}, + {"duid", no_argument, NULL, 'D'}, + {"lastlease", no_argument, NULL, 'E'}, + {"fqdn", optional_argument, NULL, 'F'}, + {"nogateway", no_argument, NULL, 'G'}, + {"clientid", optional_argument, NULL, 'I'}, + {"nolink", no_argument, NULL, 'K'}, + {"noipv4ll", no_argument, NULL, 'L'}, + {"nooption", optional_argument, NULL, 'O'}, + {"test", no_argument, NULL, 'T'}, + {"variables", no_argument, NULL, 'V'}, + {"blacklist", required_argument, NULL, 'X'}, + {"help", no_argument, &dohelp, 1}, + {"version", no_argument, &doversion, 1}, #ifdef CMDLINE_COMPAT - {"nohostname", no_argument, NULL, 'H'}, - {"nomtu", no_argument, NULL, 'M'}, - {"nontp", no_argument, NULL, 'N'}, - {"nodns", no_argument, NULL, 'R'}, - {"msscr", no_argument, NULL, 'S'}, - {"nonis", no_argument, NULL, 'Y'}, + {"classid", optional_argument, NULL, 'i'}, + {"nohostname", no_argument, NULL, 'H'}, + {"nomtu", no_argument, NULL, 'M'}, + {"nontp", no_argument, NULL, 'N'}, + {"nodns", no_argument, NULL, 'R'}, + {"msscr", no_argument, NULL, 'S'}, + {"nonis", no_argument, NULL, 'Y'}, #endif {NULL, 0, NULL, '\0'} }; @@ -329,15 +330,15 @@ parse_option(int opt, char *oarg, struct options *options) break; case 'i': if (oarg) - s = parse_string((char *)options->classid + 1, - CLASSID_MAX_LEN, oarg); + s = parse_string((char *)options->vendorclassid + 1, + VENDORCLASSID_MAX_LEN, oarg); else s = 0; if (s == -1) { - logger(LOG_ERR, "classid: %s", strerror(errno)); + logger(LOG_ERR, "vendorclassid: %s", strerror(errno)); return -1; } - *options->classid = (uint8_t)s; + *options->vendorclassid = (uint8_t)s; break; case 'l': if (*oarg == '-') { @@ -507,7 +508,7 @@ parse_option(int opt, char *oarg, struct options *options) break; case 'I': /* Strings have a type of 0 */; - options->classid[1] = 0; + options->clientid[1] = 0; if (oarg) s = parse_string_hwaddr((char *)options->clientid + 1, CLIENTID_MAX_LEN, oarg, 1); @@ -611,8 +612,9 @@ main(int argc, char **argv) options->timeout = DEFAULT_TIMEOUT; strlcpy(options->script, SCRIPT, sizeof(options->script)); - options->classid[0] = snprintf((char *)options->classid + 1, CLASSID_MAX_LEN, - "%s %s", PACKAGE, VERSION); + options->vendorclassid[0] = snprintf((char *)options->vendorclassid + 1, + VENDORCLASSID_MAX_LEN, + "%s %s", PACKAGE, VERSION); #ifdef CMDLINE_COMPAT add_reqmask(options->reqmask, DHCP_DNSSERVER); diff --git a/dhcpcd.conf.5.in b/dhcpcd.conf.5.in index 84bb9be0..c7fa68a6 100644 --- a/dhcpcd.conf.5.in +++ b/dhcpcd.conf.5.in @@ -22,7 +22,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd August 7, 2008 +.Dd August 13, 2008 .Dt DHCPCD.CONF 5 SMM .Sh NAME .Nm dhcpcd.conf @@ -43,8 +43,8 @@ Blank lines and lines starting with # are ignored. .Pp Here's a list of available options: .Bl -tag -width indent -.It Ic classid Ar string -Change the default classid sent from dhcpcd-version. +.It Ic vendorclassid Ar string +Change the default vendorclassid sent from dhcpcd-version. If not set then none is sent. .It Ic clientid Ar string Change the default clientid sent from the interface hardware address. diff --git a/dhcpcd.h b/dhcpcd.h index 07ceee6e..dc7cff41 100644 --- a/dhcpcd.h +++ b/dhcpcd.h @@ -42,7 +42,7 @@ #define DEFAULT_LEASETIME 3600 /* 1 hour */ #define HOSTNAME_MAX_LEN 250 /* 255 - 3 (FQDN) - 2 (DNS enc) */ -#define CLASSID_MAX_LEN 48 +#define VENDORCLASSID_MAX_LEN 48 #define CLIENTID_MAX_LEN 48 #define USERCLASS_MAX_LEN 255 #define VENDOR_MAX_LEN 255 @@ -83,7 +83,7 @@ struct options { char hostname[HOSTNAME_MAX_LEN + 1]; int fqdn; - uint8_t classid[CLASSID_MAX_LEN + 1]; + uint8_t vendorclassid[VENDORCLASSID_MAX_LEN + 1]; char clientid[CLIENTID_MAX_LEN + 1]; uint8_t userclass[USERCLASS_MAX_LEN + 1]; uint8_t vendor[VENDOR_MAX_LEN + 1];