]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Only set if_up for a ROUTERADVERT if we have any RAs
authorRoy Marples <roy@marples.name>
Sun, 29 Jan 2012 16:45:14 +0000 (16:45 +0000)
committerRoy Marples <roy@marples.name>
Sun, 29 Jan 2012 16:45:14 +0000 (16:45 +0000)
Conversely, we need to pretend it's up without any RAs to successfully
remove it.

dhcpcd-hooks/20-resolv.conf
dhcpcd-run-hooks.in

index 13af0d59172995bca7d35af42a3bc9bc231f0902..baa18d2de7cb069d6da8145382ce53c45d8a3b4d 100644 (file)
@@ -12,7 +12,7 @@ NL="
 
 build_resolv_conf()
 {
-       local cf="$state_dir/resolv.conf.$interface$ifsuffix"
+       local cf="$state_dir/resolv.conf.$interface$if_suffix"
        local interfaces= header= search= srvs= servers= x=
 
        # Build a list of interfaces
@@ -114,37 +114,31 @@ add_resolv_conf()
        done
        if type resolvconf >/dev/null 2>&1; then
                [ -n "$ifmetric" ] && export IF_METRIC="$ifmetric"
-               printf %s "$conf" | resolvconf -a "$interface$ifsuffix"
+               printf %s "$conf" | resolvconf -a "$interface$if_suffix"
                return $?
        fi
 
-       if [ -e "$resolv_conf_dir/$interface$ifsuffix" ]; then
-               rm -f "$resolv_conf_dir/$interface$ifsuffix"
+       if [ -e "$resolv_conf_dir/$interface$if_suffix" ]; then
+               rm -f "$resolv_conf_dir/$interface$if_suffix"
        fi
        [ -d "$resolv_conf_dir" ] || mkdir -p "$resolv_conf_dir"
-       printf %s "$conf" > "$resolv_conf_dir/$interface$ifsuffix"
+       printf %s "$conf" > "$resolv_conf_dir/$interface$if_suffix"
        build_resolv_conf
 }
 
 remove_resolv_conf()
 {
        if type resolvconf >/dev/null 2>&1; then
-               resolvconf -d "$interface$ifsuffix" -f
+               resolvconf -d "$interface$if_suffix" -f
        else
-               if [ -e "$resolv_conf_dir/$interface$ifsuffix" ]; then
-                       rm -f "$resolv_conf_dir/$interface$ifsuffix"
+               if [ -e "$resolv_conf_dir/$interface$if_suffix" ]; then
+                       rm -f "$resolv_conf_dir/$interface$if_suffix"
                fi
                build_resolv_conf
        fi
 }
 
-if [ "$reason" = ROUTERADVERT ]; then
-       ifsuffix=":ra"
-else
-       ifsuffix=
-fi
-
-if $if_up; then
+if $if_up || [ "$reason" = ROUTERADVERT ]; then
        add_resolv_conf
 elif $if_down; then
        remove_resolv_conf
index 8e594709d8f6c829be96ae01555f2d74e2145896..c97657937ed3c24b95014d6026bfc606eca43e6f 100644 (file)
@@ -16,7 +16,12 @@ BOUND|INFORM|REBIND|REBOOT|RENEW|TIMEOUT|STATIC)     if_up=true;;
 PREINIT|EXPIRE|FAIL|IPV4LL|NAK|NOCARRIER|RELEASE|STOP) if_down=true;;
 esac
 
-[ "$reason" = ROUTERADVERT -a "$new_ra_count" != 0 ] && if_up=true
+if [ "$reason" = ROUTERADVERT ]; then
+       if_suffix=":ra"
+       [ "$new_ra_count" != 0 ] && if_up=true
+else
+       if_suffix=
+fi
 
 # Ensure that all arguments are unique
 uniqify()