mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-03-09 15:40:03 +00:00
sync (#414)
This commit is contained in:
commit
3fb2013eaa
9 changed files with 42 additions and 34 deletions
|
|
@ -240,6 +240,9 @@ interface_multipath_settings() {
|
|||
if [ -z "$gateway" ] || [ "$( valid_subnet4 $gateway )" != "ok" ]; then
|
||||
gateway=$(ubus call network.interface.${config}_4 status 2>/dev/null | jsonfilter -q -l 1 -e '@.route[@.target="0.0.0.0"].nexthop' | tr -d "\n")
|
||||
fi
|
||||
if [ -z "$gateway" ] || [ "$( valid_subnet4 $gateway )" != "ok" ]; then
|
||||
gateway=$(ip -4 r list dev "$iface" | awk '/via/ {print $3;exit}' | tr -d "\n")
|
||||
fi
|
||||
if [ -z "$gateway" ] || [ "$( valid_subnet4 $gateway )" != "ok" ]; then
|
||||
gateway=$(traceroute -m1 -i $iface 8.8.8.8 2>/dev/null | awk 'FNR==2{ print $2 }')
|
||||
[ "$gateway" = "*" ] && gateway=""
|
||||
|
|
@ -297,7 +300,7 @@ interface_multipath_settings() {
|
|||
ip route replace $network/$netmask dev $iface scope link table $id $initcwrwnd 2>&1 >/dev/null
|
||||
ip route replace default via $gateway dev $iface table $id $initcwrwnd 2>&1 >/dev/null
|
||||
[ "$(uci -q get openmptcprouter.settings.defaultgw)" != "0" ] && ip route replace default via $gateway dev $iface metric $id $initcwrwnd 2>&1 >/dev/null
|
||||
ip route flush cache $id 2>&1 >/dev/null
|
||||
#ip route flush cache $id 2>&1 >/dev/null
|
||||
fi
|
||||
|
||||
#config_get mode "$config" multipath ""
|
||||
|
|
@ -387,7 +390,7 @@ interface_multipath_settings() {
|
|||
ip -6 route replace $network6/$netmask6 dev $iface scope link table 6$id $initcwrwnd 2>&1 >/dev/null
|
||||
ip -6 route replace default via $gateway6 dev $iface table 6$id $initcwrwnd 2>&1 >/dev/null
|
||||
[ "$(uci -q get openmptcprouter.settings.defaultgw)" != "0" ] && ip -6 route replace default via $gateway6 dev $iface metric 6$id $initcwrwnd 2>&1 >/dev/null
|
||||
ip -6 route flush cache 6$id 2>&1 >/dev/null
|
||||
#ip -6 route flush cache 6$id 2>&1 >/dev/null
|
||||
fi
|
||||
|
||||
#config_get mode "$config" multipath "off"
|
||||
|
|
@ -528,14 +531,14 @@ start_service() {
|
|||
#config_foreach remove route6
|
||||
#config_foreach remove rule
|
||||
#config_foreach remove rule6
|
||||
[ -z "$intf" ] && [ -n "$(uci -q get network.@route[-1])" ] && {
|
||||
# logger -t "MPTCP" "Flush main table"
|
||||
# ip route flush table main
|
||||
# ip -6 route flush table main
|
||||
logger -t "MPTCP" "Flush route cache"
|
||||
ip route flush cache
|
||||
ip -6 route flush cache
|
||||
}
|
||||
#[ -z "$intf" ] && [ -n "$(uci -q get network.@route[-1])" ] && {
|
||||
## logger -t "MPTCP" "Flush main table"
|
||||
## ip route flush table main
|
||||
## ip -6 route flush table main
|
||||
# logger -t "MPTCP" "Flush route cache"
|
||||
# ip route flush cache
|
||||
# ip -6 route flush cache
|
||||
#}
|
||||
if [ "$(uci -q get network.globals.mptcp_disable_initial_config)" != "1" ]; then
|
||||
config_foreach interface_multipath_settings interface $intf
|
||||
config_foreach add_route route
|
||||
|
|
|
|||
|
|
@ -132,20 +132,23 @@ 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
|
||||
oldintfs=$(ip mptcp endpoint show | grep "dev if" | awk '{ print $3 }')
|
||||
endpoint="$(ip mptcp endpoint show)"
|
||||
[ -z "$endpoint" ] && exit 0
|
||||
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
|
||||
}
|
||||
|
||||
ID=$(ip mptcp endpoint show | sort | grep "dev $DEVICE " | awk '{print $3}')
|
||||
IFF=$(ip mptcp endpoint show | sort | grep -m 1 -E "dev $DEVICE " | awk '{print $4}')
|
||||
endpoint="$(ip mptcp endpoint show)"
|
||||
[ -z "$endpoint" ] && exit 0
|
||||
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')
|
||||
[ -z "$ID" ] && [ -n "$IP" ] && ID=$(ip mptcp endpoint show | grep "$IP " | awk '{print $3}')
|
||||
RMID=$(ip mptcp endpoint show | grep '::ffff' | awk '{ print $3 }')
|
||||
[ -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
|
||||
case $TYPE in
|
||||
"off")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue