comparison hooks/20-resolv.conf @ 5572:aae13416e9b7 draft

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.
author Roy Marples <roy@marples.name>
date Sun, 27 Dec 2020 22:31:02 +0000
parents 4fe5c2a71254
children
comparison
equal deleted inserted replaced
5571:fb1831c903f6 5572:aae13416e9b7
5 # can readily hook into it. 5 # can readily hook into it.
6 # Also, resolvconf can configure local nameservers such as bind 6 # Also, resolvconf can configure local nameservers such as bind
7 # or dnsmasq. This is important as the libc resolver isn't that powerful. 7 # or dnsmasq. This is important as the libc resolver isn't that powerful.
8 8
9 resolv_conf_dir="$state_dir/resolv.conf" 9 resolv_conf_dir="$state_dir/resolv.conf"
10 nocarrier_roaming_dir="$state_dir/roaming"
10 NL=" 11 NL="
11 " 12 "
12 : ${resolvconf:=resolvconf} 13 : ${resolvconf:=resolvconf}
13 if type "$resolvconf" >/dev/null 2>&1; then 14 if type "$resolvconf" >/dev/null 2>&1; then
14 have_resolvconf=true 15 have_resolvconf=true
203 ;; 204 ;;
204 esac 205 esac
205 206
206 if $if_configured; then 207 if $if_configured; then
207 if $have_resolvconf && [ "$reason" = NOCARRIER_ROAMING ]; then 208 if $have_resolvconf && [ "$reason" = NOCARRIER_ROAMING ]; then
209 # avoid calling resolvconf -c on CARRIER unless we roam
210 mkdir -p "$nocarrier_roaming_dir"
211 echo " " >"$nocarrier_roaming_dir/$interface"
208 "$resolvconf" -C "$interface.*" 212 "$resolvconf" -C "$interface.*"
209 elif $have_resolvconf && [ "$reason" = CARRIER ]; then 213 elif $have_resolvconf && [ "$reason" = CARRIER ]; then
210 "$resolvconf" -c "$interface.*" 214 # Not all resolvconf implementations support -c
215 if [ -e "$nocarrier_roaming_dir/$interface" ]; then
216 rm -f "$nocarrier_roaming_dir/$interface"
217 "$resolvconf" -c "$interface.*"
218 fi
211 elif $if_up || [ "$reason" = ROUTERADVERT ]; then 219 elif $if_up || [ "$reason" = ROUTERADVERT ]; then
212 add_resolv_conf 220 add_resolv_conf
213 elif $if_down; then 221 elif $if_down; then
214 remove_resolv_conf 222 remove_resolv_conf
215 fi 223 fi