]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Improve scripts for DUMP
authorRoy Marples <roy@marples.name>
Tue, 24 Aug 2010 10:18:31 +0000 (10:18 +0000)
committerRoy Marples <roy@marples.name>
Tue, 24 Aug 2010 10:18:31 +0000 (10:18 +0000)
dhcpcd-hooks/10-mtu
dhcpcd-hooks/50-ypbind

index 3f6e1750b2ab9422e335bbb4af361802c0b982af..639697c916e1a2543a3da8a52c4c2ef59c57d7f0 100644 (file)
@@ -4,7 +4,7 @@ mtu_dir="$state_dir/mtu"
 
 if [ "$reason" = PREINIT -a -e "$mtu_dir/$interface" ]; then
        rm "$mtu_dir/$interface"
-elif [ "$reason" != TEST -a -n "$new_interface_mtu" ]; then
+elif [ -n "$new_interface_mtu" ] && $if_up; then
        # The smalled MTU dhcpcd can work with is 576
        if [ "$new_interface_mtu" -ge 576 ]; then
                if ifconfig "$interface" mtu "$new_interface_mtu"; then
@@ -16,10 +16,12 @@ elif [ "$reason" != TEST -a -n "$new_interface_mtu" ]; then
                        fi
                fi
        fi
-elif [ "$reason" != TEST -a -e "$mtu_dir/$interface" ]; then
-       # No MTU in this state, so restore the prior MTU
-       mtu=$(cat "$mtu_dir/$interface")
-       syslog info "$interface: MTU restored to $mtu"
-       ifconfig "$interface" mtu "$mtu"
-       rm "$mtu_dir/$interface"
+elif [ -e "$mtu_dir/$interface" ]; then
+       if $if_up || $if_down; then
+               # No MTU in this state, so restore the prior MTU
+               mtu=$(cat "$mtu_dir/$interface")
+               syslog info "$interface: MTU restored to $mtu"
+               ifconfig "$interface" mtu "$mtu"
+               rm "$mtu_dir/$interface"
+       fi
 fi
index 3d56946759f6cf6437a8d3eddf863cdd3c405008..3e569c73c6582e74034479492ca865c1a533fef6 100644 (file)
@@ -70,17 +70,12 @@ restore_yp_binding()
        fi
 }
 
-case "$reason" in
-PREINIT)
+if [ "$reason" = PREINIT ]; then
        rm -f "$ypbind_dir/$interface"
-       ;;
-TEST)
-       ;;
-*)
+else if $if_up || $if_down; then
        if [ -n "$new_nis_domain" ]; then
                make_yp_binding
        elif [ -n "$old_nis_domain" ]; then
                restore_yp_binding
        fi
-       ;;
-esac
+fi