]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Log the MTU changes.
authorRoy Marples <roy@marples.name>
Sat, 4 Jul 2009 00:03:01 +0000 (00:03 +0000)
committerRoy Marples <roy@marples.name>
Sat, 4 Jul 2009 00:03:01 +0000 (00:03 +0000)
dhcpcd-hooks/10-mtu
dhcpcd-run-hooks.in

index a9f874d8c77cf80a8cb897fdddf2bf9a25af8118..fa82b753bb1536ac0247f278d7501e80ff628ce2 100644 (file)
@@ -8,6 +8,7 @@ elif [ -n "$new_interface_mtu" ]; 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
+                       syslog info "$interface: MTU set to $new_interface_mtu"
                        # Save the MTU so we can restore it later
                        if [ ! -e "$mtu_dir/$interface" ]; then
                                mkdir -p "$mtu_dir"
@@ -17,6 +18,8 @@ elif [ -n "$new_interface_mtu" ]; then
        fi
 elif [ -e "$mtu_dir/$interface" ]; then
        # No MTU in this state, so restore the prior MTU
-       ifconfig "$interface" mtu $(cat "$mtu_dir/$interface")
+       mtu=$(cat "$mtu_dir/$interface")
+       syslog info "$interface: MTU restored to $mtu"
+       ifconfig "$interface" mtu "$mtu"
        rm "$mtu_dir/$interface"
 fi
index f9fc1efe67957d7bb32e794229b52416650f48c1..5a50d0e8aa20df25b36dde790632a7f52a95d3da 100644 (file)
@@ -125,6 +125,19 @@ restore_conf()
        rm -f "$1-pre.$interface"
 }
 
+# Write a syslog entry
+syslog()
+{
+       local lvl="$1"
+
+       [ -n "$lvl" ] && shift
+       if [ -n "$@" ]; then
+               if type logger >/dev/null 2>&1; then
+                       logger -t dhcpcd -p daemon."$lvl" -s "$@"
+               fi
+       fi
+}
+
 
 # We source each script into this one so that scripts run earlier can
 # remove variables from the environment so later scripts don't see them.