Page MenuHomeVyOS Platform

DHCPv6 not updating nameservers and search domains since replacing isc-dhcp-client with WIDE dhcp6c
Open, HighPublicBUG

Description

Before the switch to WIDE dhcp6c , adding and deleting nameservers and search domains from the lease was done by isc-dhcp-client dhclient-script. This has custom hooks (make_resolv_conf and a post script) that do the necessary updating of nameservers via vyos-hostsd.
Since switching to WIDE dhcp6c for T421 these scripts aren't ran any more. WIDE dhcp6c does support running scripts, but after comparing the two, they aren't compatible, so it isn't a simple case of running the existing isc-dhcp scripts with wide.

most notably from 'man dhcp6c':

Configuration Script
When receives a reply message, it will invoke a supplementary configuration script specified in the dhcp6c.conf5 file. The daemon will provide the script with configuration parameters as environment variables, which include:

REASON
    The reason why the script is invoked. As of this writing, the value is always "NBI" and thus meaningless. 
new_domain_name_servers
    A list of available DNS servers, each of which is an IPv6 numeric address and is separated by a white space character. 
new_domain_name
    A list of DNS names, which provides DNS name search path. 
new_ntp_servers
    A list of available NTP servers, each of which is an IPv6 numeric address and is separated by a white space character. 
new_sip_servers
    A list of available SIP server addresses, each of which is an IPv6 numeric address and is separated by a white space character. 
new_sip_name
    A list of SIP server domain names. 
new_nis_servers
    A list of available NIS server addresses, each of which is an IPv6 numeric address and is separated by a white space character. 
new_nis_name
    A list of NIS domain names. 
new_nisp_servers
    A list of available NIS+ server addresses, each of which is an IPv6 numeric address and is separated by a white space character. 
new_nisp_name
    A list of NIS+ domain names. 
new_bcmcs_servers
    A list of available BCMCS server addresses, each of which is an IPv6 numeric address and is separated by a white space character. 
new_bcmcs_name
    A list of BCMCS server domain names.

So the critical differences are:

  • REASON is never set to the real reason (isc-dhcp does set it)
  • new_domain_name_servers is used for v6, whereas isc-dhcp uses it for v4 and has a separate new_dhcp6_name_servers variable for v6
  • new_domain_name is the equivalent of isc-dhcp new_dhcp6_domain_search

So to fix this with wide-dhcp6, we'd need to make a completely new script that does the same things the existing pre/post hooks for dhclient-script do, but suitable for wide.

(if anyone wants to start working on this, note there is a pending vyos-1x PR for the whole vyos-hostsd/dhclient hooks so please wait until it's merged)

Details

Difficulty level
Unknown (require assessment)
Version
-
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Unspecified (possibly destroys the router)
Issue type
Bug (incorrect behavior)

Event Timeline

jjakob triaged this task as High priority.Jun 12 2020, 10:02 AM
jjakob created this task.
jjakob created this object in space S1 VyOS Public.
syncer changed the subtype of this task from "Task" to "Bug".Jun 12 2020, 5:09 PM
erkin set Issue type to Bug (incorrect behavior).Aug 30 2021, 5:31 AM
erkin removed a subscriber: Active contributors.

We need to implement https://manpages.debian.org/testing/wide-dhcpv6-client/dhcp6c.conf.5.en.html#script like in ipv4 dhcp client

vyos@vyos# cat /tmp/foo.sh
#!/bin/bash
FOO=$(printenv)
logger ${REASON} - ${FOO}

results in Mar 28 20:51:04 root[13452]: NBI - new_domain_name=vyos.net. new_domain_name_servers=2001:db8::8888 2001:db8::4444 PWD=/ REASON=NBI SHLVL=0 _=/usr/bin/printenv

for

interface eth0.201 {
    request domain-name-servers;
    request domain-name;
    send ia-na 0; # non-temporary address
    script "/tmp/foo.sh";
};
NOTE: REASON is always NBI and thus meaningless