diff --git a/mptcp/files/usr/bin/multipath b/mptcp/files/usr/bin/multipath index 1b872182c4..0e3d230ca0 100755 --- a/mptcp/files/usr/bin/multipath +++ b/mptcp/files/usr/bin/multipath @@ -145,8 +145,11 @@ else ID=$(echo "${endpoint}" | sort | grep "dev $DEVICE " | awk '{print $3}') IFF=$(echo "${endpoint}" | sort | grep -m 1 -E "dev $DEVICE " | awk '{print $4}') #IP=$(ip a show $DEVICE | sed -En 's/127.0.0.1//;s/.*inet (addr:)?(([0-9]*\.){3}[0-9]*).*/\2/p') - [ -f /usr/bin/jsonfilter ] && IP=$(ip -j a show $DEVICE | jsonfilter -e '@[0].addr_info[*].local') - [ -f /usr/bin/jq ] && IP=$(ip -j a show $DEVICE | jq -r '.[0].addr_info[].local') + if [ -f /usr/bin/jsonfilter ]; then + IP=$(ip -j a show $DEVICE scope global | jsonfilter -e '@[0].addr_info[*].local') + elif [ -f /usr/bin/jq ]; then + IP=$(ip -j a show $DEVICE scope global | jq -r '.[0].addr_info[].local') + fi [ -z "$ID" ] && [ -n "$IP" ] && ID=$(echo "${endpoint}" show | grep "$IP " | awk '{print $3}') RMID=$(echo "${endpoint}" | grep '::ffff' | awk '{ print $3 }') [ -n "$RMID" ] && ip mptcp endpoint delete id $RMID 2>&1 >/dev/null 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 4f5ca421d2..c2966ce168 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,7 @@ fi if [ -n "$OMR_TRACKER_INTERFACE" ] && [ -n "$OMR_TRACKER_DEVICE" ]; then metric="$(uci -q get network.$OMR_TRACKER_INTERFACE.metric)" - if [ -z "$metric" ] || [ -z "$(ip 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 $metric | grep $OMR_TRACKER_DEVICE)" ]); then /etc/init.d/mptcp reload "$OMR_TRACKER_DEVICE" fi fi diff --git a/omr-dscp/files/etc/init.d/omr-dscp-nft b/omr-dscp/files/etc/init.d/omr-dscp-nft index 19aa9d5899..b1da1b3c73 100755 --- a/omr-dscp/files/etc/init.d/omr-dscp-nft +++ b/omr-dscp/files/etc/init.d/omr-dscp-nft @@ -130,6 +130,9 @@ _add_fwmark_chain() { done } +_remove_old_ipset_dnsmasq() { + [ -n "$(uci -q get dhcp.${1}.name | grep omr)" ] && uci -q delete dhcp.$1 +} _remove_ipset_dnsmasq() { [ -n "$(echo $1 | grep omr_dscp)" ] && uci -q delete dhcp.$1 } @@ -151,6 +154,7 @@ _cleanup() { uci -q del dhcp.@dnsmasq[0].ipset config_load dhcp config_foreach _remove_ipset_dnsmasq + config_foreach _remove_old_ipset_dnsmasq config_load firewall config_foreach _remove_rules uci -q commit dhcp diff --git a/omr-tracker/files/bin/omr-tracker b/omr-tracker/files/bin/omr-tracker index d8a9d4ceca..cc0bedf9f4 100755 --- a/omr-tracker/files/bin/omr-tracker +++ b/omr-tracker/files/bin/omr-tracker @@ -323,7 +323,7 @@ while true; do if ([ "$OMR_TRACKER_IPV6" = "1" ] || [ "$OMR_TRACKER_IPV6" = "auto" ] || [ -z "$OMR_TRACKER_IPV6" ]) && ([ "$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" | sort -r | grep -m 1 inet6 | awk '{print $2}' | cut -d'/' -s -f1) + 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) #fi if [ -z "$OMR_TRACKER_DEVICE_GATEWAY6" ]; then OMR_TRACKER_DEVICE_GATEWAY6=$(uci -q get "network.$OMR_TRACKER_INTERFACE.ip6gw") @@ -501,10 +501,10 @@ while true; do _ping "$OMR_TRACKER_HOST6" "$OMR_TRACKER_DEVICE" "yes" statusb=$? elif [ "$OMR_TRACKER_TYPE" = "httping" ]; then - _httping "$OMR_TRACKER_HOST6" "$OMR_TRACKER_DEVICE_IP" "yes" + _httping "$OMR_TRACKER_HOST6" "$OMR_TRACKER_DEVICE_IP6" "yes" statusb=$? elif [ "$OMR_TRACKER_TYPE" = "dns" ]; then - _dns "$OMR_TRACKER_HOST6" "$OMR_TRACKER_DEVICE_IP" "yes" + _dns "$OMR_TRACKER_HOST6" "$OMR_TRACKER_DEVICE_IP6" "yes" statusb=$? fi ip -6 route del "$OMR_TRACKER_HOST6" via "$OMR_TRACKER_DEVICE_GATEWAY6" dev "$OMR_TRACKER_DEVICE" src "$OMR_TRACKER_DEVICE_IP6" > /dev/null 2>&1 @@ -530,7 +530,7 @@ while true; do if [ "$serverip_ping" != false ] && [ "$OMR_TRACKER_STATUS" = "OK" ] && [ "$OMR_TRACKER_TYPE" != "httping" ] && [ "$OMR_TRACKER_SERVER_HTTP_TEST" = "1" ]; then serverip_ping=false config_load openmptcprouter - config_foreach _httping_server server $OMR_TRACKER_DEVICE_IP + config_foreach _httping_server server $OMR_TRACKER_DEVICE_IP6 if [ "$serverip_ping" = false ]; then OMR_TRACKER_STATUS_MSG="No access to server API" #OMR_TRACKER_STATUS="ERROR" @@ -554,7 +554,7 @@ while true; do sleep "${OMR_TRACKER_INTERVAL_TRIES:-1}" done fi - if [ -z "$OMR_TRACKER_DEVICE_IP" ] || [ -z "$OMR_TRACKER_DEVICE_GATEWAY" ] || [ -z "$OMR_TRACKER_DEVICE_IP6" ] || [ -z "$OMR_TRACKER_DEVICE_GATEWAY6" ]; then + if [ "$OMR_TRACKER_STATUS" = "ERROR" ] && ([ -z "$OMR_TRACKER_DEVICE_IP" ] || [ -z "$OMR_TRACKER_DEVICE_GATEWAY" ] || [ -z "$OMR_TRACKER_DEVICE_IP6" ] || [ -z "$OMR_TRACKER_DEVICE_GATEWAY6" ]); then [ -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" @@ -577,9 +577,9 @@ while true; do fi if [ "$OMR_TRACKER_LIST_HOSTS6" != "" ]; then if [ "$OMR_TRACKER_STATUS_MSG" = "" ]; then - OMR_TRACKER_STATUS_MSG="$OMR_TRACKER_TYPE from $OMR_TRACKER_DEVICE_IP error ($OMR_TRACKER_LIST_HOSTS6)" + OMR_TRACKER_STATUS_MSG="$OMR_TRACKER_TYPE from $OMR_TRACKER_DEVICE_IP6 error ($OMR_TRACKER_LIST_HOSTS6)" else - OMR_TRACKER_STATUS_MSG="$OMR_TRACKER_STATUS_MSG and $OMR_TRACKER_TYPE from $OMR_TRACKER_DEVICE_IP error ($OMR_TRACKER_LIST_HOSTS6)" + OMR_TRACKER_STATUS_MSG="$OMR_TRACKER_STATUS_MSG and $OMR_TRACKER_TYPE from $OMR_TRACKER_DEVICE_IP6 error ($OMR_TRACKER_LIST_HOSTS6)" fi fi if [ "$OMR_TRACKER_CHECK_QUALITY" = "1" ]; then