Control: tags 1065085 + patch Control: retitle 1065085 ifupdown: ifup/down fail on inet6 interfaces with auto/dhcp option when using dhcpcd
Hi, after running some more tests I'm attaching a patch which might be a proper fix for the issue. It comprises the following changes (in inet.defn, inet6.defn): - inet.defn: add -4/--ipv4only option to existing dhcpcd up/down commands - inet6.defn: add dhcpcd up/down commands with -6/--ipv6only option (including optional metric option for linux) for methods: auto, dhcp - inet6.defn: limit execution of wait-for-ll6.sh script to dhclient (wait-for-ll6.sh seems to have been added as a workaround for a dhclient issue but for some reason the script works fine during boot but fails during ifup after a previous explicit ifdown when using dhcpcd) - inet6.defn: update documentation The patch also contains an additional, unrelated documentation change: - inet.defn: document use of dhcpcd metric option for linux dhcp method
diff --git a/inet.defn b/inet.defn index c29f8b7..f13fa13 100644 --- a/inet.defn +++ b/inet.defn @@ -86,7 +86,7 @@ method dhcp options hostname hostname -- Hostname to be requested (dhcpcd, udhcpc) - metric metric -- Metric for added routes (dhclient) + metric metric -- Metric for added routes (dhclient, dhcpcd) leasetime leasetime -- Preferred lease time in seconds (dhcpcd) vendor vendor_id -- Vendor class identifier (dhcpcd) client client_id -- Client identifier (dhcpcd), or "no" (dhclient) @@ -102,7 +102,7 @@ method dhcp if (execable("dhclient")) udhcpc -n -p /run/udhcpc.%iface%.pid -i %iface% [[-x hostname:%hostname%]] \ elsif (execable("udhcpc")) - dhcpcd [[-h %hostname%]] [[-i %vendor%]] [[-I %client%]] \ + dhcpcd -4 [[-h %hostname%]] [[-i %vendor%]] [[-I %client%]] \ [[-l %leasetime%]] [[-m %metric%]] %iface% \ elsif (execable("dhcpcd")) echo 'No DHCP client software found!' >&2; false \ @@ -113,7 +113,7 @@ method dhcp if (execable("dhclient")) if test -f /run/udhcpc.%iface%.pid; then kill -USR2 $(cat /run/udhcpc.%iface%.pid); kill -TERM $(cat /run/udhcpc.%iface%.pid); fi \ elsif (execable("udhcpc")) - dhcpcd -k %iface% \ + dhcpcd -k4 %iface% \ elsif (execable("dhcpcd")) echo 'No DHCP client software found!' >&2; false \ elsif (1) @@ -285,7 +285,7 @@ method dhcp udhcpc -n -p /run/udhcpc.%iface%.pid -i %iface% [[-H %hostname%]] \ [[-c %client%]] \ elsif (execable("udhcpc")) - dhcpcd [[-h %hostname%]] [[-i %vendor%]] [[-I %client%]] \ + dhcpcd -4 [[-h %hostname%]] [[-i %vendor%]] [[-I %client%]] \ [[-l %leasetime%]] %iface% \ elsif (execable("dhcpcd")) echo 'No DHCP client software found!' >&2; false \ @@ -296,7 +296,7 @@ method dhcp if (execable("dhclient")) if test -f /run/udhcpc.%iface%.pid; then kill -USR2 $(cat /run/udhcpc.%iface%.pid); kill -TERM $(cat /run/udhcpc.%iface%.pid); fi \ elsif (execable("udhcpc")) - dhcpcd -k %iface% \ + dhcpcd -k4 %iface% \ elsif (execable("dhcpcd")) echo 'No DHCP client software found!' >&2; false \ elsif (1) @@ -436,7 +436,7 @@ method dhcp udhcpc -n -p /run/udhcpc.%iface///.%.pid -i %iface% [[-H %hostname%]] \ [[-c %client%]] \ elsif (execable("udhcpc")) - dhcpcd [[-h %hostname%]] [[-i %vendor%]] [[-I %client%]] \ + dhcpcd -4 [[-h %hostname%]] [[-i %vendor%]] [[-I %client%]] \ [[-l %leasetime%]] %iface% \ elsif (execable("dhcpcd")) echo 'No DHCP client software found!' >&2; false \ @@ -447,7 +447,7 @@ method dhcp if (execable("dhclient")) if test -f /run/udhcpc.%iface///.%.pid; then kill -USR2 $(cat /run/udhcpc.%iface///.%.pid); kill -TERM $(cat /run/udhcpc.%iface///.%.pid); fi \ elsif (execable("udhcpc")) - dhcpcd -k %iface% \ + dhcpcd -k4 %iface% \ elsif (execable("dhcpcd")) echo 'No DHCP client software found!' >&2; false \ elsif (1) diff --git a/inet6.defn b/inet6.defn index d62123b..d1203e9 100644 --- a/inet6.defn +++ b/inet6.defn @@ -4,21 +4,23 @@ architecture linux method auto description This method may be used to define interfaces with automatically assigned - IPv6 addresses. Using this method on its own doesn't mean that RDNSS options - will be applied, too. To make this happen, *rdnssd* daemon must be installed, - properly configured and running. + IPv6 addresses with any of the tools: dhclient, dhcpcd. Using this method on + its own doesn't mean that RDNSS options will be applied, too. To make this + happen, *rdnssd* daemon must be installed, properly configured and running. If stateless DHCPv6 support is turned on, then additional network configuration parameters such as DNS and NTP servers will be retrieved from a DHCP server. Please note that on ifdown, the lease is not currently - released (a known bug). + released when using dhclient (a known bug). options privext int -- Privacy extensions (RFC4941) (0=off, 1=assign, 2=prefer) accept_ra int -- Accept router advertisements (0=off, 1=on, 2=on+forwarding) [2] dhcp int -- Use stateless DHCPv6 (0=off, 1=on) - request_prefix int -- Request a prefix through DHCPv6 Prefix Delegation (0=off, 1=on) [0] - ll-attempts -- Number of attempts to wait for a link-local address [60] - ll-interval -- Link-local address polling interval in seconds [0.1] + request_prefix int -- Request a prefix through DHCPv6 Prefix Delegation (dhclient: 0=off, 1=on, \ + dhcpcd: prefix delegation must be configured in /etc/dhcpcd.conf) [0] + ll-attempts -- Number of attempts to wait for a link-local address (dhclient) [60] + ll-interval -- Link-local address polling interval in seconds (dhclient) [0.1] + metric metric -- Metric for added routes (dhcpcd) up modprobe -q net-pf-10 > /dev/null 2>&1 || true # ignore failure. @@ -28,17 +30,21 @@ method auto ip addr flush dev %iface% mngtmpaddr \ if (var_set("accept_ra", ifd) && !var_true("accept_ra", ifd)) ip link set dev %iface% up - /lib/ifupdown/wait-for-ll6.sh if (var_true("dhcp", ifd) && execable("/lib/ifupdown/wait-for-ll6.sh")) + /lib/ifupdown/wait-for-ll6.sh if (var_true("dhcp", ifd) && execable("dhclient") && execable("/lib/ifupdown/wait-for-ll6.sh")) dhclient -6 -v -P -pf /run/dhclient6.%iface%.pid -lf /var/lib/dhcp/dhclient6.%iface%.leases -I -df /var/lib/dhcp/dhclient.%iface%.leases %iface% \ if (var_true("dhcp", ifd) && execable("dhclient") && var_true("request_prefix", ifd)) dhclient -6 -1 -v -S -pf /run/dhclient6.%iface%.pid -lf /var/lib/dhcp/dhclient6.%iface%.leases -I -df /var/lib/dhcp/dhclient.%iface%.leases %iface% \ elsif (var_true("dhcp", ifd) && execable("dhclient")) + dhcpcd -6 [[-m %metric%]] %iface% \ + elsif (var_true("dhcp", ifd) && execable("dhcpcd")) echo 'No DHCPv6 client software found!' >&2; false \ elsif (var_true("dhcp", ifd)) down dhclient -6 -v -r -pf /run/dhclient6.%iface%.pid -lf /var/lib/dhcp/dhclient6.%iface%.leases -I -df /var/lib/dhcp/dhclient.%iface%.leases %iface% \ if (var_true("dhcp", ifd) && execable("dhclient")) + dhcpcd -k6 %iface% \ + elsif (var_true("dhcp", ifd) && execable("dhcpcd")) echo 'No DHCPv6 client software found!' >&2; false \ elsif (var_true("dhcp", ifd)) ip -6 addr flush dev %iface% scope global @@ -136,16 +142,18 @@ method manual method dhcp description This method may be used to obtain network interface configuration via - stateful DHCPv6 with dhclient. In stateful DHCPv6, the DHCP server is - responsible for assigning addresses to clients. + stateful DHCPv6 with any of the tools: dhclient, dhcpcd. In stateful DHCPv6, + the DHCP server is responsible for assigning addresses to clients. options hwaddress address -- Hardware address or "random" accept_ra int -- Accept router advertisements (0=off, 1=on, 2=on+forwarding) [1] autoconf int -- Perform stateless autoconfiguration (0=off, 1=on) - request_prefix int -- Request a prefix through DHCPv6 Prefix Delegation (0=off, 1=on) [0] - ll-attempts -- Number of attempts to wait for a link-local address [60] - ll-interval -- Link-local address polling interval in seconds [0.1] + request_prefix int -- Request a prefix through DHCPv6 Prefix Delegation (dhclient: 0=off, 1=on, \ + dhcpcd: prefix delegation must be configured in /etc/dhcpcd.conf) [0] + ll-attempts -- Number of attempts to wait for a link-local address (dhclient) [60] + ll-interval -- Link-local address polling interval in seconds (dhclient) [0.1] + metric metric -- Metric for added routes (dhcpcd) conversion hwaddress cleanup_hwaddress @@ -157,17 +165,21 @@ method dhcp ip addr flush dev %iface% mngtmpaddr \ if (var_set("accept_ra", ifd) && !var_true("accept_ra", ifd)) ip link set dev %iface% [[address %hwaddress%]] up - /lib/ifupdown/wait-for-ll6.sh if (execable("/lib/ifupdown/wait-for-ll6.sh")) + /lib/ifupdown/wait-for-ll6.sh if (execable("dhclient") && execable("/lib/ifupdown/wait-for-ll6.sh")) dhclient -6 -v -pf /run/dhclient6.%iface%.pid -lf /var/lib/dhcp/dhclient6.%iface%.leases -I -P -N -df /var/lib/dhcp/dhclient.%iface%.leases %iface% \ if (execable("dhclient") && var_true("request_prefix", ifd)) dhclient -6 -v -pf /run/dhclient6.%iface%.pid -lf /var/lib/dhcp/dhclient6.%iface%.leases -I -df /var/lib/dhcp/dhclient.%iface%.leases %iface% \ elsif (execable("dhclient")) + dhcpcd -6 [[-m %metric%]] %iface% \ + elsif (execable("dhcpcd")) echo 'No DHCPv6 client software found!' >&2; false \ elsif (1) down dhclient -6 -v -r -pf /run/dhclient6.%iface%.pid -lf /var/lib/dhcp/dhclient6.%iface%.leases -I -df /var/lib/dhcp/dhclient.%iface%.leases %iface% \ if (execable("dhclient")) + dhcpcd -k6 %iface% \ + elsif (execable("dhcpcd")) echo 'No DHCPv6 client software found!' >&2; false \ elsif (1) @@ -322,9 +334,9 @@ method manual method auto description This method may be used to define interfaces with automatically assigned - IPv6 addresses. Using this method on its own doesn't mean that RDNSS options - will be applied, too. To make this happen, *rdnssd* daemon must be installed, - properly configured and running. + IPv6 addresses with any of the tools: dhclient, dhcpcd. Using this method on + its own doesn't mean that RDNSS options will be applied, too. To make this + happen, *rdnssd* daemon must be installed, properly configured and running. If stateless DHCPv6 support is turned on, then additional network configuration parameters such as DNS and NTP servers will be retrieved from a DHCP server. Please note that on ifdown, the lease is not currently @@ -340,6 +352,8 @@ method auto ifconfig %iface% inet6 accept_rtadv up dhclient -6 -S -pf /run/dhclient6.%iface%.pid -lf /var/lib/dhcp/dhclient6.%iface%.leases -I -df /var/lib/dhcp/dhclient.%iface%.leases %iface% \ if (var_true("dhcp", ifd) && execable("dhclient")) + dhcpcd -6 %iface% \ + elsif (var_true("dhcp", ifd) && execable("dhcpcd")) echo 'No DHCPv6 client software found!' >&2; false \ elsif (var_true("dhcp", ifd)) @@ -351,8 +365,8 @@ method auto method dhcp description This method may be used to obtain network interface configuration via - stateful DHCPv6 with dhclient. In stateful DHCPv6, the DHCP server is - responsible for assigning addresses to clients. + stateful DHCPv6 with any of the tools: dhclient, dhcpcd. In stateful DHCPv6, + the DHCP server is responsible for assigning addresses to clients. options hwaddress address -- Hardware address or "random" @@ -364,12 +378,16 @@ method dhcp ifconfig %iface% [[link %hwaddress%]] up dhclient -6 -pf /run/dhclient6.%iface%.pid -lf /var/lib/dhcp/dhclient6.%iface%.leases -I -df /var/lib/dhcp/dhclient.%iface%.leases %iface% \ if (execable("dhclient")) + dhcpcd -6 %iface% \ + elsif (execable("dhcpcd")) echo 'No DHCPv6 client software found!' >&2; false \ elsif (1) down dhclient -6 -r -pf /run/dhclient6.%iface%.pid -lf /var/lib/dhcp/dhclient6.%iface%.leases -I -df /var/lib/dhcp/dhclient.%iface%.leases %iface% \ if (execable("dhclient")) + dhcpcd -k6 %iface% \ + elsif (execable("dhcpcd")) echo 'No DHCPv6 client software found!' >&2; false \ elsif (1) @@ -422,8 +440,8 @@ method manual method dhcp description This method may be used to obtain network interface configuration via - stateful DHCPv6 with dhclient. In stateful DHCPv6, the DHCP server is - responsible for assigning addresses to clients. + stateful DHCPv6 with any of the tools: dhclient, dhcpcd. In stateful DHCPv6, + the DHCP server is responsible for assigning addresses to clients. options hwaddress address -- Hardware address (Not yet supported) @@ -436,12 +454,16 @@ method dhcp inetutils-ifconfig --interface %iface% --up dhclient -6 -pf /run/dhclient6.%iface///.%.pid -lf /var/lib/dhcp/dhclient6.%iface///.%.leases -I -df /var/lib/dhcp/dhclient.%iface///.%.leases %iface% \ if (execable("dhclient")) + dhcpcd -6 %iface% \ + elsif (execable("dhcpcd")) echo 'No DHCPv6 client software found!' >&2; false \ elsif (1) down dhclient -6 -r -pf /run/dhclient6.%iface///.%.pid -lf /var/lib/dhcp/dhclient6.%iface///.%.leases -I -df /var/lib/dhcp/dhclient.%iface///.%.leases %iface% \ if (execable("dhclient")) + dhcpcd -k6 %iface% \ + elsif (execable("dhcpcd")) echo 'No DHCPv6 client software found!' >&2; false \ elsif (1)