mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-05-01 07:50:23 +02:00
some nic's like Intel e1000e needs a reinit to change the mtu. In this case the dhcp hook reinit the nic and terminate now to let the dhcpcd reinit the card in backgrounnd without running the rest of the hooks. Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
34 lines
828 B
Plaintext
34 lines
828 B
Plaintext
# Configure the MTU for the interface
|
|
|
|
eval $(/usr/local/bin/readhash /var/ipfire/ethernet/settings)
|
|
|
|
set_mtu()
|
|
{
|
|
local mtu=$1
|
|
ip link set "$interface" mtu "$mtu"
|
|
|
|
# test for buggy nic that lose link at mtu set...
|
|
carrier=`cat /sys/class/net/$interface/carrier`
|
|
if [ "$carrier" == "0" ]; then
|
|
syslog info "Warning! Carrier loss after MTU set. Reinit needed..."
|
|
ip link set "$interface" down
|
|
ip link set "$interface" up
|
|
exit 1
|
|
fi
|
|
}
|
|
|
|
if [ -n "$new_interface_mtu" ] && $if_up; then
|
|
if [ $RED_DHCP_FORCE_MTU -ge 576 ]; then
|
|
new_interface_mtu=$RED_DHCP_FORCE_MTU
|
|
fi
|
|
if [ ! "$new_interface_mtu" == "$ifmtu" ]; then
|
|
# The smalled MTU dhcpcd can work with is 576
|
|
if [ "$new_interface_mtu" -gt 576 ]; then
|
|
if set_mtu "$new_interface_mtu"; then
|
|
syslog info "MTU set to $new_interface_mtu"
|
|
fi
|
|
fi
|
|
fi
|
|
fi
|
|
|