summaryrefslogtreecommitdiff
path: root/sbin/dhclient
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2013-02-09 23:37:22 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2013-02-09 23:37:22 +0000
commitd04415dbd16340963789bf03ae3c9549c0e3b3c1 (patch)
tree38e9fbf740deea06175303a4510cf433c845b486 /sbin/dhclient
parent42c5054fed41bee925dfaafcfb273fe3ec9b58ea (diff)
As tedu@ pointed out a while ago, it makes little sense to discard
an option list if it contains duplicate option names. Just ignore the duplicates.
Diffstat (limited to 'sbin/dhclient')
-rw-r--r--sbin/dhclient/clparse.c13
-rw-r--r--sbin/dhclient/dhclient.87
-rw-r--r--sbin/dhclient/dhclient.c13
3 files changed, 13 insertions, 20 deletions
diff --git a/sbin/dhclient/clparse.c b/sbin/dhclient/clparse.c
index b2c41a2c566..aec5a702ac2 100644
--- a/sbin/dhclient/clparse.c
+++ b/sbin/dhclient/clparse.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: clparse.c,v 1.52 2013/02/01 20:44:00 florian Exp $ */
+/* $OpenBSD: clparse.c,v 1.53 2013/02/09 23:37:21 krw Exp $ */
/* Parser for dhclient config and lease files... */
@@ -341,13 +341,10 @@ parse_option_list(FILE *cfile, u_int8_t *list, size_t sz)
goto syntaxerror;
}
/* Avoid storing duplicate options in the list. */
- for (j = 0; j < ix; j++) {
- if (list[j] == i) {
- parse_warn("option in list more than once.");
- goto syntaxerror;
- }
- }
- list[ix++] = i;
+ for (j = 0; j < ix && list[j] != i; j++)
+ ;
+ if (j == ix)
+ list[ix++] = i;
token = next_token(&val, cfile);
} while (token == ',');
if (token != ';') {
diff --git a/sbin/dhclient/dhclient.8 b/sbin/dhclient/dhclient.8
index 5898392425b..4436af840ac 100644
--- a/sbin/dhclient/dhclient.8
+++ b/sbin/dhclient/dhclient.8
@@ -1,4 +1,4 @@
-.\" $OpenBSD: dhclient.8,v 1.15 2013/01/19 07:15:19 jmc Exp $
+.\" $OpenBSD: dhclient.8,v 1.16 2013/02/09 23:37:21 krw Exp $
.\"
.\" Copyright (c) 1997 The Internet Software Consortium.
.\" All rights reserved.
@@ -35,7 +35,7 @@
.\" Enterprises. To learn more about the Internet Software Consortium,
.\" see ``http://www.isc.org/isc''. To learn more about Vixie
.\" Enterprises, see ``http://www.vix.com''.
-.Dd $Mdocdate: January 19 2013 $
+.Dd $Mdocdate: February 9 2013 $
.Dt DHCLIENT 8
.Os
.Sh NAME
@@ -81,8 +81,7 @@ This list will override any ignore statements in
.Xr dhclient.conf 5 .
.Ar options
must be a comma separated list of valid option names.
-Invalid or duplicated option names will cause the entire list to
-be discarded.
+Invalid option names will cause the entire list to be discarded.
.It Fl L Ar file
Specify a
.Ar file
diff --git a/sbin/dhclient/dhclient.c b/sbin/dhclient/dhclient.c
index f0d79ee161a..3189534825d 100644
--- a/sbin/dhclient/dhclient.c
+++ b/sbin/dhclient/dhclient.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dhclient.c,v 1.225 2013/02/02 20:20:42 krw Exp $ */
+/* $OpenBSD: dhclient.c,v 1.226 2013/02/09 23:37:21 krw Exp $ */
/*
* Copyright 2004 Henning Brauer <henning@openbsd.org>
@@ -2168,13 +2168,10 @@ apply_ignore_list(char *ignore_list)
}
/* Avoid storing duplicate options in the list. */
- for (j = 0; j < ix; j++) {
- if (list[j] == i) {
- note("Duplicate option name: '%s'", p);
- return;
- }
- }
- list[ix++] = i;
+ for (j = 0; j < ix && list[j] != i; j++)
+ ;
+ if (j == ix)
+ list[ix++] = i;
}
config->ignored_option_count = ix;