dhclient 3.0.6 refuses valid offer

Bug #270010 reported by wyatt earp
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
dhcp3 (Debian)
Confirmed
Undecided
Unassigned
dhcp3 (Ubuntu)
Confirmed
Low
Chuck Short

Bug Description

Binary package hint: dhcp

dhclient 3.0.6 fails in the following fashion:

Internet Systems Consortium DHCP Client V3.0.6
Copyright 2004-2007 Internet Systems Consortium.
All rights reserved.
For info, please visit http://www.isc.org/sw/dhcp/

wifi0: unknown hardware address type 801
wifi0: unknown hardware address type 801
Listening on LPF/eth0/00:0e:7b:e0:69:8b
Sending on LPF/eth0/00:0e:7b:e0:69:8b
Sending on Socket/fallback
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 4
DHCPOFFER of 10.51.116.2 from 10.51.116.1
DHCPREQUEST of 10.51.116.2 on eth0 to 255.255.255.255 port 67
DHCPACK of 10.51.116.2 from 10.51.116.1
subnet_number():inet.c:56: Addr/mask length mismatch.

The DHCP offer sent is for the IP address of 10.51.116.2 with a subnet of 255.255.255.0 as showing in the attached PCAP file.

The problem code is:
00054 if (addr.len != mask.len)
00055 log_fatal("subnet_number():%s:%d: Addr/mask length mismatch.",
00056 MDL);
00057
00058 rv.len = 0;
00059
00060 /* Both addresses must have the same length... */
00061 if (addr.len != mask.len)
00062 return rv;

Ubuntu version:
lsb_release -rd
Description: Ubuntu 8.04.1
Release: 8.04

Package version:
apt-cache policy dhcp3-client
dhcp3-client:
  Installed: 3.0.6.dfsg-1ubuntu9
  Candidate: 3.0.6.dfsg-1ubuntu9
  Version table:
 *** 3.0.6.dfsg-1ubuntu9 0
        500 http://us.archive.ubuntu.com hardy/main Packages
        100 /var/lib/dpkg/status

Revision history for this message
wyatt earp (wyatt-hackerforhire) wrote :
affects: dhcp (Ubuntu) → dhcp3 (Ubuntu)
Revision history for this message
Chuck Short (zulcss) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better. The issue that you reported is one that should be reproducible with the live environment of the Desktop CD of the development release - Karmic Koala. It would help us greatly if you could test with it so we can work on getting it fixed in the next release of Ubuntu. You can find out more about the development release at http://www.ubuntu.com/testing/. Thanks again and we appreciate your help.

Changed in dhcp3 (Ubuntu):
importance: Undecided → Low
status: New → Incomplete
Revision history for this message
Chuck Short (zulcss) wrote :

We'd like to figure out what's causing this bug for you, but we haven't heard back from you in a while. Could you please provide the requested information? Thanks!

Revision history for this message
erickenny (eric-kenny) wrote :

I am having this issue as well with 9.10. Happens only at home connecting with my ISP. Works fine at the office. I am a programmer, and am willing to help debug this, but I don't know anything about dhclient. Please let me know how I can help. Meantime, I'll start digging myself.

Revision history for this message
erickenny (eric-kenny) wrote :

Sorry, just found the "Helping With Bugs" page on the Wiki. I'll get up to speed and start helping out with this one, since it's affecting me. Thanks.

erickenny (eric-kenny)
Changed in dhcp3 (Ubuntu):
status: Incomplete → Confirmed
Revision history for this message
erickenny (eric-kenny) wrote :

ok, so I found the problem. The pcap that wyatt earp attached (excellent info, thanks wyatt) shows the same scenario I'm seeing at home, where the DHCP server's DHCPACK message includes two (identical) "subnet mask" options.

Now, I'm no DHCP expert, but RFC 2131, Page 23 says
"Options may appear only once, unless otherwise specified in the options document. The client concatenates the values of multiple instances of the same option into a single parameter list for configuration."

The subnet mask option documentation does not specify that it can occur more than once, and tables.c (lines 101-102) show that dhclient only expects a single value:

static struct option dhcp_options[] = {
 { "subnet-mask", "I", &dhcp_universe, 1, 1 },

The problem ends up being that dhclient appends the second subnet-mask value to the first, giving it a length of 8, rather than 4. So, dhcpack function calls bind_lease function, which calls the script_write_params function.

The script_write_params function tries to find the network number using the netmask acquired from DHCPACK message. At this point, netmask.iabuf looks like this:

len

iabuf 0xbfffdf4c
 iabuf[0] 0xff
 iabuf[1] 0xff
 iabuf[2] 0xff
 iabuf[3] 0
 iabuf[4] 0xff
 iabuf[5] 0xff
 iabuf[6] 0xff
 iabuf[7] 0

script_write_params function calls subnet_number, which sees that the netmask

So it would seem that the server is wrong in sending two subnet mask options, but IMHO, dhclient could be more lenient in the case where the two are identical. After all, other dhcp clients connecting to my

Revision history for this message
erickenny (eric-kenny) wrote :

ugh, accidentally posted that message in the middle of editing it.

So, the subnet_number function sees an address of 4 bytes, but a netmask of 8 bytes and fails.

Where I was headed is that I think dhclient should be modified to ignore duplicate options sent by the server.

Revision history for this message
erickenny (eric-kenny) wrote :

I think importance should be set high because this problem "Has a severe impact on a small portion of Ubuntu users." Anyone with certain ISPs can't connect at all.

erickenny (eric-kenny)
Changed in dhcp3 (Ubuntu):
assignee: nobody → Chuck Short (zulcss)
erickenny (eric-kenny)
Changed in dhcp3 (Debian):
status: New → Incomplete
status: Incomplete → Confirmed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.