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:
parent
426eff6569
commit
0a6c82e855
1 changed files with 23 additions and 7 deletions
|
@ -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
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue