'dhclient -6 -S' does not bring interface up
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
isc-dhcp (Ubuntu) |
Invalid
|
Undecided
|
Unassigned |
Bug Description
When poking around with bug 1633479 i realized that 'dhclient -6 -S -1 eth0' will not raise the interface eth0. if it is not up already and have link local addresses, then it will fail.
This may well be designed, so I'm fine if this bug is closed as 'INVALID' with such an explanation.
One thing I did notice though, when seeing if this was easily fixed was
a.) previously bringing the link up was not done (no scripts are called)
b.) the PREINIT script in dhclient.linux does:
# flush any stale global permanent IPs from interface
ip -6 addr flush dev ${interface} scope global permanent
That means that currently, a non-stateless dhclient
invocation would flush global permanent addresses, but a stateless
dhclient invocation would not.
If we changed dhclient to call dhclient-script with PREINIT6, then this scenario:
ip link set down dev eth0
ip link set up dev eth0
ip address add fd42::2/64 dev eth0
dhclient -S -6 -v -1 eth0
will cause the fd42::2 address to be removed from eth0, where
as previously it was not. I'm not sure if the previous behavior
was designed or chance.
ProblemType: Bug
DistroRelease: Ubuntu 16.10
Package: isc-dhcp-client 4.3.3-5ubuntu15
ProcVersionSign
Uname: Linux 4.8.0-22-generic x86_64
NonfreeKernelMo
ApportVersion: 2.20.3-0ubuntu8
Architecture: amd64
CurrentDesktop: Unity
Date: Fri Oct 14 13:08:13 2016
EcryptfsInUse: Yes
InstallationDate: Installed on 2015-07-23 (449 days ago)
InstallationMedia: Ubuntu 15.10 "Wily Werewolf" - Alpha amd64 (20150722.1)
SourcePackage: isc-dhcp
UpgradeStatus: No upgrade log present (probably fresh install)
So I suspect the reason for this behavior is that there is no reason why you'd want to run dhclient in IPv6 mode before you've brought up the interface and parsed the router advertisement.
That's because unlike IPv4, IPv6 configuration is mostly done through router advertisements which happen entirely outside of DHCPv6. The content of that router advertisement then dictates whether DHCPv6 should be done and if so, in which mode.
So the way things are expected to happen is:
- Bring up the interface
- Do router solicitation and get a router advertisement
- Parse the router advertisement, looking for the other-config (O) and managed (M) flag.
- If the managed bit is set, then trigger dhcpv6 in stateful mode
- If the managed bit isn't set and other-config bit is set, then trigger dhcpv6 in stateless mode
- If neither are, then use the RDNSS and DNSSL information from the advertisement to configure DNS
Triggering dhclient in stateless or even stateful mode before getting a router advertisement may succeed but may also run into a race condition as the gateway and prefix length may not have been received by the time the DHCP dialog is over, leading to invalid configuration.