klibc-bot for Mathieu Trudel-Lapierre
2019-Jan-18 16:42 UTC
[klibc] [klibc:master] ipconfig: Set broadcast when sending DHCPREQUEST and DHCPDISCOVER
Commit-ID: 8cb2792d8f7317c336ccc98f99199ae579ac84c6 Gitweb: http://git.kernel.org/?p=libs/klibc/klibc.git;a=commit;h=8cb2792d8f7317c336ccc98f99199ae579ac84c6 Author: Mathieu Trudel-Lapierre <mathieu.trudel-lapierre at canonical.com> AuthorDate: Tue, 24 Jan 2017 10:05:12 -0500 Committer: Ben Hutchings <ben at decadent.org.uk> CommitDate: Wed, 2 Jan 2019 03:08:04 +0000 [klibc] ipconfig: Set broadcast when sending DHCPREQUEST and DHCPDISCOVER 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. References: https://bugs.debian.org/733988 References: https://bugs.launchpad.net/bugs/1327412 Link: https://www.zytor.com/pipermail/klibc/2017-December/003974.html Signed-off-by: Ben Hutchings <ben at decadent.org.uk> --- usr/kinit/ipconfig/dhcp_proto.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/usr/kinit/ipconfig/dhcp_proto.c b/usr/kinit/ipconfig/dhcp_proto.c index ebf79cc..d5b759b 100644 --- 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, struct iovec *vec) 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);
Possibly Parallel Threads
- [PATCH 0/1] ipconfig DHCP bug
- [PATCH klibc 0/4] Fixes from Debian and Ubuntu
- [klibc:master] ipconfig: Implement classless static routes
- [klibc:master] ipconfig: Append padding if DHCP packet length < 300 octets
- initial mntent.h, mount features, ipconfig fixes