* [patch (for 2.6.25?) 1/2] The kernel gets no IP from some DHCP servers
@ 2008-03-04 22:56 akpm
2008-03-05 0:23 ` Stephen Hemminger
0 siblings, 1 reply; 3+ messages in thread
From: akpm @ 2008-03-04 22:56 UTC (permalink / raw)
To: davem; +Cc: netdev, akpm, Marcel.Wappler, kaber, shemminger
From: "Wappler Marcel" <Marcel.Wappler@bridgeco.net>
This patch fixes a DHCP issue of the kernel: some DHCP servers (i.e. in the
Linksys WRT54Gv5) are very strict about the contents of the DHCPDISCOVER
packet they receive from clients.
Table 5 in RFC2131 page 36 requests the fields 'ciaddr' and 'siaddr' MUST be
set to '0'. These DHCP servers ignore Linux kernel's DHCP discovery packets
with these two fields set to '255.255.255.255' (in contrast to popular DHCP
clients, such as 'dhclient' or 'udhcpc'). This leads to a not booting system.
I tested this on a ARM embedded device mounting rootfs over NFS obtaining its
IP from a Linksys WRT54Gv5 Router running VxWorks and a PC based Server
running a Linux. Changing the two fields to '0.0.0.0' worked.
Cc: Stephen Hemminger <shemminger@osdl.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Patrick McHardy <kaber@trash.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
net/ipv4/ipconfig.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff -puN net/ipv4/ipconfig.c~the-kernel-gets-no-ip-from-some-dhcp-servers net/ipv4/ipconfig.c
--- a/net/ipv4/ipconfig.c~the-kernel-gets-no-ip-from-some-dhcp-servers
+++ a/net/ipv4/ipconfig.c
@@ -29,6 +29,10 @@
*
* Multiple Nameservers in /proc/net/pnp
* -- Josef Siemes <jsiemes@web.de>, Aug 2002
+ *
+ * Bugfix: Not getting an IP from some DHCP servers: RFC2131 page 36
+ * Table 5 requests DHCPDISCOVER fields ciaddr and siaddr MUST be '0'.
+ * -- marcel.wappler@bridgeco.net
*/
#include <linux/types.h>
@@ -103,6 +107,7 @@
- '3' from resolv.h */
#define NONE __constant_htonl(INADDR_NONE)
+#define ZERO __constant_htonl(((unsigned long int) 0x00000000))
/*
* Public IP configuration
@@ -754,8 +759,8 @@ static void __init ic_bootp_send_if(stru
b->htype = dev->type; /* can cause undefined behavior */
}
b->hlen = dev->addr_len;
- b->your_ip = NONE;
- b->server_ip = NONE;
+ b->your_ip = ZERO;
+ b->server_ip = ZERO;
memcpy(b->hw_addr, dev->dev_addr, dev->addr_len);
b->secs = htons(jiffies_diff / HZ);
b->xid = d->xid;
_
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [patch (for 2.6.25?) 1/2] The kernel gets no IP from some DHCP servers
2008-03-04 22:56 [patch (for 2.6.25?) 1/2] The kernel gets no IP from some DHCP servers akpm
@ 2008-03-05 0:23 ` Stephen Hemminger
2008-03-05 1:04 ` David Miller
0 siblings, 1 reply; 3+ messages in thread
From: Stephen Hemminger @ 2008-03-05 0:23 UTC (permalink / raw)
To: akpm; +Cc: davem, netdev, akpm, Marcel.Wappler, kaber
On Tue, 04 Mar 2008 14:56:48 -0800
akpm@linux-foundation.org wrote:
> From: "Wappler Marcel" <Marcel.Wappler@bridgeco.net>
>
> This patch fixes a DHCP issue of the kernel: some DHCP servers (i.e. in the
> Linksys WRT54Gv5) are very strict about the contents of the DHCPDISCOVER
> packet they receive from clients.
>
> Table 5 in RFC2131 page 36 requests the fields 'ciaddr' and 'siaddr' MUST be
> set to '0'. These DHCP servers ignore Linux kernel's DHCP discovery packets
> with these two fields set to '255.255.255.255' (in contrast to popular DHCP
> clients, such as 'dhclient' or 'udhcpc'). This leads to a not booting system.
>
> I tested this on a ARM embedded device mounting rootfs over NFS obtaining its
> IP from a Linksys WRT54Gv5 Router running VxWorks and a PC based Server
> running a Linux. Changing the two fields to '0.0.0.0' worked.
>
> Cc: Stephen Hemminger <shemminger@osdl.org>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: Patrick McHardy <kaber@trash.net>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> ---
Same patch without the noise comment and extra code.
--- a/net/ipv4/ipconfig.c 2008-03-04 16:20:10.000000000 -0800
+++ b/net/ipv4/ipconfig.c 2008-03-04 16:22:49.000000000 -0800
@@ -753,9 +753,9 @@ static void __init ic_bootp_send_if(stru
printk("Unknown ARP type 0x%04x for device %s\n", dev->type, dev->name);
b->htype = dev->type; /* can cause undefined behavior */
}
+
+ /* server_ip and your_ip address are both already zero per RFC2131 */
b->hlen = dev->addr_len;
- b->your_ip = NONE;
- b->server_ip = NONE;
memcpy(b->hw_addr, dev->dev_addr, dev->addr_len);
b->secs = htons(jiffies_diff / HZ);
b->xid = d->xid;
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [patch (for 2.6.25?) 1/2] The kernel gets no IP from some DHCP servers
2008-03-05 0:23 ` Stephen Hemminger
@ 2008-03-05 1:04 ` David Miller
0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2008-03-05 1:04 UTC (permalink / raw)
To: shemminger; +Cc: akpm, netdev, Marcel.Wappler, kaber
From: Stephen Hemminger <shemminger@linux-foundation.org>
Date: Tue, 4 Mar 2008 16:23:42 -0800
> Same patch without the noise comment and extra code.
Much nicer.
The following is what I'll push to Linus.
Thanks.
commit dea75bdfa57f75a7a7ec2961ec28db506c18e5db
Author: Stephen Hemminger <shemminger@linux-foundation.org>
Date: Tue Mar 4 17:03:49 2008 -0800
[IPCONFIG]: The kernel gets no IP from some DHCP servers
From: Stephen Hemminger <shemminger@linux-foundation.org>
Based upon a patch by Marcel Wappler:
This patch fixes a DHCP issue of the kernel: some DHCP servers
(i.e. in the Linksys WRT54Gv5) are very strict about the contents
of the DHCPDISCOVER packet they receive from clients.
Table 5 in RFC2131 page 36 requests the fields 'ciaddr' and
'siaddr' MUST be set to '0'. These DHCP servers ignore Linux
kernel's DHCP discovery packets with these two fields set to
'255.255.255.255' (in contrast to popular DHCP clients, such as
'dhclient' or 'udhcpc'). This leads to a not booting system.
Signed-off-by: David S. Miller <davem@davemloft.net>
diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c
index 10013cc..5dd9385 100644
--- a/net/ipv4/ipconfig.c
+++ b/net/ipv4/ipconfig.c
@@ -753,9 +753,9 @@ static void __init ic_bootp_send_if(struct ic_device *d, unsigned long jiffies_d
printk("Unknown ARP type 0x%04x for device %s\n", dev->type, dev->name);
b->htype = dev->type; /* can cause undefined behavior */
}
+
+ /* server_ip and your_ip address are both already zero per RFC2131 */
b->hlen = dev->addr_len;
- b->your_ip = NONE;
- b->server_ip = NONE;
memcpy(b->hw_addr, dev->dev_addr, dev->addr_len);
b->secs = htons(jiffies_diff / HZ);
b->xid = d->xid;
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-03-05 1:04 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-04 22:56 [patch (for 2.6.25?) 1/2] The kernel gets no IP from some DHCP servers akpm
2008-03-05 0:23 ` Stephen Hemminger
2008-03-05 1:04 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).