mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-03-09 15:40:03 +00:00
synmc (#479)
This commit is contained in:
commit
b49b012691
2 changed files with 34 additions and 26 deletions
|
@ -131,19 +131,22 @@ if [ -f /proc/sys/net/mptcp/mptcp_enabled ]; then
|
|||
|
||||
printf "0x%02x" $(($(($IFF^$(($IFF&$IFF_MASK))))|$FLAG)) > $FLAG_PATH
|
||||
else
|
||||
# Remove not needed if* interfaces in MPTCP
|
||||
endpoint="$(ip mptcp endpoint show)"
|
||||
if [ -n "$TYPE" ]; then
|
||||
# Remove not needed if* interfaces in MPTCP
|
||||
[ -n "$endpoint" ] && oldintfs=$(echo "${endpoint}" | grep "dev if" | awk '{ print $3 }')
|
||||
[ -n "$oldintfs" ] && {
|
||||
for oldintf in $oldintfs; do
|
||||
ip mptcp endpoint delete id $oldintf 2>&1 >/dev/null
|
||||
done
|
||||
}
|
||||
endpoint="$(ip mptcp endpoint show)"
|
||||
}
|
||||
fi
|
||||
if [ -n "$endpoint" ]; then
|
||||
ID=$(echo "${endpoint}" | sort | grep "dev $DEVICE " | awk '{print $3}')
|
||||
IFF=$(echo "${endpoint}" | sort | grep -m 1 -E "dev $DEVICE " | awk '{print $4; exit}')
|
||||
fi
|
||||
if [ -n "$TYPE" ]; then
|
||||
#IP=$(ip a show $DEVICE | sed -En 's/127.0.0.1//;s/.*inet (addr:)?(([0-9]*\.){3}[0-9]*).*/\2/p')
|
||||
if [ -f /usr/bin/jsonfilter ]; then
|
||||
IP=$(ip -j a show $DEVICE scope global | jsonfilter -e '@[0].addr_info[*].local')
|
||||
|
@ -156,6 +159,7 @@ else
|
|||
[ -z "$ID" ] && [ -n "$IP" ] && [ -n "$endpoint" ] && ID=$(echo "${endpoint}" show | grep "$IP " | awk '{print $3}')
|
||||
[ -n "$endpoint" ] && RMID=$(echo "${endpoint}" | grep '::ffff' | awk '{ print $3 }')
|
||||
[ -n "$RMID" ] && ip mptcp endpoint delete id $RMID 2>&1 >/dev/null
|
||||
fi
|
||||
case $TYPE in
|
||||
"off")
|
||||
[ -n "$ID" ] && {
|
||||
|
|
|
@ -723,16 +723,16 @@ default_gw=$(ip route get 1.1.1.1 | grep via | awk '{print $3}')
|
|||
default_gw6=$(ip -6 route get 2606:4700:4700::1111 | grep via | awk '{print $3}')
|
||||
#current_interface_gw=$(uci -q get "network.$OMR_TRACKER_INTERFACE.gateway")
|
||||
|
||||
interface_autostart=$(ifstatus "$OMR_TRACKER_INTERFACE" 2>/dev/null | jsonfilter -q -e '@["autostart"]')
|
||||
interface_up=$(ifstatus "$OMR_TRACKER_INTERFACE" 2>/dev/null | jsonfilter -q -e '@["up"]')
|
||||
interface_available=$(ifstatus "$OMR_TRACKER_INTERFACE" 2>/dev/null | jsonfilter -q -e '@["available"]')
|
||||
interface_pending=$(ifstatus "$OMR_TRACKER_INTERFACE" 2>/dev/null | jsonfilter -q -e '@["pending"]')
|
||||
interface_error=$(ifstatus "$OMR_TRACKER_INTERFACE" 2>/dev/null | jsonfilter -q -e '@["errors"][0].code')
|
||||
|
||||
initcwrwnd=""
|
||||
|
||||
# An interface in error will never be used in MPTCP
|
||||
if [ "$OMR_TRACKER_STATUS" = "ERROR" ] || ([ "$OMR_TRACKER_INTERFACE" != "omrvpn" ] && [ "$interface_up" != "true" ]); then
|
||||
interface_autostart=$(ifstatus "$OMR_TRACKER_INTERFACE" 2>/dev/null | jsonfilter -q -e '@["autostart"]')
|
||||
interface_up=$(ifstatus "$OMR_TRACKER_INTERFACE" 2>/dev/null | jsonfilter -q -e '@["up"]')
|
||||
interface_available=$(ifstatus "$OMR_TRACKER_INTERFACE" 2>/dev/null | jsonfilter -q -e '@["available"]')
|
||||
interface_pending=$(ifstatus "$OMR_TRACKER_INTERFACE" 2>/dev/null | jsonfilter -q -e '@["pending"]')
|
||||
interface_error=$(ifstatus "$OMR_TRACKER_INTERFACE" 2>/dev/null | jsonfilter -q -e '@["errors"][0].code')
|
||||
|
||||
#if [ "$interface_available" = "true" ] && [ -n "$OMR_TRACKER_INTERFACE" ] && ([ "$(uci -q get network.$OMR_TRACKER_INTERFACE.proto)" = "modemmanager" ] || [ "$(uci -q get network.$OMR_TRACKER_INTERFACE.proto)" = "wireguard" ]) && [ "$interface_error" != "MM_PINCODE_REQUIRED" ] && [ "$interface_error" != "MM_FAILED_REASON_SIM_MISSING" ]; then
|
||||
# _log "No answer from $OMR_TRACKER_INTERFACE ($OMR_TRACKER_DEVICE), restart interface"
|
||||
# _log "Set $OMR_TRACKER_INTERFACE down"
|
||||
|
@ -1176,7 +1176,11 @@ if [ "$multipath_config" = "master" ]; then
|
|||
#ip -6 route flush cache 2>&1 >/dev/null
|
||||
fi
|
||||
if ([ -n "$OMR_TRACKER_INTERFACE" ] && [ "$(uci -q get openmptcprouter.$OMR_TRACKER_INTERFACE.lc)" = "" ]) || [ $(($(date +"%s") + $((10 + RANDOM % 31)) - $(uci -q get openmptcprouter.$OMR_TRACKER_INTERFACE.lc))) -gt 3600 ] || [ "$(uci -q show openmptcprouter | grep get_config=\'1\')" != "" ] || [ "$(uci -q show openmptcprouter | grep admin_error=\'1\')" != "" ]; then
|
||||
[ "$(pgrep -f openmptcprouter-vps)" = "" ] && /etc/init.d/openmptcprouter-vps restart >/dev/null 2>&1 &
|
||||
[ "$(pgrep -f openmptcprouter-vps)" = "" ] && {
|
||||
/etc/init.d/openmptcprouter-vps restart >/dev/null 2>&1 &
|
||||
uci -q set openmptcprouter.$OMR_TRACKER_INTERFACE.lc=$(date +"%s")
|
||||
uci -q commit openmptcprouter.$OMR_TRACKER_INTERFACE
|
||||
}
|
||||
fi
|
||||
multipath_config="on"
|
||||
fi
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue