diff options
| author | Roy Marples <roy@marples.name> | 2012-01-29 16:45:14 +0000 |
|---|---|---|
| committer | Roy Marples <roy@marples.name> | 2012-01-29 16:45:14 +0000 |
| commit | b1a20121fbd29597d81b0b6b2157a08aa58c0ec0 (patch) | |
| tree | 36731fd42f7ae6f6431b9bca565c841b03c9f44d | |
| parent | 0c6ad7828843227c2e377ef3fa206f437e472a5a (diff) | |
| download | dhcpcd-b1a20121fbd29597d81b0b6b2157a08aa58c0ec0.tar.xz | |
Only set if_up for a ROUTERADVERT if we have any RAs
Conversely, we need to pretend it's up without any RAs to successfully
remove it.
| -rw-r--r-- | dhcpcd-hooks/20-resolv.conf | 24 | ||||
| -rw-r--r-- | dhcpcd-run-hooks.in | 7 |
2 files changed, 15 insertions, 16 deletions
diff --git a/dhcpcd-hooks/20-resolv.conf b/dhcpcd-hooks/20-resolv.conf index 13af0d59..baa18d2d 100644 --- a/dhcpcd-hooks/20-resolv.conf +++ b/dhcpcd-hooks/20-resolv.conf @@ -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 diff --git a/dhcpcd-run-hooks.in b/dhcpcd-run-hooks.in index 8e594709..c9765793 100644 --- a/dhcpcd-run-hooks.in +++ b/dhcpcd-run-hooks.in @@ -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() |
