Subject: isc-dhcp-client: no ipv6 prefix set automatically

From: Adrian Zaugg <[email-masked]>
Date: Sat, 04 Apr 2020 23:00:28 +0200

Package: isc-dhcp-client
Version: 4.3.5-3+deb9u1
Severity: important

Requesting an address over dhcp6 does not set the ipv6 prefix length. The address received seems always get 
a /128 prefix set, even if the dhcp6 server sends another one. 

I expect dhclient to set the prefix lenght, if the dhcp6 server sends one.

The code in /sbin/dhclient-script under "### DHCPv6 Handlers" is the same in ascii and Debian/unstable (4.4.1-2.1+b2). 

It has a mark "TODO: handle prefix change: ?based on ${old_ip6_prefix} and ${new_ip6_prefix}?"... In the code that 
does set the ipv6 address using iproute2 there is no prefix mentioned. See line 385 and the following:

    385     BOUND6|RENEW6|REBIND6)
    386         if [ "${new_ip6_address}" ]; then
    387             # set leased IP
    388             ip -6 addr add ${new_ip6_address} \
    389                 dev ${interface} scope global
    390         fi

This part has two problems: It should also be called upon reason REBOOT6 (see dhclient-script(8)) and it 
should set the prefix if one was given. I suggest to change this to:

    385     BOUND6|RENEW6|REBIND6|REBOOT6)
    386         if [ "${new_ip6_address}" ]; then
    387 
    388             # check wether a prefix was passed and add it to the address
    389             if [ -n "$new_ip6_prefixlen" ]; then
    390                 new_ip6_address_and_prefix="${new_ip6_address}/${new_ip6_prefixlen}"
    391             else
    392                 new_ip6_address_and_prefix="${new_ip6_address}"
    393             fi
    394 
    395             # set leased IP
    396             ip -6 addr add ${new_ip6_address_and_prefix} \
    397                 dev ${interface} scope global

According to my tests this resolves the problem. Please review.

Regards, Adrian.

-- System Information:
Distributor ID:	Devuan
Description:	Devuan GNU/Linux 2.1 (ascii)
Release:	2.1
Codename:	ascii

Architecture: x86_64

Kernel: Linux 4.9.0-12-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: sysvinit (via /sbin/init)

Versions of packages isc-dhcp-client depends on:
ii  debianutils       4.8.1.1
ii  iproute2          4.9.0-1+deb9u1
ii  libc6             2.24-11+deb9u4
ii  libdns-export162  1:9.10.3.dfsg.P4-12.3+deb9u5
ii  libisc-export160  1:9.10.3.dfsg.P4-12.3+deb9u5

Versions of packages isc-dhcp-client recommends:
ii  isc-dhcp-common  4.3.5-3+deb9u1

Versions of packages isc-dhcp-client suggests:
pn  avahi-autoipd         <none>
pn  isc-dhcp-client-ddns  <none>
ii  resolvconf            1.79

-- Configuration Files:
/etc/dhcp/debug changed [not included]

-- no debconf information

---

From: Mark Hindley <[email-masked]>
Date: Sun, 5 Apr 2020 09:48:59 +0100

Control: tags -1 debian

> a /128 prefix set, even if the dhcp6 server sends another one. 

Adrian,

Thanks for this. However isc-dhcp-client is not a forked package and Devuan uses
the Debian pacakges directly. You would be better reporting this directly to
Debian's BTS.

Thanks.

Mark