diff options
| author | Roy Marples <roy@marples.name> | 2009-07-04 00:03:01 +0000 |
|---|---|---|
| committer | Roy Marples <roy@marples.name> | 2009-07-04 00:03:01 +0000 |
| commit | 264b8c30c28a6ec6dc5d12966154611fe0e27fc1 (patch) | |
| tree | 3cbcb7566b79ab7d66c45165d389e64586f3bb8c | |
| parent | 62009c79586ff8465dfe6d91258aa0af527b0421 (diff) | |
| download | dhcpcd-264b8c30c28a6ec6dc5d12966154611fe0e27fc1.tar.xz | |
Log the MTU changes.
| -rw-r--r-- | dhcpcd-hooks/10-mtu | 5 | ||||
| -rw-r--r-- | dhcpcd-run-hooks.in | 13 |
2 files changed, 17 insertions, 1 deletions
diff --git a/dhcpcd-hooks/10-mtu b/dhcpcd-hooks/10-mtu index a9f874d8..fa82b753 100644 --- a/dhcpcd-hooks/10-mtu +++ b/dhcpcd-hooks/10-mtu @@ -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 diff --git a/dhcpcd-run-hooks.in b/dhcpcd-run-hooks.in index f9fc1efe..5a50d0e8 100644 --- a/dhcpcd-run-hooks.in +++ b/dhcpcd-run-hooks.in @@ -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. |
