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

Fix related to MPTCP over VPN

This commit is contained in:
Ycarus (Yannick Chabanois) 2021-05-17 12:29:08 +02:00
parent 54baf79957
commit d0c34a4cc8
4 changed files with 28 additions and 11 deletions

View file

@ -1,5 +1,5 @@
#!/bin/sh /etc/rc.common
# Copyright (C) 2019 Ycarus (Yannick Chabanois) <ycarus@zugaina.org>
# Copyright (C) 2019 - 2021 Ycarus (Yannick Chabanois) <ycarus@zugaina.org> for OpenMPTCProuter
# Released under GPL 3. See LICENSE for the full terms.
{
@ -25,7 +25,7 @@ _getremoteip() {
mptcp_over_vpn() {
local interface=$1
nbintf=$(($nbintf+1))
[ -n "$(uci show firewall.zone_wan.network | grep $interface)" ] && nbintf=$(($nbintf+1))
if [ "$(uci -q get openmptcprouter.${interface}.multipathvpn)" = "1" ]; then
if [ "$(uci -q get network.${interface})" = "" ]; then
uci -q batch <<-EOF >/dev/null
@ -218,6 +218,17 @@ start_service()
[ -z "$vpn" ] && vpn="openvpn"
config_load openmptcprouter
config_foreach mptcp_over_vpn interface
if [ "$nbintf" = "$nbintfvpn" ] && [ "$nbintf" != "0" ] && [ "$nbintfvpn" != "0" ]; then
uci -q batch <<-EOF >/dev/null
set openmptcprouter.settings.allmptcpovervpn='1'
commit openmptcprouter
EOF
else
uci -q batch <<-EOF >/dev/null
set openmptcprouter.settings.allmptcpovervpn='0'
commit openmptcprouter
EOF
fi
if [ "$nbintf" = "$nbintfvpn" ] && [ "$nbintf" != "0" ]; then
if [ "$vpn" = "openvpn" ]; then
uci -q batch <<-EOF >/dev/null
@ -286,6 +297,8 @@ start_service()
uci -q batch <<-EOF >/dev/null
commit shadowsocks-libev
EOF
/etc/init.d/shadowsocks restart
/etc/init.d/openvpn restart
elif [ "$(uci -q get shadowsocks-libev.hivpn1)" != "" ]; then
for c in $(seq 1 $NBCPU); do
uci -q batch <<-EOF >/dev/null

View file

@ -185,8 +185,12 @@ _set_wireguard_vps() {
config_load network
config_foreach _get_wg_ipskey interface
local settings
settings='{"peers": ['$ipskey']}'
echo $(_set_json "wireguard" "$settings")
if [ -n "$ipskey" ]; then
settings='{"peers": ['$ipskey']}'
echo $(_set_json "wireguard" "$settings")
else
echo 1
fi
}
get_openvpn_key() {
@ -1808,7 +1812,7 @@ _config_service() {
[ -z "$(_set_openvpn_vps)" ] && error=1
[ -z "$(_set_mlvpn_vps)" ] && error=1
_set_vps_firewall
_set_wireguard_vps
[ -z "$(_set_wireguard_vps)" ] && error=1
fi
_backup_list
redirect_port="0"