Hi,

In Ubuntu we have applied the attached patch to solve this issue.

Essentially, the DHCP messages need to be broadcast since when there are
multiple interfaces, you might otherwise send from a different interface
than the one you'll receive responses on while the interfaces are not yet
configured.

This fixes yiaddr to INADDR_ANY (which was missing for some DHCP message
types) and sets the broadcast bit.

Kindly,

Mathieu Trudel-Lapierre <mathieu...@gmail.com>
Freenode: cyphermox, Jabber: mathieu...@gmail.com
4096R/65B58DA1 818A D123 0992 275B 23C2  CF89 C67B B4D6 65B5 8DA1
From: Mathieu Trudel-Lapierre <mathieu.trudel-lapie...@canonical.com>
Subject: Set broadcast when sending DHCPREQUEST and DHCPDISCOVER
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=733988
Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/klibc/+bug/1327412

We need to do this, since our devices are probably not configured yet and
there may be more than one device we're trying to do DHCP on on the same
network. Otherwise, things might be dropped.

Patch is originally from here:
https://bugs.launchpad.net/ubuntu/+source/klibc/+bug/1327412/comments/5
... but the reporter "patpat" has not provided contact information, and
this is independently verifiable by looking at RFC 2131, section 4.1,
page 24.

---
 usr/kinit/ipconfig/dhcp_proto.c |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

Index: b/usr/kinit/ipconfig/dhcp_proto.c
===================================================================
--- a/usr/kinit/ipconfig/dhcp_proto.c
+++ b/usr/kinit/ipconfig/dhcp_proto.c
@@ -201,8 +201,14 @@ static int dhcp_send(struct netdev *dev,
 	bootp.hlen	= dev->hwlen;
 	bootp.xid	= dev->bootp.xid;
 	bootp.ciaddr	= INADDR_ANY;
-	bootp.yiaddr	= dev->ip_addr;
+	/* yiaddr should always be set to 0 for the messages we're likely
+	 * to send as a DHCP client: DHCPDISCOVER, DHCPREQUEST, DHCPDECLINE,
+	 * DHCPINFORM, DHCPRELEASE
+	 * cf. RFC2131 section 4.1.1, table 5.
+	 */
+	bootp.yiaddr	= INADDR_ANY;
 	bootp.giaddr	= INADDR_ANY;
+	bootp.flags	= htons(0x8000);
 	bootp.secs	= htons(time(NULL) - dev->open_time);
 	memcpy(bootp.chaddr, dev->hwaddr, 16);
 

Reply via email to