Bug 6194 - udhcpc6 source address is null, should be link-local address
Summary: udhcpc6 source address is null, should be link-local address
Status: RESOLVED FIXED
Alias: None
Product: Busybox
Classification: Unclassified
Component: Networking (show other bugs)
Version: unspecified
Hardware: PC Linux
: P5 minor
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-04-17 09:09 UTC by Matt Whitlock
Modified: 2017-03-28 13:46 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:


Attachments
Use link-local-address on udhcpc6 (7.74 KB, patch)
2017-03-04 18:03 UTC, support
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Matt Whitlock 2013-04-17 09:09:51 UTC
IETF RFC 3315, section 16, says:
"The client MUST use a link-local address assigned to the interface for which it is requesting configuration information as the source address in the header of the IP datagram."

udhcpc6 is sending DHCPv6 datagrams using a null source address:

09:05:08.029589 IP6 (hlim 1, next-header UDP (17) payload length: 42) ::.546 > ff02::1:2.547: [udp sum ok] dhcp6 solicit (xid=13472b (client-ID hwaddr type 1 003018a4dc7c) (IA_NA IAID:3013793638 T1:0 T2:0))
        0x0000:  6000 0000 002a 1101 0000 0000 0000 0000
        0x0010:  0000 0000 0000 0000 ff02 0000 0000 0000
        0x0020:  0000 0000 0001 0002 0222 0223 002a 3399
        0x0030:  0113 472b 0001 000a 0003 0001 0030 18a4
        0x0040:  dc7c 0003 000c b3a2 d766 0000 0000 0000
        0x0050:  0000

Compare this to dibbler, which uses the link-local address of the interface as the source address:

09:01:25.221878 IP6 (hlim 1, next-header UDP (17) payload length: 52) fe80::230:18ff:fea4:dc7c.546 > ff02::1:2.547: [udp sum ok] dhcp6 solicit (xid=b8206c (client-ID hwaddr/time type 1 time 416299463 003018a4dc7d) (IA_PD IAID:1 T1:4294967295 T2:4294967295) (elapsed-time 6200))
        0x0000:  6000 0000 0034 1101 fe80 0000 0000 0000
        0x0010:  0230 18ff fea4 dc7c ff02 0000 0000 0000
        0x0020:  0000 0000 0001 0002 0222 0223 0034 84e3
        0x0030:  01b8 206c 0001 000e 0001 0001 18d0 39c7
        0x0040:  0030 18a4 dc7d 0019 000c 0000 0001 ffff
        0x0050:  ffff ffff ffff 0008 0002 1838
Comment 1 support 2017-03-04 18:03:59 UTC
Created attachment 6936 [details]
Use link-local-address on udhcpc6

Hi there,

although this ticket is very old, I faced the same problem. Using a recent busybox 1.26.2 it was not possible to get an IPv6 assigned using dhcpc6. I've tested with dnsmasq and ISC DHCPD6. While dnsmasq tries to send its DHCP-Responses via the loopback-device to a null-address, DHCPD6 just throws an error like "destination unreachable".

As there is no appropriate ioctl like SIOCGIFADDR for IPv6, I've rewritten udhcp_read_interface() using getifaddrs() to make it compatible with both, IPv4- and IPv6-Setups, and changed dhcpc6 to write it's link-local-address to raw generated packets - if there is one.

Using the attached patch I was able to receive an IPv6-Address via DHCP6 - again tested with dnsmasq and ISC DHCPD6. The rewritten udhcp_read_interface() should perform slower and require more memory as its predecessor.

My Build-Environment is GCC 6.3.0 and Musl 1.1.16 on x86_64-x32.
Comment 2 Denys Vlasenko 2017-03-28 13:46:58 UTC
Three patches based on tiggerswelt.net's submission to the ML are in git now. Closing as "resolved/fixed". Reopen if necessary.