summaryrefslogtreecommitdiff
path: root/sbin/dhclient/dhclient.c
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2013-03-22 23:58:52 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2013-03-22 23:58:52 +0000
commit69f28996217b3d38429590a7202bd7e55b7f6e97 (patch)
tree27faec8ad309a9a152cca896d913972351a592e7 /sbin/dhclient/dhclient.c
parent699d62499842d9055e3dba86bdfb10b9c92b611c (diff)
Ignore client-identifier option in leases from a server. They're not supposed
to be there! Instead, always record the client-identifier used to obtain the lease. Ignore recorded leases that have a different client-identifier than the one currently in force. If a client-identifier is not specified in the dhclient.conf file, construct one from the network type and MAC, like most other clients out there do these days. Thus, if one plugs in a different USB network adapter, renewing the previous lease (which upsets servers due to the MAC being different) is skipped and DISCOVER is attempted at once. Issue noted and fix tested by tedu@.
Diffstat (limited to 'sbin/dhclient/dhclient.c')
-rw-r--r--sbin/dhclient/dhclient.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/sbin/dhclient/dhclient.c b/sbin/dhclient/dhclient.c
index dfe115a9454..9aab9204880 100644
--- a/sbin/dhclient/dhclient.c
+++ b/sbin/dhclient/dhclient.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dhclient.c,v 1.240 2013/02/27 17:25:59 krw Exp $ */
+/* $OpenBSD: dhclient.c,v 1.241 2013/03/22 23:58:51 krw Exp $ */
/*
* Copyright 2004 Henning Brauer <henning@openbsd.org>
@@ -1622,6 +1622,7 @@ char *
lease_as_string(char *type, struct client_lease *lease)
{
static char leasestr[8192];
+ struct option_data *opt;
char *p;
size_t sz, rsltsz;
int i, rslt;
@@ -1656,11 +1657,16 @@ lease_as_string(char *type, struct client_lease *lease)
}
for (i = 0; i < 256; i++) {
- if (lease->options[i].len == 0)
+ if (i == DHO_DHCP_CLIENT_IDENTIFIER) {
+ /* Ignore any CLIENT_IDENTIFIER from server. */
+ opt = &config->send_options[i];
+ } else if (lease->options[i].len)
+ opt = &lease->options[i];
+ else
continue;
+
rslt = snprintf(p, sz, " option %s %s;\n",
- dhcp_options[i].name,
- pretty_print_option(i, &lease->options[i], 1));
+ dhcp_options[i].name, pretty_print_option(i, opt, 1));
if (rslt == -1 || rslt >= sz)
return (NULL);
p += rslt;