diff options
-rw-r--r-- | sbin/dhclient/clparse.c | 20 | ||||
-rw-r--r-- | sbin/dhclient/dhclient.conf.5 | 18 | ||||
-rw-r--r-- | sbin/dhclient/dhcpd.h | 22 |
3 files changed, 36 insertions, 24 deletions
diff --git a/sbin/dhclient/clparse.c b/sbin/dhclient/clparse.c index f20c2c354b3..66d8c6e3b7e 100644 --- a/sbin/dhclient/clparse.c +++ b/sbin/dhclient/clparse.c @@ -1,4 +1,4 @@ -/* $OpenBSD: clparse.c,v 1.167 2018/02/06 00:25:09 krw Exp $ */ +/* $OpenBSD: clparse.c,v 1.168 2018/02/10 23:25:15 krw Exp $ */ /* Parser for dhclient config and lease files. */ @@ -272,9 +272,18 @@ parse_conf_decl(FILE *cfile, char *name) parse_semi(cfile); break; case TOK_IGNORE: + memset(list, 0, sizeof(list)); + count = 0; if (parse_option_list(cfile, &count, list) == 1) { - for (i = 0; i < count; i++) - config->default_actions[list[i]] = ACTION_IGNORE; + enum actions *p = config->default_actions; + if (count == 0) { + for (i = 0; i < DHO_COUNT; i++) + if (p[i] == ACTION_IGNORE) + p[i] = ACTION_NONE; + } else { + for (i = 0; i < count; i++) + p[list[i]] = ACTION_IGNORE; + } parse_semi(cfile); } break; @@ -434,8 +443,9 @@ parse_option_list(FILE *cfile, int *count, uint8_t *optlist) return 1; } - memset(list, DHO_PAD, sizeof(list)); - ix = 0; + memset(list, 0, sizeof(list)); + memcpy(list, optlist, *count); + ix = *count; do { /* Next token must be an option name. */ token = next_token(&val, cfile); diff --git a/sbin/dhclient/dhclient.conf.5 b/sbin/dhclient/dhclient.conf.5 index c6666f8f3fa..51a6de20589 100644 --- a/sbin/dhclient/dhclient.conf.5 +++ b/sbin/dhclient/dhclient.conf.5 @@ -1,4 +1,4 @@ -.\" $OpenBSD: dhclient.conf.5,v 1.40 2018/02/06 00:25:09 krw Exp $ +.\" $OpenBSD: dhclient.conf.5,v 1.41 2018/02/10 23:25:15 krw Exp $ .\" .\" Copyright (c) 1997 The Internet Software Consortium. .\" All rights reserved. @@ -36,7 +36,7 @@ .\" see ``http://www.isc.org/isc''. To learn more about Vixie .\" Enterprises, see ``http://www.vix.com''. .\" -.Dd $Mdocdate: February 6 2018 $ +.Dd $Mdocdate: February 10 2018 $ .Dt DHCLIENT.CONF 5 .Os .Sh NAME @@ -130,9 +130,9 @@ for .Ar option . .It Ic ignore Op Ar option , ... ; Discard values provided for the listed options. -Each .Ic ignore -overrides any previous one. +statements are cumulative, except that an empty +list will remove all previously specified options. .It Ic prepend Ar option option-value ; Prepend .Ar option-value @@ -154,9 +154,9 @@ for .It Ic request Op Ar option , ... ; Ask that any lease contain values for the listed options. -Each .Ic request -overrides any previous one. +statements are cumulative, except that an empty +list will remove all previously specified options. The default is to request the options bootfile-name broadcast-address, @@ -209,10 +209,10 @@ If more than one is present all leases from any of the addresses will be discarded. .It Ic require Op Ar option , ... ; -Discard leases that do not contain all the listed options. -Each +Discard leases that do not contain the listed options. .Ic require -overrides any previous one. +statements are cumulative, except that an empty +list will remove all previously specified options. .El .Sh SEE ALSO .Xr dhclient.leases 5 , diff --git a/sbin/dhclient/dhcpd.h b/sbin/dhclient/dhcpd.h index 8ea19c15124..92336535a85 100644 --- a/sbin/dhclient/dhcpd.h +++ b/sbin/dhclient/dhcpd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: dhcpd.h,v 1.252 2018/02/07 01:03:10 krw Exp $ */ +/* $OpenBSD: dhcpd.h,v 1.253 2018/02/10 23:25:15 krw Exp $ */ /* * Copyright (c) 2004 Henning Brauer <henning@openbsd.org> @@ -78,18 +78,20 @@ enum dhcp_state { S_RENEWING }; +enum actions { + ACTION_NONE, + ACTION_DEFAULT, + ACTION_SUPERSEDE, + ACTION_PREPEND, + ACTION_APPEND, + ACTION_IGNORE +}; + TAILQ_HEAD(client_lease_tq, client_lease); struct client_config { - struct option_data defaults[DHO_COUNT]; - enum { - ACTION_DEFAULT, - ACTION_SUPERSEDE, - ACTION_PREPEND, - ACTION_APPEND, - ACTION_IGNORE - } default_actions[DHO_COUNT]; - + struct option_data defaults[DHO_COUNT]; + enum actions default_actions[DHO_COUNT]; struct in_addr address; struct in_addr next_server; struct option_data send_options[DHO_COUNT]; |