Klibc: ipconfig fails on network with DHCP relays

Bug #175324 reported by Ken Simon
14
Affects Status Importance Assigned to Milestone
klibc (Debian)
Fix Released
Unknown
klibc (Ubuntu)
Fix Released
Undecided
Unassigned
Hardy
Fix Released
Medium
Unassigned

Bug Description

This effects the LTSP package suite, since PXE booted kernels use ipconfig (from klibc) to obtain a DHCP address. It affected my network because when we turned on Cisco's DHCP snooping (which mitigates rogue DHCP servers somewhere in your network) it breaks LTSP.

I have filed this report with the upstream maintainer (http://marc.info/?l=linux-kernel&m=119729810931653&w=2) and it has been sent to the kernel, but I would like it if this could be backported to gutsy in an update.

The basic behavior is that according to RFC 2131, DHCP relay hosts should reject a DHCP request packet that has the giaddr field set. This one line fix just sets the giaddr field to INADDR_ANY.

Here is a simple (git formatted) patch:

diff --git a/usr/kinit/ipconfig/dhcp_proto.c b/usr/kinit/ipconfig/dhcp_proto.c
index a1090f3..8ff1d58 100644
--- a/usr/kinit/ipconfig/dhcp_proto.c
+++ b/usr/kinit/ipconfig/dhcp_proto.c
@@ -161,7 +161,7 @@ static int dhcp_send(struct netdev *dev, struct iovec *vec)
       bootp.hlen = dev->hwlen;
       bootp.xid = dev->bootp.xid;
       bootp.ciaddr = dev->ip_addr;
- bootp.giaddr = dev->bootp.gateway;
+ bootp.giaddr = INADDR_ANY;
       bootp.secs = htons(time(NULL) - dev->open_time);
       memcpy(bootp.chaddr, dev->hwaddr, 16);

Changed in klibc:
status: Unknown → New
Changed in klibc:
status: New → Fix Released
Revision history for this message
emmanuel (emmanuel-inl) wrote :

Same problem. Please add this patch, it solve all my problem with dhcrelay.

Revision history for this message
Leadpumper (jurrie) wrote :

Adding myself to the e-mail list

Revision history for this message
Aki (sakatsuki) wrote :

Hi. I'm new here.
I still have same problem.
using Ubuntu 9.04 LTSP and another DHCP server on router.

Here is thin client boot log:
IP-Config: eth0 hardware address 00:00:86:40:e3:a8 mtu 1500 DHCP RARP
[ 7.733842] eth0: setting full-duplex.
IP-Config: no response after 60 secs - giving up
/init: .: line 1: can't open /tmp/net-eth0.conf
[ 125.154111] Kernel panic - not syncing: Attempted to kill init!
[ 125.154241] Dumping ftrace buffer:
[ 125.154325] (ftrace buffer empty)

Disconnecting router, it works fine.

Revision history for this message
Guevara (eguevara2012) wrote :

The same problem here:

https://bugs.launchpad.net/ubuntu/+source/ltsp/+bug/365380

And none solution until now.

Revision history for this message
Ken Simon (ninkendo) wrote :

This bug has been fixed since Hardy, I think it was accidentally left open because it was marked fixed in Debian, but not in Ubuntu.

Let me reiterate that this bug applies specifically to a DHCP protocol violation in klibc, and was fixed in the beginning of 2008, in time for Hardy. Any other problems that may cause network-related kernel panics on boot in LTSP are not related to this bug.

Changed in klibc (Ubuntu):
status: New → Fix Released
Revision history for this message
emmanuel (emmanuel-inl) wrote :

This bug affect still Ubuntu 9.04 LTSP distribution.

The patch is needed if we use dhcrelay if we relaying dhcp query.

Revision history for this message
Ken Simon (ninkendo) wrote :

@emmanuel:

I have just checked Jaunty's klibc, and the patch is applied.

Perform the following steps:

apt-get source klibc
cd klibc-1.5.14/usr/kinit/ipconfig
$EDITOR dhcp_proto.c

and check line 175. Verify that it is:

bootp.giaddr = INADDR_ANY;

If you are still having trouble network booting, _file a different bug_. This bug is specifically addressing the application of this patch to klibc, because setting the giaddr flag on a dhcp request breaks RFC 2131.

Now that the patch is applied, there is no reason to reopen this bug.

Revision history for this message
emmanuel (emmanuel-inl) wrote :

I'm talking about the LTS version of Ubuntu : Hardy.

This version is affected by this bug.

Revision history for this message
Ken Simon (ninkendo) wrote :

Hardy is 8.04, not 9.04, but ok.

I checked on hardy, and you're right, the patch is not applied.

Guevara's bug still is not related to this though.

I'll see if I can upload a simple (mostly one-line) debdiff and try to get someone in canonical to notice it. IMO this should really be sent to hardy-updates since hardy's supposed to be LTS.

Revision history for this message
Ken Simon (ninkendo) wrote :

Changing the bug to "In Progress" until it is fixed in hardy. Since it is a one line fix I am hoping it can be included as an update to main in hardy-updates. A debdiff will be added in the comments (klibc_1.5.7-4ubuntu5.debdiff)

Changed in klibc (Ubuntu):
status: Fix Released → In Progress
Revision history for this message
Ken Simon (ninkendo) wrote :

Here is the debdiff that applies the one-line fix. Note that this one-line change already appears from Intrepid onwards, but it should be applied to hardy-updates so this bug can be fixed in LTSP 8.04 LTS

Colin Watson (cjwatson)
Changed in klibc (Ubuntu Hardy):
status: New → In Progress
Changed in klibc (Ubuntu):
milestone: none → ubuntu-8.04.4
Changed in klibc (Ubuntu Hardy):
milestone: none → ubuntu-8.04.4
Changed in klibc (Ubuntu):
milestone: ubuntu-8.04.4 → none
status: In Progress → Fix Released
Revision history for this message
Steve Langasek (vorlon) wrote :

Confirmed that this change is present in klibc in lucid, and it looks correct to me. Uploaded to hardy-proposed. Fellow SRU team members, could one of you approve this, so we can include it in 8.04.4?

Steve Langasek (vorlon)
Changed in klibc (Ubuntu Hardy):
importance: Undecided → Medium
Revision history for this message
Martin Pitt (pitti) wrote : Please test proposed package

Accepted klibc into hardy-proposed, the package will build now and be available in a few hours. Please test and give feedback here. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you in advance!

Changed in klibc (Ubuntu Hardy):
status: In Progress → Fix Committed
tags: added: verification-needed
Revision history for this message
Stéphane Graber (stgraber) wrote :

Not having the actual LTSP setup in Hardy anymore, I made a quick simulation for that fix.
My network is running with a DHCP proxy, br0 is the interface connected to that network:

root@vivaldi:~/test# cat /boot/initrd.img-2.6.24-26-openvz | gzip -d | cpio -i
48821 blocks
root@vivaldi:~/test# chroot . bin/sh
BusyBox v1.1.3 (Debian 1:1.1.3-5ubuntu12) Built-in shell (ash)
Enter 'help' for a list of built-in commands.

# ipconfig --help
ipconfig: invalid option --
# ipconfig br0
IP-Config: br0 hardware address 00:00:20:bd:4e:ba mtu 1500 DHCP RARP

root@vivaldi:~# apt-get install libklibc klibc-utils
...

root@vivaldi:~/new-initrd# cat /boot/initrd.img-2.6.24-26-openvz | gzip -d | cpio -i
48821 blocks
root@vivaldi:~/new-initrd# chroot . /bin/sh
BusyBox v1.1.3 (Debian 1:1.1.3-5ubuntu12) Built-in shell (ash)
Enter 'help' for a list of built-in commands.

# ipconfig br0
IP-Config: br0 hardware address 00:00:20:bd:4e:ba mtu 1500 DHCP RARP
IP-Config: br0 guessed broadcast address 10.x.x.255
IP-Config: br0 complete (from 10.x.x.115):
 address: 10.x.x.203 broadcast: 10.x.x.255 netmask: 255.255.255.0
 gateway: 10.x.x.1 dns0 : 10.x.x.117 dns1 : 0.0.0.0
 domain : revolutionlinux.com
 rootserver: 10.x.x.116 rootpath:
 filename : /netboot/pxelinux.0
#

What I did
- Uncompressed the initrd
- Started ipconfig from within it (as LTSP does)
--> It failed (hanging waiting for a reply)
- Updated klibc on the host
- Rebuilt the initrd
- Started ipconfig from within it (as LTSP does)
--> It worked (Got all the network details)

So that should prove that the fix does what it's supposed to do

Martin Pitt (pitti)
tags: added: verification-done
removed: verification-needed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package klibc - 1.5.7-4ubuntu5

---------------
klibc (1.5.7-4ubuntu5) hardy-proposed; urgency=low

  * dhcp_proto.c: Don't set bootp.gateway in the DHCP request, as it doesn't
    conform to RFC 2131, and breaks DHCP when relay hosts are in the
    network. LP: #175324.
 -- Ken Simon <email address hidden> Tue, 21 Jul 2009 10:03:19 -0400

Changed in klibc (Ubuntu Hardy):
status: Fix Committed → Fix Released
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.