mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-03-09 15:40:03 +00:00
Set MTU only if not already set
This commit is contained in:
parent
77b071dd02
commit
70edb5abaa
1 changed files with 15 additions and 8 deletions
|
@ -224,23 +224,30 @@ fi
|
|||
}
|
||||
|
||||
# Save wan settings for status page
|
||||
if [ "$(uci -q get openmptcprouter.$OMR_TRACKER_INTERFACE.omr_lc)" = "" ] || [ $(($(date +"%s") - $(uci -q get openmptcprouter.$OMR_TRACKER_INTERFACE.omr_lc))) -gt 3600 ]; then
|
||||
if [ "$(uci -q get openmptcprouter.$OMR_TRACKER_INTERFACE.lc)" = "" ] || [ $(($(date +"%s") - $(uci -q get openmptcprouter.$OMR_TRACKER_INTERFACE.lc))) -gt 3600 ]; then
|
||||
local ipaddr="$(omr-ip-intf $OMR_TRACKER_DEVICE)"
|
||||
[ -n "$ipaddr" ] && {
|
||||
local asn="$(wget -4 -qO- -T 5 http://api.iptoasn.com/v1/as/ip/$ipaddr | jsonfilter -e '@.as_description')"
|
||||
local serverip=$(uci -q get shadowsocks-libev.sss0.server)
|
||||
uci -q set openmptcprouter.$OMR_TRACKER_INTERFACE.mptcp_status="$(omr-tracebox-mptcp $serverip $OMR_TRACKER_DEVICE)"
|
||||
uci -q set openmptcprouter.$OMR_TRACKER_INTERFACE.publicip="$ipaddr"
|
||||
uci -q set openmptcprouter.$OMR_TRACKER_INTERFACE.latency="$OMR_TRACKER_LATENCY"
|
||||
[ -n "$asn" ] && {
|
||||
uci -q set openmptcprouter.$OMR_TRACKER_INTERFACE.asn="$asn"
|
||||
}
|
||||
local mtu=$(omr-mtu $OMR_TRACKER_DEVICE_IP $serverip)
|
||||
[ -n "$mtu" ] && {
|
||||
uci -q set openmptcprouter.$OMR_TRACKER_INTERFACE.mtu=$mtu
|
||||
ip link set dev $OMR_TRACKER_DEVICE mtu $mtu > /dev/null 2>&1
|
||||
}
|
||||
[ -n "$mtu" ] && [ -n "$asn" ] && {
|
||||
if [ "$(uci -q get network.$OMR_TRACKER_INTERFACE.mtu)" = "" ]; then
|
||||
local mtu=$(omr-mtu $OMR_TRACKER_DEVICE_IP $serverip)
|
||||
[ -n "$mtu" ] && {
|
||||
uci -q set openmptcprouter.$OMR_TRACKER_INTERFACE.mtu=$mtu
|
||||
ip link set dev $OMR_TRACKER_DEVICE mtu $mtu > /dev/null 2>&1
|
||||
}
|
||||
[ -n "$mtu" ] && [ -n "$asn" ] && {
|
||||
uci -q set openmptcprouter.$OMR_TRACKER_INTERFACE.lc=$(date +"%s")
|
||||
}
|
||||
elif [ -n "$asn" ]; then
|
||||
uci -q set openmptcprouter.$OMR_TRACKER_INTERFACE.mtu=$(uci -q get network.$OMR_TRACKER_INTERFACE.mtu)
|
||||
uci -q set openmptcprouter.$OMR_TRACKER_INTERFACE.lc=$(date +"%s")
|
||||
}
|
||||
fi
|
||||
uci -q commit openmptcprouter
|
||||
}
|
||||
fi
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue