From a26255203e4a48eb6fd6f9cf9a016f313b416c6c Mon Sep 17 00:00:00 2001 From: "Ycarus (Yannick Chabanois)" Date: Fri, 22 Nov 2024 09:46:07 +0100 Subject: [PATCH 1/4] Disable 9998 metric set when Multipath off --- mptcp/files/etc/init.d/mptcp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mptcp/files/etc/init.d/mptcp b/mptcp/files/etc/init.d/mptcp index dbaa90b038..7983ec0ccd 100755 --- a/mptcp/files/etc/init.d/mptcp +++ b/mptcp/files/etc/init.d/mptcp @@ -139,8 +139,8 @@ interface_multipath_settings() { metric="1500" elif [ "${config}" = "omr6in4" ]; then metric="1201" - elif [ "$(uci -q get network.${config}.multipath)" = "off" ]; then - metric="9998" +# elif [ "$(uci -q get network.${config}.multipath)" = "off" ]; then +# metric="9998" fi config_set "$config" metric $metric uci -q set network.${config}.metric=$metric From 591b89c551898235f93e815748364d2664d5ae65 Mon Sep 17 00:00:00 2001 From: "Ycarus (Yannick Chabanois)" Date: Fri, 22 Nov 2024 09:46:39 +0100 Subject: [PATCH 2/4] Force eth0 on LAN for banana-pi R3 --- openmptcprouter/files/etc/uci-defaults/1920-omr-network | 2 ++ 1 file changed, 2 insertions(+) diff --git a/openmptcprouter/files/etc/uci-defaults/1920-omr-network b/openmptcprouter/files/etc/uci-defaults/1920-omr-network index dd5ce04d89..96b3943efa 100755 --- a/openmptcprouter/files/etc/uci-defaults/1920-omr-network +++ b/openmptcprouter/files/etc/uci-defaults/1920-omr-network @@ -107,6 +107,8 @@ if [ "$(grep rockchip /etc/os-release)" != "" ]; then lanif="eth1" elif [ "$(grep filogic /etc/os-release)" != "" ]; then lanif="eth1" +elif [ "$(cat /etc/board.json | jsonfilter -q -e '@.model.id' | tr -d '\n')" = "bananapi_bpi-r3" ]; then + lanif="eth0" elif [ -d /sys/class/net/lan0 -o -n "$(ip link | grep ' lan0')" ] && [ -d /sys/class/net/wan -o -n "$(ip link | grep ' wan@')" -o -n "$(ip link | grep ' wan:')" ]; then lanif="wan" elif [ -d /sys/class/net/lan1 -o -n "$(ip link | grep ' lan1')" ] && [ -d /sys/class/net/wan -o -n "$(ip link | grep ' wan@')" -o -n "$(ip link | grep ' wan:')" ]; then From f9e4c3cf0ec4f1b405b55246ec318020f8b04fdc Mon Sep 17 00:00:00 2001 From: "Ycarus (Yannick Chabanois)" Date: Fri, 22 Nov 2024 11:16:38 +0100 Subject: [PATCH 3/4] Fix mptcp BPF scheduler --- mptcp/files/etc/init.d/mptcp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mptcp/files/etc/init.d/mptcp b/mptcp/files/etc/init.d/mptcp index 7983ec0ccd..0a5ad56f2f 100755 --- a/mptcp/files/etc/init.d/mptcp +++ b/mptcp/files/etc/init.d/mptcp @@ -72,7 +72,7 @@ global_multipath_settings() { for scheduler in $(ls -1 /usr/share/bpf/scheduler/*.o); do bpftool struct_ops register $scheduler >/dev/null 2>&1 done - sysctl -qew net.mptcp.scheduler="$(echo $mptcp_scheduler | sed 's/mptcp_//' 's/.o//')" >/dev/null 2>&1 + sysctl -qew net.mptcp.scheduler="$(echo $mptcp_scheduler | sed -e 's/mptcp_//' -e 's/.o//')" >/dev/null 2>&1 fi fi [ -z "$congestion" ] || sysctl -qew net.ipv4.tcp_congestion_control="$congestion" From 660e84c205573b3a1b8cb1ca5305518870bfdc02 Mon Sep 17 00:00:00 2001 From: "Ycarus (Yannick Chabanois)" Date: Fri, 22 Nov 2024 12:01:30 +0100 Subject: [PATCH 4/4] Add routes for all interfaces even when multipath is off in /etc/init.d/mptcp --- mptcp/files/etc/init.d/mptcp | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/mptcp/files/etc/init.d/mptcp b/mptcp/files/etc/init.d/mptcp index 0a5ad56f2f..0fe3a2356f 100755 --- a/mptcp/files/etc/init.d/mptcp +++ b/mptcp/files/etc/init.d/mptcp @@ -345,6 +345,41 @@ interface_multipath_settings() { ip link set dev $iface txqueuelen 1000 > /dev/null 2>&1 fi fi + if [ -z "$gateway" ] && [ -n "$network" ]; then + if [ "$(uci -q get openmptcprouter.settings.uci_route)" = "1" ]; then + uci -q batch <<-EOF >/dev/null + delete network.${config}_rule + set network.${config}_rule=rule + set network.${config}_rule.lookup=${id} + set network.${config}_rule.priority=0 + set network.${config}_rule.src="${ipaddr}/32" + set network.${config}_rule.created=mptcp + delete network.${config}_route + set network.${config}_route=route + set network.${config}_route.interface=${config} + set network.${config}_route.target=${network} + set network.${config}_route.netmask=${netmask} + set network.${config}_route.table=${ip4table} + set network.${config}_route.created=mptcp + delete network.${config}_route_default + commit network + EOF + else + [ -n "$ipaddr" ] && [ -z "$(ip rule show from $ipaddr table $ip4table)" ] && ip rule add from $ipaddr table $ip4table pref 0 + [ -z "$(ip rule show oif $iface table $ip4table)" ] && ip rule add oif $iface table $ip4table pref 0 + ip route replace $network/$netmask dev $iface scope link metric $id $initcwrwnd >/dev/null 2>&1 + ip route replace $network/$netmask dev $iface scope link table $ip4table $initcwrwnd >/dev/null 2>&1 + #ip route flush cache $id >/dev/null 2>&1 + fi + + if [ "$txqueuelen" != "" ]; then + #ifconfig $iface txqueuelen $txqueuelen > /dev/null 2>&1 + ip link set dev $iface txqueuelen $txqueuelen > /dev/null 2>&1 + else + #ifconfig $iface txqueuelen 1000 > /dev/null 2>&1 + ip link set dev $iface txqueuelen 1000 > /dev/null 2>&1 + fi + fi if [ "$(uci -q get openmptcprouter.settings.disable_ipv6)" != "1" ] && [ "$config" != "omr6in4" ]; then # IPv6 Updates: local ip6addr