diff options
author | Ted Unangst <tedu@cvs.openbsd.org> | 2012-08-22 00:14:43 +0000 |
---|---|---|
committer | Ted Unangst <tedu@cvs.openbsd.org> | 2012-08-22 00:14:43 +0000 |
commit | c6ae3f45443fa23e8cf51ad53aa5f5f91d5f485f (patch) | |
tree | ab3bf876957f29cdd0bafb5da160c9c795675dae /sbin | |
parent | 338926dfcc9ce2f85915c4b7d0588d91fb89660b (diff) |
add ignore keyword to conf file, allowing one to ignore unwanted info
from the server without necessarily speciyfing a supersede value
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/dhclient/clparse.c | 7 | ||||
-rw-r--r-- | sbin/dhclient/conflex.c | 3 | ||||
-rw-r--r-- | sbin/dhclient/dhclient.c | 8 | ||||
-rw-r--r-- | sbin/dhclient/dhclient.conf.5 | 12 | ||||
-rw-r--r-- | sbin/dhclient/dhcpd.h | 3 | ||||
-rw-r--r-- | sbin/dhclient/dhctoken.h | 3 |
6 files changed, 29 insertions, 7 deletions
diff --git a/sbin/dhclient/clparse.c b/sbin/dhclient/clparse.c index a55e24a79a5..5f361dce498 100644 --- a/sbin/dhclient/clparse.c +++ b/sbin/dhclient/clparse.c @@ -1,4 +1,4 @@ -/* $OpenBSD: clparse.c,v 1.38 2011/12/10 17:15:27 krw Exp $ */ +/* $OpenBSD: clparse.c,v 1.39 2012/08/22 00:14:42 tedu Exp $ */ /* Parser for dhclient config and lease files... */ @@ -170,6 +170,11 @@ parse_client_statement(FILE *cfile) if (code != -1) config->default_actions[code] = ACTION_SUPERSEDE; return; + case TOK_IGNORE: + code = parse_option_decl(cfile, &config->defaults[0]); + if (code != -1) + config->default_actions[code] = ACTION_IGNORE; + return; case TOK_APPEND: code = parse_option_decl(cfile, &config->defaults[0]); if (code != -1) diff --git a/sbin/dhclient/conflex.c b/sbin/dhclient/conflex.c index 2eed7ac9cb8..ec60dbb9516 100644 --- a/sbin/dhclient/conflex.c +++ b/sbin/dhclient/conflex.c @@ -1,4 +1,4 @@ -/* $OpenBSD: conflex.c,v 1.14 2011/12/10 17:36:40 krw Exp $ */ +/* $OpenBSD: conflex.c,v 1.15 2012/08/22 00:14:42 tedu Exp $ */ /* Lexical scanner for dhclient config file... */ @@ -337,6 +337,7 @@ static const struct keywords { { "filename", TOK_FILENAME }, { "fixed-address", TOK_FIXED_ADDR }, { "hardware", TOK_HARDWARE }, + { "ignore", TOK_IGNORE }, { "initial-interval", TOK_INITIAL_INTERVAL }, { "interface", TOK_INTERFACE }, { "lease", TOK_LEASE }, diff --git a/sbin/dhclient/dhclient.c b/sbin/dhclient/dhclient.c index 143a44db134..6afab56706d 100644 --- a/sbin/dhclient/dhclient.c +++ b/sbin/dhclient/dhclient.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dhclient.c,v 1.150 2012/08/21 00:29:32 krw Exp $ */ +/* $OpenBSD: dhclient.c,v 1.151 2012/08/22 00:14:42 tedu Exp $ */ /* * Copyright 2004 Henning Brauer <henning@openbsd.org> @@ -1534,6 +1534,9 @@ priv_script_write_params(char *prefix, struct client_lease *lease) if (config->defaults[i].len) { if (lease->options[i].len) { switch (config->default_actions[i]) { + case ACTION_IGNORE: + /* handled below */ + break; case ACTION_DEFAULT: dp = lease->options[i].data; len = lease->options[i].len; @@ -1589,6 +1592,9 @@ supersede: } else { len = 0; } + if (len && config->default_actions[i] == ACTION_IGNORE) { + len = 0; + } if (len) { char name[256]; diff --git a/sbin/dhclient/dhclient.conf.5 b/sbin/dhclient/dhclient.conf.5 index 637720e5be5..100894ace7e 100644 --- a/sbin/dhclient/dhclient.conf.5 +++ b/sbin/dhclient/dhclient.conf.5 @@ -1,4 +1,4 @@ -.\" $OpenBSD: dhclient.conf.5,v 1.21 2011/04/09 19:53:00 krw Exp $ +.\" $OpenBSD: dhclient.conf.5,v 1.22 2012/08/22 00:14:42 tedu 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: April 9 2011 $ +.Dd $Mdocdate: August 22 2012 $ .Dt DHCLIENT.CONF 5 .Os .Sh NAME @@ -244,6 +244,14 @@ in the .Ic supersede statement. .It Xo +.Ic ignore No { Op Ar option declaration +.Oo , Ar ... option declaration Oc } +.Xc +If for some set of options the client should always ignore the +value supplied by the server, these values can be defined in the +.Ic ignore +statement. +.It Xo .Ic prepend No { Op Ar option declaration .Oo , Ar ... option declaration Oc } .Xc diff --git a/sbin/dhclient/dhcpd.h b/sbin/dhclient/dhcpd.h index 3e314a771cd..a08fabad817 100644 --- a/sbin/dhclient/dhcpd.h +++ b/sbin/dhclient/dhcpd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: dhcpd.h,v 1.77 2012/08/18 00:23:30 krw Exp $ */ +/* $OpenBSD: dhcpd.h,v 1.78 2012/08/22 00:14:42 tedu Exp $ */ /* * Copyright (c) 2004 Henning Brauer <henning@openbsd.org> @@ -130,6 +130,7 @@ struct client_config { struct option_data defaults[256]; enum { ACTION_DEFAULT, + ACTION_IGNORE, ACTION_SUPERSEDE, ACTION_PREPEND, ACTION_APPEND diff --git a/sbin/dhclient/dhctoken.h b/sbin/dhclient/dhctoken.h index 868fb6a3132..4b27921ce35 100644 --- a/sbin/dhclient/dhctoken.h +++ b/sbin/dhclient/dhctoken.h @@ -1,4 +1,4 @@ -/* $OpenBSD: dhctoken.h,v 1.5 2006/05/15 08:10:57 fkr Exp $ */ +/* $OpenBSD: dhctoken.h,v 1.6 2012/08/22 00:14:42 tedu Exp $ */ /* Tokens for config file lexer and parser. */ @@ -79,6 +79,7 @@ #define TOK_REJECT 292 #define TOK_FDDI 293 #define TOK_LINK_TIMEOUT 294 +#define TOK_IGNORE 295 #define is_identifier(x) ((x) >= TOK_FIRST_TOKEN && \ (x) != TOK_STRING && \ |