1 # Configure the MTU for the interface
3 mtu_dir="$state_dir/mtu"
5 if [ "$reason" = PREINIT -a -e "$mtu_dir/$interface" ]; then
6 rm "$mtu_dir/$interface"
7 elif [ "$reason" != TEST -a -n "$new_interface_mtu" ]; then
8 # The smalled MTU dhcpcd can work with is 576
9 if [ "$new_interface_mtu" -ge 576 ]; then
10 if ifconfig "$interface" mtu "$new_interface_mtu"; then
11 syslog info "$interface: MTU set to $new_interface_mtu"
12 # Save the MTU so we can restore it later
13 if [ ! -e "$mtu_dir/$interface" ]; then
15 echo "$ifmtu" > "$mtu_dir/$interface"
19 elif [ "$reason" != TEST -a -e "$mtu_dir/$interface" ]; then
20 # No MTU in this state, so restore the prior MTU
21 mtu=$(cat "$mtu_dir/$interface")
22 syslog info "$interface: MTU restored to $mtu"
23 ifconfig "$interface" mtu "$mtu"
24 rm "$mtu_dir/$interface"