From 0a6c82e85522d111c6b82e61c826731ef6b00c15 Mon Sep 17 00:00:00 2001 From: "Ycarus (Yannick Chabanois)" Date: Tue, 17 Nov 2020 11:10:20 +0100 Subject: [PATCH] Better max metric calculation --- mptcp/files/etc/init.d/mptcp | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/mptcp/files/etc/init.d/mptcp b/mptcp/files/etc/init.d/mptcp index 9f0db4286..ee8027b05 100755 --- a/mptcp/files/etc/init.d/mptcp +++ b/mptcp/files/etc/init.d/mptcp @@ -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 }