diff --git a/mptcp/files/etc/init.d/mptcp b/mptcp/files/etc/init.d/mptcp index 049176472..360d757cb 100755 --- a/mptcp/files/etc/init.d/mptcp +++ b/mptcp/files/etc/init.d/mptcp @@ -406,6 +406,7 @@ interface_multipath_settings() { fi if [ "$(uci -q get openmptcprouter.settings.force_multipath)" != "0" ]; then + multipath "$iface" "off" if ([ "$mode" = "master" ] || [ "$mode" = "on" ]) && [ -z "$(multipath $iface | grep default)" ]; then logger -t "MPTCP" "Set $iface to $mode" multipath "$iface" "on" @@ -511,7 +512,7 @@ start_service() { local id count intfmaster . /lib/functions.sh . /lib/functions/network.sh - [ -n "$intf" ] && multipath "${intf}" off 2>&1 >/dev/null + #[ -n "$intf" ] && multipath "${intf}" off 2>&1 >/dev/null global_multipath_settings [ -n "$(ubus call system board | jsonfilter -e '@.board_name' | grep '3-model-b')" ] && [ "$(ip link show eth0 | grep UP)" = "" ] && { diff --git a/mptcp/files/usr/share/omr/post-tracking.d/001-post-tracking b/mptcp/files/usr/share/omr/post-tracking.d/001-post-tracking index c2966ce16..ff6033bbf 100755 --- a/mptcp/files/usr/share/omr/post-tracking.d/001-post-tracking +++ b/mptcp/files/usr/share/omr/post-tracking.d/001-post-tracking @@ -1061,7 +1061,8 @@ fi if [ -n "$OMR_TRACKER_INTERFACE" ] && [ -n "$OMR_TRACKER_DEVICE" ]; then metric="$(uci -q get network.$OMR_TRACKER_INTERFACE.metric)" - if [ -z "$metric" ] || ([ -n "$OMR_TRACKER_DEVICE_IP" ] && [ -z "$(ip route show table $metric | grep $OMR_TRACKER_DEVICE)" ]) || ([ -n "$OMR_TRACKER_DEVICE_IP6" ] && [ -z "$(ip -6 route show table $metric | grep $OMR_TRACKER_DEVICE)" ]); then + if [ -z "$metric" ] || ([ -n "$OMR_TRACKER_DEVICE_IP" ] && [ -z "$(ip route show table $metric | grep $OMR_TRACKER_DEVICE)" ]) || ([ -n "$OMR_TRACKER_DEVICE_IP6" ] && [ -z "$(ip -6 route show table 6${metric} | grep $OMR_TRACKER_DEVICE)" ]); then + _log "Routes not correctly set for $OMR_TRACKER_DEVICE (table $metric)" /etc/init.d/mptcp reload "$OMR_TRACKER_DEVICE" fi fi diff --git a/omr-tracker/files/bin/omr-tracker b/omr-tracker/files/bin/omr-tracker index cc0bedf9f..ff1e058ed 100755 --- a/omr-tracker/files/bin/omr-tracker +++ b/omr-tracker/files/bin/omr-tracker @@ -320,7 +320,7 @@ while true; do OMR_TRACKER_DEVICE_GATEWAY=$(ip -4 r list dev "$OMR_TRACKER_DEVICE" | awk '/via/ {print $3;exit}' | tr -d "\n") fi fi - if ([ "$OMR_TRACKER_IPV6" = "1" ] || [ "$OMR_TRACKER_IPV6" = "auto" ] || [ -z "$OMR_TRACKER_IPV6" ]) && ([ "$OMR_TRACKER_FAMILY" = "ipv6" ] || [ "$OMR_TRACKER_FAMILY" = "ipv4ipv6" ]); then + if ([ "$OMR_TRACKER_IPV6" = "1" ] || [ "$OMR_TRACKER_IPV6" = "auto" ]) && ([ "$OMR_TRACKER_FAMILY" = "ipv6" ] || [ "$OMR_TRACKER_FAMILY" = "ipv4ipv6" ]); then #OMR_TRACKER_DEVICE_IP6=$(ip -6 -br addr ls dev "$OMR_TRACKER_DEVICE" | awk -F'[ /]+' '{print $3}') #if [ -z "$OMR_TRACKER_DEVICE_IP6" ]; then OMR_TRACKER_DEVICE_IP6=$(ip -6 addr show dev "$OMR_TRACKER_DEVICE" scope global | sort -r | grep -m 1 inet6 | awk '{print $2}' | cut -d'/' -s -f1) @@ -450,7 +450,7 @@ while true; do done fi #if [ "$(uci -q get openmptcprouter.settings.disable_ipv6)" = "0" ] && [ -n "$OMR_TRACKER_DEVICE_IP6" ] && [ -n "$OMR_TRACKER_DEVICE_GATEWAY6" ]; then - if ([ "$OMR_TRACKER_FAMILY" = "ipv6" ] || [ "$OMR_TRACKER_FAMILY" = "ipv4ipv6" ]) && [ "$(uci -q get openmptcprouter.settings.disable_ipv6)" = "0" ] && [ -n "$OMR_TRACKER_DEVICE_IP6" ] && [ -n "$OMR_TRACKER_DEVICE_GATEWAY6" ]; then + if [ -n "$OMR_TRACKER_DEVICE_IP6" ] && [ -n "$OMR_TRACKER_DEVICE_GATEWAY6" ]; then # setup loop variable if [ "$OMR_TRACKER_PREV_STATUS" = "ERROR" ]; then tries="$OMR_TRACKER_TRIES" @@ -558,10 +558,8 @@ while true; do [ -z "$OMR_TRACKER_STATUS_MSG" ] && OMR_TRACKER_STATUS_MSG="$OMR_TRACKER_INTERFACE may have ip issues" [ -z "$OMR_TRACKER_DEVICE_IP" ] && OMR_TRACKER_STATUS_MSG="$OMR_TRACKER_STATUS_MSG, interface have no IPv4" [ -z "$OMR_TRACKER_DEVICE_GATEWAY" ] && OMR_TRACKER_STATUS_MSG="$OMR_TRACKER_STATUS_MSG, interface have no IPv4 gateway" - if ([ "$OMR_TRACKER_IPV6" = "1" ] || [ "$OMR_TRACKER_IPV6" = "auto" ] || [ -z "$OMR_TRACKER_IPV6" ]) && ([ "$OMR_TRACKER_FAMILY" = "ipv6" ] || [ "$OMR_TRACKER_FAMILY" = "ipv4ipv6" ]); then - [ -z "$OMR_TRACKER_DEVICE_IP6" ] && OMR_TRACKER_STATUS_MSG="$OMR_TRACKER_STATUS_MSG, interface have no IPv6" - [ -z "$OMR_TRACKER_DEVICE_GATEWAY6" ] && OMR_TRACKER_STATUS_MSG="$OMR_TRACKER_STATUS_MSG, interface have no IPv6 gateway" - fi + [ -z "$OMR_TRACKER_DEVICE_IP6" ] && OMR_TRACKER_STATUS_MSG="$OMR_TRACKER_STATUS_MSG, interface have no IPv6" + [ -z "$OMR_TRACKER_DEVICE_GATEWAY6" ] && OMR_TRACKER_STATUS_MSG="$OMR_TRACKER_STATUS_MSG, interface have no IPv6 gateway" fi else OMR_TRACKER_STATUS_MSG="link down" diff --git a/omr-tracker/files/etc/init.d/omr-tracker b/omr-tracker/files/etc/init.d/omr-tracker index 252493310..7614ed62c 100755 --- a/omr-tracker/files/etc/init.d/omr-tracker +++ b/omr-tracker/files/etc/init.d/omr-tracker @@ -110,6 +110,7 @@ _launch_tracker() { [ -z "${tries}" ] && tries=5 [ -z "${reliability}" ] && reliability=1 [ -z "${tries_up}" ] && tries_up=${tries} + [ "$(uci -q get openmptcprouter.settings.disable_ipv6)" = "1" ] && ipv6="0" #[ -z "${failure_interval}" ] && failure_interval=5 procd_open_instance diff --git a/openmptcprouter-api/files/usr/libexec/rpcd/openmptcprouter b/openmptcprouter-api/files/usr/libexec/rpcd/openmptcprouter index ca526f957..e0798e6f5 100755 --- a/openmptcprouter-api/files/usr/libexec/rpcd/openmptcprouter +++ b/openmptcprouter-api/files/usr/libexec/rpcd/openmptcprouter @@ -328,6 +328,7 @@ function server_settings(server,server_ip,openmptcprouter_vps_key) ucic:save("openmptcprouter") if ucic:get("openmptcprouter",server,"master") == "1" then ucic:set("shadowsocks-libev","sss0","server",server_ip) + ucic:set("shadowsocks-rust","sss0","server",server_ip) ucic:set("glorytun","vpn","host",server_ip) ucic:set("dsvpn","vpn","host",server_ip) ucic:set("mlvpn","general","host",server_ip) @@ -357,6 +358,8 @@ function server_settings(server,server_ip,openmptcprouter_vps_key) ucic:commit("glorytun") ucic:save("shadowsocks-libev") ucic:commit("shadowsocks-libev") + ucic:save("shadowsocks-rust") + ucic:commit("shadowsocks-rust") end end @@ -560,6 +563,20 @@ function update_vps() local vpsgettoken = sys.exec("/etc/init.d/openmptcprouter-vps restart >/dev/null 2>/dev/null") end +function get_mptcp_config(interface) + return ucic:get("network",interface,"multipath") +end + +function set_mptcp_config(interface,state) + ucic:set("network",interface,"multipath",state) + ucic:save("network") + ucic:commit("network") + ucic:set("openmptcprouter",interface,"multipath",state) + ucic:save("openmptcprouter") + ucic:commit("openmptcprouter") +end + + function get_rootfs() local rootfs = {} rootfs['format'] = luci.util.trim(sys.exec("mount | awk 'NR==1{print $5}'")) @@ -1364,7 +1381,7 @@ function interfaces_status() end end if ifname ~= nil and not (ifname:match("^tun.*") or interface:match("^ovpn.*") or interface:match("^wg.*")) then - if ipv6 == "1" or ipv6 == "auto" and gateway6 == ""then + if (ipv6 == "1" or ipv6 == "auto") and gateway6 == "" then gateway6 = ut.trim(sys.exec("ip -6 r list dev " .. ifname .. " | grep via | grep -v default | grep -v metric | awk '{print $1}' | tr -d '\n'")) end end @@ -2326,6 +2343,18 @@ local methods = { set_openvpn(args.key) end }, + getmptcpconfig = { + args = { interface = "" }, + call = function(args) + get_mptcp_config(args.interface) + end + }, + setmptcpconfig = { + args = { interface = "", state = "" }, + call = function(args) + set_mptcp_config(args.interface,args.state) + end + }, }