Hi guys
ipconfig performs not well conformed DHCP client transactions.
This bug does not affect 100% of the DHCP servers as some of
them are more forgiving than others when considering client
side protocol mistakes;
i.e When PXE installing on a VMware Workstation using the VMware DHCP
server plus a proxyDHCP the bug is not present.
When PXE installing on a real PC with a Netgear ISP router as DHCP server
and a proxyDHCP the bug is present.
This is an old bug reported here:
https://bugs.launchpad.net/ubuntu/+source/klibc/+bug/1327412and recently
""partially"" fixed in
debian/patches/broadcast_dhcp_send.patch found here:
https://launchpad.net/ubuntu/+archive/primary/+files/klibc_2.0.4-8ubuntu1.debian.tar.xz
It would be nice if it is correctly fixed upstream.
as this bug affects lot of distros.
Basically the function dhcp_send() at dhcp_proto.c
mistakenly define
bootp.yiaddr = dev->ip_addr;
when in a client originated DHCP DHCPREQUEST(RFC2131 Page 36)
it should be
bootp.yiaddr = INADDR_ANY; // "0"
and also it forgets to define the flags
bootp.flags = htons(0x800);
Best,
Patrick
Signed-off-by: Patrick Masotta <masottaus at yahoo.com>
---
diff -uprN a/klibc-2.0.4/usr/kinit/ipconfig/dhcp_proto.c
b/klibc-2.0.4/usr/kinit/ipconfig/dhcp_proto.c
--- a/klibc-2.0.4/usr/kinit/ipconfig/dhcp_proto.c 2014-07-09
09:21:02.000000000 -0600
+++ b/klibc-2.0.4/usr/kinit/ipconfig/dhcp_proto.c 2016-03-21
01:51:12.747420454 -0600
@@ -201,7 +201,8 @@ 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;
+ bootp.yiaddr = INADDR_ANY;
+ bootp.flags = htons(0x800);
bootp.giaddr = INADDR_ANY;
bootp.secs = htons(time(NULL) - dev->open_time);
memcpy(bootp.chaddr, dev->hwaddr, 16);