История изменений
Исправление
why,
(текущая версия)
:
вот до чего сверхразум пока смог додуматься
#!/bin/sh
get_mtu_static () {
local IF=$1
unset MTU
ip neigh show dev $IF | grep -ci xx:xx:xx:xx:xx:xx && MTU=2000 #home
ip neigh show dev $IF | grep -ci xx:xx:xx:xx:xx:xx && MTU=1500 #cafe
}
for IF in wlp4s0 enp5s0 # $(ls /sys/class/net/)
do
if [ "1" -eq "$(cat /sys/class/net/$IF/type)" ]
then
unset MTU
get_mtu_static $IF
if [ -z "$MTU" ]
then
if [ "wlp4s0" == "$IF" ]
then
MTU=2262
fi
if [ "enp5s0" == "$IF" ]
then
MTU=9000
fi
fi
if [ ! -z "$MTU" ]
then
if [ "$MTU" -ne "$(cat /sys/class/net/$IF/mtu)" ]
then
ip link set $IF mtu $MTU
fi
fi
fi
done
Исходная версия
why,
:
вот до чего сверхразум пока смог додуматься
#!/bin/sh
get_mtu_static () {
local IF=$1
unset MTU
ip neigh show dev $IF | grep -ci xx:xx:xx:xx:xx:xx && MTU=2000 #home
ip neigh show dev $IF | grep -ci xx:xx:xx:xx:xx:xx && MTU=1500 #cafe
}
for IF in wlp4s0 enp5s0 # $(ls /sys/class/net/)
do
if [ "1" -eq "$(cat /sys/class/net/$IF/type)" ]
then
unset MTU
get_mtu_static $IF
if [ -z "$MTU" ]
then
if [ "wlp4s0" == "$IF" ]
then
MTU=2262
fi
if [ "enp5s0" == "$IF" ]
then
MTU=9000
fi
fi
if [ ! -z "$MTU" ]
then
if [ "$MTU" -ne "$(cat /sys/class/net/$IF/mtu)" ]
then
ip link set $IF mtu $MTU_RETURN
fi
fi
fi
done