From: Roy Marples Date: Thu, 6 Jul 2017 16:13:51 +0000 (+0100) Subject: Unset $ifsuffix for non protocol reasons X-Git-Tag: v7.0.0-rc2~29 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=986ee6973816d7ad6e17c7b19fa04826da85cc64;p=thirdparty%2Fdhcpcd.git Unset $ifsuffix for non protocol reasons Summary: The default was to assume unspecified reasons were DHCP. This is bad for non protocol events such as NOCARRIER which could cause a dhcpcd instance running IPv6 only to wipe out the DNS records created by a separate dhcpcd instance handling IPv4. Fixes T129. Test Plan: Start `dhcpcd -4 -K eth0`. Observe that a resolvconf entry is created for eth0.dhcp. Start `dhcpcd -6 eth0`. Observe that a resolvconf entry is created for eth0.dhcp6. Bring the carrier down for eth0. Because the -4 instance is ignoring carrier, it is expected that the eth0.dhcp resolvconf entry is preserved. Maniphest Tasks: T129 Differential Revision: https://dev.marples.name/D124 --- diff --git a/hooks/dhcpcd-run-hooks.in b/hooks/dhcpcd-run-hooks.in index 4490fa9b..ba882abb 100644 --- a/hooks/dhcpcd-run-hooks.in +++ b/hooks/dhcpcd-run-hooks.in @@ -3,14 +3,18 @@ # Handy variables and functions for our hooks to use case "$reason" in + PREINIT|CARRIER|NOCARRIER|DEPARTED|STOPPED|DUMP|TEST) + ifsuffix=;; #unset ROUTERADVERT) ifsuffix=".ra";; INFORM6|BOUND6|RENEW6|REBIND6|REBOOT6|EXPIRE6|RELEASE6|STOP6) ifsuffix=".dhcp6";; IPV4LL) ifsuffix=".ipv4ll";; - *) + INFORM|BOUND|RENEW|REBIND|REBOOT|EXPIRE|RELEASE|STOP) ifsuffix=".dhcp";; + *) + ifsuffix=;; #unset esac ifname="$interface$ifsuffix"