summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2020-12-27 22:31:02 +0000
committerRoy Marples <roy@marples.name>2020-12-27 22:33:11 +0000
commitbf1529adfad079df9e80e6988d3c493fc04d1084 (patch)
tree6ad940207c4812dc1263e2e45b89b52482a407b4
parentb4d4f08872b08b9e93435fac1e40b11d1802c91e (diff)
downloaddhcpcd-bf1529adfad079df9e80e6988d3c493fc04d1084.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.conf10
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