mirror of
https://github.com/rsmarples/dhcpcd.git
synced 2024-12-03 06:53:53 +08:00
Allow ClassID to be configured.
This commit is contained in:
parent
413724d05e
commit
d65fd32df0
8
config.h
8
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
|
||||
|
2
dhcp.c
2
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) {
|
||||
|
7
dhcpcd.c
7
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
|
||||
|
Loading…
Reference in New Issue
Block a user