1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-03-09 15:40:03 +00:00

Merge branch 'test' into develop

This commit is contained in:
suyuan 2020-10-31 17:03:59 +08:00
commit 87e94457b3
16 changed files with 123 additions and 48 deletions

View file

@ -46,25 +46,39 @@ interface_macaddr_count() {
[ "$macaddr" = "$dmacaddr" ] && nbmac=$((nbmac+1))
}
interface_max_metric() {
local config="$1"
config_get metric "$config" metric
if [ "$metric" = "$count" ]; then
count=$((count+1))
config_set "$config" metric $count
fi
if [ "$metric" -gt "$count" ]; then
count=$metric
fi
}
interface_multipath_settings() {
local mode iface proto
local mode iface proto metric
local config="$1"
local intf="$2"
local enabled
config_get enabled "$config" auto "1"
config_get iface "$config" ifname
config_get txqueuelen "$config" txqueuelen
[ -z "$iface" ] && iface=$(ifstatus "$config" | jsonfilter -q -e '@["l3_device"]')
if [ "$(uci -q get openmptcprouter.${config}.metric)" = "" ]; then
count=$(($count+1))
count=$((count+1))
metric=$count
else
count="$(uci -q get openmptcprouter.${config}.metric)"
metric="$(uci -q get openmptcprouter.${config}.metric)"
fi
config_set "$config" metric $count
uci -q set network.${config}.metric=$count
uci -q set openmptcprouter.${config}.metric=$count
config_set "$config" metric $metric
uci -q set network.${config}.metric=$metric
uci -q set openmptcprouter.${config}.metric=$metric
config_get mode "$config" multipath
id=$count
id=$metric
[ "$mode" = "" ] && {
mode="$(uci -q get openmptcprouter.${config}.multipath)"
[ -n "$mode" ] && uci -q set network.${config}.multipath="$mode"
@ -221,11 +235,11 @@ interface_multipath_settings() {
#echo "ip route replace default via $gateway dev $iface"
ip route replace default via $gateway dev $iface
}
[ "$mode" = "off" ] && {
ifconfig $iface txqueuelen 50 > /dev/null 2>&1
} || {
if [ "$txqueuelen" != "" ]; then
ifconfig $iface txqueuelen $txqueuelen > /dev/null 2>&1
else
ifconfig $iface txqueuelen 100 > /dev/null 2>&1
}
fi
fi
if [ "$(uci -q get openmptcprouter.settings.disable_ipv6)" != "1" ] && [ "$config" != "omr6in4" ]; then
# IPv6 Updates:
@ -398,6 +412,10 @@ start_service() {
mptcpintf=""
master=""
count="0"
config_load openmptcprouter
config_foreach interface_max_metric interface
config_load network
#config_foreach remove route
#config_foreach remove route6

View file

@ -511,13 +511,11 @@ if [ "$multipath_config" = "master" ]; then
if [ "$(uci -q get openmptcprouter.settings.master)" != "failover" ]; then
config_foreach set_server_default_route server
fi
ip route replace default via $OMR_TRACKER_DEVICE_GATEWAY dev $OMR_TRACKER_DEVICE table 991337
fi
#if [ "$(uci -q get openmptcprouter.settings.master)" = "balancing" ] && [ "$(ip route show default | grep weight)" = "" ] && [ "$(uci -q get openmptcprouter.settings.defaultgw)" != "0" ] && [ "$(uci -q get openmptcprouter.settings.vpn)" != "mlvpn" ]; then
if [ "$(uci -q get openmptcprouter.settings.master)" = "balancing" ] && [ "$(ip route show default | grep weight)" = "" ] && [ "$(uci -q get openmptcprouter.settings.defaultgw)" != "0" ]; then
omrvpn_intf=$(uci -q get "network.omrvpn.ifname" || echo "tun")
if [ -n "$omrvpn_intf" ] && [ "$(ip route show default | awk '/default/ {print $5}' | grep $omrvpn_intf)" = "" ]; then
ip route replace default via $OMR_TRACKER_DEVICE_GATEWAY dev $OMR_TRACKER_DEVICE table 991337
routesbalancing=""
routesbalancingbackup=""
nbintf=0
@ -537,6 +535,9 @@ if [ "$multipath_config" = "master" ]; then
}
fi
fi
if [ -n "$OMR_TRACKER_DEVICE_GATEWAY" ] && [ -n "$OMR_TRACKER_DEVICE" ] && [ "$(ip r show table 991337)" != "default via $OMR_TRACKER_DEVICE_GATEWAY dev $OMR_TRACKER_DEVICE " ]; then
ip route replace default via $OMR_TRACKER_DEVICE_GATEWAY dev $OMR_TRACKER_DEVICE table 991337
fi
if [ "$(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
/etc/init.d/openmptcprouter-vps restart >/dev/null 2>&1
fi