summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkrw <krw@openbsd.org>2007-02-25 18:10:43 +0000
committerkrw <krw@openbsd.org>2007-02-25 18:10:43 +0000
commitb01d2fe6c91316de83cd6f113830607d016ad24c (patch)
tree2b3a3c211d12a3130cb311b1a1bbe8efdf565b21
parentPower on/off cardbus socket at attach/detach time. Makes firmware upload (diff)
downloadwireguard-openbsd-b01d2fe6c91316de83cd6f113830607d016ad24c.tar.xz
wireguard-openbsd-b01d2fe6c91316de83cd6f113830607d016ad24c.zip
No point in using zero'd fields in the parsed options. Use the options
in the lease, whence the parsed info was moved. Fixes "Bogus servername" messages when processing an offer and stops bogus filename info from being stored in the lease. Found while testing a Tucson hotel's dhcp service. ok @stevesk "looks good" henning@.
-rw-r--r--sbin/dhclient/dhclient.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/sbin/dhclient/dhclient.c b/sbin/dhclient/dhclient.c
index 16b3b2ee289..5e353bc64ba 100644
--- a/sbin/dhclient/dhclient.c
+++ b/sbin/dhclient/dhclient.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dhclient.c,v 1.110 2007/02/25 16:27:20 stevesk Exp $ */
+/* $OpenBSD: dhclient.c,v 1.111 2007/02/25 18:10:43 krw Exp $ */
/*
* Copyright 2004 Henning Brauer <henning@openbsd.org>
@@ -854,8 +854,8 @@ packet_to_lease(struct iaddr client_addr, struct option_data *options)
lease->address.len);
/* If the server name was filled out, copy it. */
- if ((!options[DHO_DHCP_OPTION_OVERLOAD].len ||
- !(options[DHO_DHCP_OPTION_OVERLOAD].data[0] & 2)) &&
+ if ((!lease->options[DHO_DHCP_OPTION_OVERLOAD].len ||
+ !(lease->options[DHO_DHCP_OPTION_OVERLOAD].data[0] & 2)) &&
client->packet.sname[0]) {
lease->server_name = malloc(DHCP_SNAME_LEN + 1);
if (!lease->server_name) {
@@ -874,8 +874,8 @@ packet_to_lease(struct iaddr client_addr, struct option_data *options)
}
/* Ditto for the filename. */
- if ((!options[DHO_DHCP_OPTION_OVERLOAD].len ||
- !(options[DHO_DHCP_OPTION_OVERLOAD].data[0] & 1)) &&
+ if ((!lease->options[DHO_DHCP_OPTION_OVERLOAD].len ||
+ !(lease->options[DHO_DHCP_OPTION_OVERLOAD].data[0] & 1)) &&
client->packet.file[0]) {
/* Don't count on the NUL terminator. */
lease->filename = malloc(DHCP_FILE_LEN + 1);