1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-02-15 03:51:51 +00:00

Better max metric calculation

This commit is contained in:
Ycarus (Yannick Chabanois) 2020-11-17 11:10:20 +01:00 committed by suyuan
parent 426eff6569
commit 0a6c82e855

View file

@ -48,13 +48,29 @@ interface_macaddr_count() {
interface_max_metric() {
local config="$1"
config_get metric "$config" metric
if [ "$metric" = "$count" ]; then
count=$((count+1))
config_set "$config" metric $count
fi
if [ "$metric" -gt "$count" ]; then
count=$metric
if [ "$1" != "omrvpn" ] && [ "$1" != "omr6in4" ]; then
config_get metric "$config" metric
if [ "$metric" = "$count" ]; then
count=$((count+1))
config_set "$config" metric $count
fi
if [ "$metric" -gt "$count" ]; then
count=$metric
fi
elif [ "$1" = "omrvpn" ]; then
uci -q batch <<-EOF >/dev/null
set network.${config}.metric=1200
commit network
set openmptcprouter.${config}.metric=1200
commit openmptcprouter
EOF
elif [ "$1" = "omr6in4" ]; then
uci -q batch <<-EOF >/dev/null
set network.${config}.metric=1201
commit network
set openmptcprouter.${config}.metric=1201
commit openmptcprouter
EOF
fi
}