From 276acb2db61ece680392be762fc76bab9e74655c Mon Sep 17 00:00:00 2001 From: "Ycarus (Yannick Chabanois)" Date: Wed, 7 Jul 2021 12:14:50 +0200 Subject: [PATCH 1/6] Keep mac for vlan --- 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 334cc0632..604c54fe8 100755 --- a/mptcp/files/etc/init.d/mptcp +++ b/mptcp/files/etc/init.d/mptcp @@ -47,7 +47,7 @@ interface_macaddr_count() { local intf="$1" local dmacaddr="$2" config_get macaddr "$intf" macaddr - [ "$macaddr" = "$dmacaddr" ] && nbmac=$((nbmac+1)) + [ "$macaddr" = "$dmacaddr" ] && [ -z "$(echo $intf | grep '\.')" ] && nbmac=$((nbmac+1)) } interface_max_metric() { From 8aa3927d7c2e95d67bb9f6e7cbc4b86737bfa642 Mon Sep 17 00:00:00 2001 From: "Ycarus (Yannick Chabanois)" Date: Wed, 7 Jul 2021 12:15:16 +0200 Subject: [PATCH 2/6] doesn't add mac for vlan --- macvlan/files/etc/init.d/macvlan | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macvlan/files/etc/init.d/macvlan b/macvlan/files/etc/init.d/macvlan index b38597eff..a09988504 100755 --- a/macvlan/files/etc/init.d/macvlan +++ b/macvlan/files/etc/init.d/macvlan @@ -25,7 +25,7 @@ _save_macaddr() { } [ -z "$(uci -q get network.$1.macaddr)" ] && { _ifname=$(uci -q get "network.$1.ifname") - [ -n "$_ifname" ] && { + [ -n "$_ifname" ] && [ -z "$(echo $_ifname | grep '\.')" ] && { _macaddr=$(ip link show dev $_ifname 2>/dev/null | grep link | awk '{print $2}') [ -n "$_macaddr" ] && { uci -q set network.$1.macaddr=$_macaddr From ae8371b2cc7c0fa8e0dcacba1a66e3677be4e1a9 Mon Sep 17 00:00:00 2001 From: "Ycarus (Yannick Chabanois)" Date: Fri, 9 Jul 2021 18:40:16 +0200 Subject: [PATCH 3/6] Always use device in priority --- luci-app-omr-bypass/root/etc/init.d/omr-bypass | 4 ++-- luci-app-openmptcprouter/root/etc/init.d/openmptcprouter | 8 ++++---- .../root/usr/libexec/rpcd/openmptcprouter | 2 +- mptcp/files/etc/init.d/mptcp | 7 ++++--- omr-tracker/files/etc/init.d/omr-tracker | 3 +++ 5 files changed, 14 insertions(+), 10 deletions(-) diff --git a/luci-app-omr-bypass/root/etc/init.d/omr-bypass b/luci-app-omr-bypass/root/etc/init.d/omr-bypass index 2b8f56972..c69c1ce62 100755 --- a/luci-app-omr-bypass/root/etc/init.d/omr-bypass +++ b/luci-app-omr-bypass/root/etc/init.d/omr-bypass @@ -501,8 +501,8 @@ _intf_rule_v2ray_rules() { _intf_rule() { local intf - config_get intf $1 ifname - [ -z "$intf" ] && intf=$(ifstatus "$1" | jsonfilter -q -e '@["l3_device"]') + intf=$(ifstatus "$1" | jsonfilter -q -e '@["l3_device"]') + [ -z "$intf" ] && config_get intf $1 ifname [ -n "$(echo $intf | grep '@')" ] && intf=$(ifstatus "$1" | jsonfilter -q -e '@["device"]') #count=$((count+1)) config_get count $1 metric diff --git a/luci-app-openmptcprouter/root/etc/init.d/openmptcprouter b/luci-app-openmptcprouter/root/etc/init.d/openmptcprouter index 9c547bff8..8a1a5ab3c 100755 --- a/luci-app-openmptcprouter/root/etc/init.d/openmptcprouter +++ b/luci-app-openmptcprouter/root/etc/init.d/openmptcprouter @@ -18,11 +18,11 @@ omr_intf_check() { omr_intf_set() { local device local ifname - config_get ifname "$1" ifname config_get device "$1" device config_get type "$1" type - [ -z "$ifname" ] && ifname=$(ifstatus "$1" | jsonfilter -q -e '@["l3_device"]') + ifname=$(ifstatus "$1" | jsonfilter -q -e '@["l3_device"]') + [ -z "$ifname" ] && config_get ifname "$1" ifname if [ "$type" != "macvlan" ] && [ -n "$ifname" ] && [ -f /sys/class/net/${ifname}/device/uevent ]; then devicepath=$(readlink -f /sys/class/net/${ifname}) @@ -56,7 +56,6 @@ omr_set_settings() { local ifname local multipath config_get multipath "$1" multipath - config_get ifname "$1" ifname config_get device "$1" device config_get proto "$1" proto config_get type "$1" type @@ -76,7 +75,8 @@ omr_set_settings() { [ -z "$addlatency" ] && addlatency=0 devicename=$(echo "$device" | cut -d'/' -f3) - [ -z "$ifname" ] && ifname=$(ifstatus "$1" | jsonfilter -q -e '@["l3_device"]') + ifname=$(ifstatus "$1" | jsonfilter -q -e '@["l3_device"]') + [ -z "$ifname" ] && config_get ifname "$1" ifname [ -n "$(echo $ifname | grep '@')" ] && ifname=$(ifstatus "$1" | jsonfilter -q -e '@["device"]') if [ -n "$ifname" ]; then diff --git a/luci-app-openmptcprouter/root/usr/libexec/rpcd/openmptcprouter b/luci-app-openmptcprouter/root/usr/libexec/rpcd/openmptcprouter index effce068c..00b151e38 100755 --- a/luci-app-openmptcprouter/root/usr/libexec/rpcd/openmptcprouter +++ b/luci-app-openmptcprouter/root/usr/libexec/rpcd/openmptcprouter @@ -1156,7 +1156,7 @@ function interfaces_status() end duplicatemac = false - if mac ~= "" and mac ~= nil and not (section["ifname"] ~= nil and section["ifname"]:match("^@.*")) then + if mac ~= "" and mac ~= nil and not (section["ifname"] ~= nil and section["ifname"]:match("^@.*")) and not (ifname ~= nil and ifname:match("%.")) then if allmac[mac] then connectivity = "ERROR" duplicatemac = true diff --git a/mptcp/files/etc/init.d/mptcp b/mptcp/files/etc/init.d/mptcp index 604c54fe8..a4d83ea99 100755 --- a/mptcp/files/etc/init.d/mptcp +++ b/mptcp/files/etc/init.d/mptcp @@ -85,9 +85,9 @@ interface_multipath_settings() { local enabled config_get enabled "$config" auto "1" - config_get iface "$config" ifname + iface=$(ifstatus "$config" | jsonfilter -q -e '@["l3_device"]') + [ -z "$iface" ] && config_get iface "$config" ifname config_get txqueuelen "$config" txqueuelen - [ -z "$iface" ] && iface=$(ifstatus "$config" | jsonfilter -q -e '@["l3_device"]') [ -n "$(echo $iface | grep '@')" ] && iface=$(ifstatus "$config" | jsonfilter -q -e '@["device"]') if [ "$(uci -q get openmptcprouter.${config}.metric)" = "" ]; then count=$((count+1)) @@ -349,7 +349,8 @@ interface_multipath_settings() { } load_interfaces() { - config_get ifname "$1" ifname + ifname=$(ifstatus "$1" | jsonfilter -q -e '@["l3_device"]') + [ -z "$ifname" ] && config_get ifname "$1" ifname config_get multipath "$1" multipath "" [ -z "$multipath" ] && multipath="$(uci -q get openmptcprouter.$1.multipath)" [ "$multipath" != "off" ] && [ "$multipath" != "" ] && interfaces=" ${ifname} ${interfaces}" diff --git a/omr-tracker/files/etc/init.d/omr-tracker b/omr-tracker/files/etc/init.d/omr-tracker index 3276316e9..dc9fb4cb7 100755 --- a/omr-tracker/files/etc/init.d/omr-tracker +++ b/omr-tracker/files/etc/init.d/omr-tracker @@ -69,6 +69,9 @@ _launch_tracker() { [ "${ifenabled}" = "0" ] && return [ "${enabled}" = "0" ] && return [ -z "${hosts}" ] && [ "$type" != "none" ] && return + ifstatus=$(ifstatus "$1" | jsonfilter -q -e '@["up"]') + ifdevice=$(ifstatus "$1" | jsonfilter -q -e '@["device"]') + [ "${ifstatus}" = "false" ] && [ -z "${ifdevice}" ] && return [ -z "${interval_tries}" ] && interval_tries=1 procd_open_instance From bc498724ff749639d87a9c79c669c10770f2ffcd Mon Sep 17 00:00:00 2001 From: "Ycarus (Yannick Chabanois)" Date: Sat, 10 Jul 2021 15:38:16 +0200 Subject: [PATCH 4/6] Fix get device --- mptcp/files/etc/init.d/mptcp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mptcp/files/etc/init.d/mptcp b/mptcp/files/etc/init.d/mptcp index a4d83ea99..bb5297dc7 100755 --- a/mptcp/files/etc/init.d/mptcp +++ b/mptcp/files/etc/init.d/mptcp @@ -85,7 +85,9 @@ interface_multipath_settings() { local enabled config_get enabled "$config" auto "1" - iface=$(ifstatus "$config" | jsonfilter -q -e '@["l3_device"]') + network_get_device iface $config + [ -z "$iface" ] && network_get_physdev iface $config + [ -z "$iface" ] && iface=$(ifstatus "$config" | jsonfilter -q -e '@["l3_device"]') [ -z "$iface" ] && config_get iface "$config" ifname config_get txqueuelen "$config" txqueuelen [ -n "$(echo $iface | grep '@')" ] && iface=$(ifstatus "$config" | jsonfilter -q -e '@["device"]') @@ -176,7 +178,7 @@ interface_multipath_settings() { config_get gateway $config gateway config_get netmask $config netmask [ -n "$ipaddr" ] && [ -n "$netmask" ] && netmask=`ipcalc.sh $ipaddr $netmask | sed -n '/PREFIX=/{;s/.*=//;s/ .*//;p;}'` - [ -n "$îpaddr" ] && [ -n "$netmask" ] && network=`ipcalc.sh $ipaddr $netmask | sed -n '/NETWORK=/{;s/.*=//;s/ .*//;p;}'` + [ -n "$ipaddr" ] && [ -n "$netmask" ] && network=`ipcalc.sh $ipaddr $netmask | sed -n '/NETWORK=/{;s/.*=//;s/ .*//;p;}'` elif [ "$proto" != "gre" ]; then network_get_ipaddr ipaddr $config [ -z "$ipaddr" ] && ipaddr=$(ip -4 addr show dev $iface | grep inet | awk '{print $2}' | cut -d/ -f1 | tr -d "\n") From f557cb00804fbb4fef3f3086b689c0f10cf2084e Mon Sep 17 00:00:00 2001 From: "Ycarus (Yannick Chabanois)" Date: Fri, 25 Jun 2021 19:43:45 +0200 Subject: [PATCH 5/6] Fix dashboard error --- .../luci-static/resources/view/dashboard/include/10_router.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js b/luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js index b5892cff2..ad9278c53 100644 --- a/luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js +++ b/luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js @@ -371,7 +371,7 @@ return baseclass.extend({ release: { title: _('Firmware Version'), - value: boardinfo.release.description ? boardinfo.release.description : null + value: (typeof boardinfo.release.description !== "undefined") ? boardinfo.release.description : null } }; From fb32c87a746e12de6ec9a1126722479ba81f3267 Mon Sep 17 00:00:00 2001 From: "Ycarus (Yannick Chabanois)" Date: Wed, 2 Feb 2022 19:57:59 +0100 Subject: [PATCH 6/6] Fix ipv6 error --- mptcp/files/etc/init.d/mptcp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/mptcp/files/etc/init.d/mptcp b/mptcp/files/etc/init.d/mptcp index 312a1839f..1ccb1f314 100755 --- a/mptcp/files/etc/init.d/mptcp +++ b/mptcp/files/etc/init.d/mptcp @@ -291,8 +291,10 @@ interface_multipath_settings() { network6=`ipcalc $ip6addr | sed -n '/NETWORK=/{;s/.*=//;s/ .*//;p;}'` fi if [ -z "$ip6addr" ] || [ -z "$network6" ]; then - ip6addr=$(ip -6 addr show dev $iface | grep -v 'scope link' | grep inet6 | awk '{print $2}' | cut -d/ -f1 | tr -d "\n") - gateway6=$(ip -6 r list dev $iface | grep -v default | awk '/proto static/ {print $1}' | tr -d "\n") + [ -z "$ip6addr" ] && network_get_ipaddr6 ip6addr $config + [ -z "$ip6addr" ] && ip6addr=$(ip -6 addr show dev $iface | grep -v 'scope link' | grep inet6 | awk '{print $2}' | cut -d/ -f1 | tr -d "\n") + [ -z "$gateway6" ] && network_get_gateway6 gateway6 $config true + [ -z "$gateway6" ] && gateway6=$(ip -6 r list dev $iface | grep -v default | awk '/proto static/ {print $1}' | tr -d "\n") [ -z "$gateway6" ] && gateway6=$(uci -q get "network.$config.ip6gw") [ -z "$gateway6" ] && gateway6=$(ubus call network.interface.$config status | jsonfilter -q -l 1 -e '@.inactive.route[@.target="::"].nexthop' | tr -d "\n") if [ -z "$gateway6" ] || [ "$( valid_subnet6 $gateway6 )" != "ok" ]; then @@ -302,7 +304,7 @@ interface_multipath_settings() { gateway6=$(ubus call network.interface.${config}_6 status 2>/dev/null | jsonfilter -q -l 1 -e '@.inactive.route[@.target="::"].nexthop' | tr -d "\n") fi netmask6=$(ip -6 addr show dev $iface | grep -v 'scope link' | grep inet6 | awk '{print $2}' | cut -d/ -f2 | tr -d "\n") - network6=`ipcalc $ip6addr | sed -n '/NETWORK=/{;s/.*=//;s/ .*//;p;}'` + [ -n "$ip6addr" ] && network6=`ipcalc $ip6addr | sed -n '/NETWORK=/{;s/.*=//;s/ .*//;p;}'` fi if [ "$(uci -q get openmptcprouter.settings.uci_route)" = "1" ]; then uci -q batch <<-EOF >/dev/null