diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2007-02-25 18:10:44 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2007-02-25 18:10:44 +0000 |
commit | 4f4bc78567b83cbec6d558b9bf7cbc28b91078d5 (patch) | |
tree | 30dfbc23c441faa3514e27af992be7078abc91f7 /sbin | |
parent | f9a1ab22b8694cf0fcb58ba8cd115d4e062024c4 (diff) |
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@.
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/dhclient/dhclient.c | 10 |
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); |