diff options
| author | Roy Marples <roy@marples.name> | 2020-12-27 22:31:02 +0000 |
|---|---|---|
| committer | Roy Marples <roy@marples.name> | 2020-12-27 22:33:11 +0000 |
| commit | 6468e7f2c01ace7a24039cc7bd9b12142ce063a0 (patch) | |
| tree | 6ad940207c4812dc1263e2e45b89b52482a407b4 | |
| parent | 4b2668b9e24c118c0f68feec083950591f6e3f51 (diff) | |
| download | dhcpcd-6468e7f2c01ace7a24039cc7bd9b12142ce063a0.tar.xz | |
20-resolv.conf: Don't call resolvconf -c if we didn't call -C
This solves the warnings on all OS other than Linux who don't have
a supporting resolvconf for deprecating DNS because they never
emit the NOCARRIER_ROAMING reason.
| -rw-r--r-- | hooks/20-resolv.conf | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/hooks/20-resolv.conf b/hooks/20-resolv.conf index 86f4873d..504a6c53 100644 --- a/hooks/20-resolv.conf +++ b/hooks/20-resolv.conf @@ -7,6 +7,7 @@ # or dnsmasq. This is important as the libc resolver isn't that powerful. resolv_conf_dir="$state_dir/resolv.conf" +nocarrier_roaming_dir="$state_dir/roaming" NL=" " : ${resolvconf:=resolvconf} @@ -205,9 +206,16 @@ esac if $if_configured; then if $have_resolvconf && [ "$reason" = NOCARRIER_ROAMING ]; then + # avoid calling resolvconf -c on CARRIER unless we roam + mkdir -p "$nocarrier_roaming_dir" + echo " " >"$nocarrier_roaming_dir/$interface" "$resolvconf" -C "$interface.*" elif $have_resolvconf && [ "$reason" = CARRIER ]; then - "$resolvconf" -c "$interface.*" + # Not all resolvconf implementations support -c + if [ -e "$nocarrier_roaming_dir/$interface" ]; then + rm -f "$nocarrier_roaming_dir/$interface" + "$resolvconf" -c "$interface.*" + fi elif $if_up || [ "$reason" = ROUTERADVERT ]; then add_resolv_conf elif $if_down; then |
