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

Merge pull request #14 from Ysurac/develop

tongbu
This commit is contained in:
suyuan 2020-10-31 16:31:49 +08:00 committed by GitHub
commit 55d672622c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 123 additions and 48 deletions

View file

@ -46,6 +46,7 @@ jobs:
git clone --depth 1 $REPO_URL omr git clone --depth 1 $REPO_URL omr
cd omr cd omr
if [ "$SOURCE_NAME" != "Test-Github-Actions" ] && [ "$SOURCE_NAME" != "develop" ]; then if [ "$SOURCE_NAME" != "Test-Github-Actions" ] && [ "$SOURCE_NAME" != "develop" ]; then
git fetch
git checkout master git checkout master
else else
git checkout develop git checkout develop

View file

@ -80,6 +80,9 @@ start_instance() {
procd_close_instance procd_close_instance
tc qdisc replace dev ${dev} root cake
#ip link set $dev txqlen 100
#config_load network #config_load network
#config_foreach add_glorytun_path interface #config_foreach add_glorytun_path interface

View file

@ -194,7 +194,7 @@ right connector from last child*/
border-left: 2px solid black; border-left: 2px solid black;
border-bottom: none; border-bottom: none;
width: 2px; width: 2px;
height: 30px; height: 20em;
z-index: -10; z-index: -10;
} }
.remote-from-lease a { .remote-from-lease a {

View file

@ -93,7 +93,9 @@ function wizard_add()
ucic:foreach("network", "interface", function(s) ucic:foreach("network", "interface", function(s)
local sectionname = s[".name"] local sectionname = s[".name"]
if sectionname:match("^wan(%d+)$") then if sectionname:match("^wan(%d+)$") then
i = i + 1 if i <= tonumber(string.match(sectionname, '%d+')) then
i = tonumber(string.match(sectionname, '%d+')) + 1
end
end end
if ucic:get("network",sectionname,"multipath") == "master" then if ucic:get("network",sectionname,"multipath") == "master" then
multipath_master = true multipath_master = true

View file

@ -390,16 +390,30 @@ end
<% <%
iffind=0 iffind=0
for _, ifacea in ipairs(ifaces) do for _, ifacea in ipairs(ifaces) do
if not (ifacea == "lo" or ifacea == "6in4-omr6in4" or ifacea == "mlvpn0" or ifacea:match("^ifb.*") or ifacea:match("^sit.*") or ifacea:match("^gre.*") or ifacea:match("^ip6.*") or ifacea:match("^teql.*") or ifacea:match("^erspan.*") or ifacea:match("^tun.*")) and device_notvirtual(ifacea) then if not (ifacea == "lo" or ifacea == "6in4-omr6in4" or ifacea == "mlvpn0" or ifacea:match("^ifb.*") or ifacea:match("^sit.*") or ifacea:match("^gre.*") or ifacea:match("^ip6.*") or ifacea:match("^teql.*") or ifacea:match("^erspan.*") or ifacea:match("^tun.*")) then
if uci:get("network",ifname,"proto") ~= "macvlan" then
%> %>
<option value="<%=ifacea%>"<% if uci:get("network",ifname,"ifname") == ifacea then iffind = 1 %> selected="selected"<% end %>><%=ifacea%></option> <option value="<%=ifacea%>"<% if uci:get("network",ifname,"ifname") == ifacea then iffind = 1 %> selected="selected"<% end %>><%=ifacea%></option>
<% <%
else
%>
<option value="<%=ifacea%>"<% if uci:get("network",ifname,"masterintf") == ifacea then iffind = 1 %> selected="selected"<% end %>><%=ifacea%></option>
<%
end
end end
end end
if iffinf == 0 and uci:get("network",ifname,"ifname") ~= nil then if uci:get("network",ifname,"proto") ~= "macvlan" then
if iffind == 0 and uci:get("network",ifname,"ifname") ~= nil then
%> %>
<option value="<%=uci:get("network",ifname,"ifname")%>" selected="selected"><%=uci:get("network",ifname,"ifname")%></option> <option value="<%=uci:get("network",ifname,"ifname")%>" selected="selected"><%=uci:get("network",ifname,"ifname")%></option>
<% <%
end
else
if iffind == 0 and uci:get("network",ifname,"masterintf") ~= nil then
%>
<option value="<%=uci:get("network",ifname,"masterintf")%>" selected="selected"><%=uci:get("network",ifname,"masterintf")%></option>
<%
end
end end
%> %>
</select> </select>
@ -481,7 +495,7 @@ end
<select class="cbi-input-select" data-update="change" id="cbid.network.<%=ifname%>.masterintf" name="cbid.network.<%=ifname%>.masterintf" size="1"> <select class="cbi-input-select" data-update="change" id="cbid.network.<%=ifname%>.masterintf" name="cbid.network.<%=ifname%>.masterintf" size="1">
<% <%
for _, ifacea in ipairs(ifaces) do for _, ifacea in ipairs(ifaces) do
if not (ifacea == "lo" or ifacea == "6in4-omr6in4" or ifacea:match("^ifb.*") or ifacea:match("^sit.*") or ifacea:match("^gre.*") or ifacea:match("^ip6.*") or ifacea:match("^teql.*") or ifacea:match("^erspan.*") or ifacea:match("^tun.*")) and device_notvirtual(ifacea) then if not (ifacea == "lo" or ifacea == "6in4-omr6in4" or ifacea:match("^ifb.*") or ifacea:match("^sit.*") or ifacea:match("^gre.*") or ifacea:match("^ip6.*") or ifacea:match("^teql.*") or ifacea:match("^erspan.*") or ifacea:match("^tun.*")) then
%> %>
<option value="<%=ifacea%>"<% if uci:get("network",ifname,"masterintf") == ifacea then %> selected="selected"<% end %>><%=ifacea%></option> <option value="<%=ifacea%>"<% if uci:get("network",ifname,"masterintf") == ifacea then %> selected="selected"<% end %>><%=ifacea%></option>
<% <%
@ -804,7 +818,7 @@ end
<select class="cbi-section-create-name" name="add_interface_ifname"> <select class="cbi-section-create-name" name="add_interface_ifname">
<% <%
for _, ifacea in ipairs(ifaces) do for _, ifacea in ipairs(ifaces) do
if not (ifacea == "lo" or ifacea == "6in4-omr6in4" or ifacea == "mlvpn0" or ifacea:match("^ifb.*") or ifacea:match("^sit.*") or ifacea:match("^gre.*") or ifacea:match("^ip6.*") or ifacea:match("^teql.*") or ifacea:match("^erspan.*")) and device_notvirtual(ifacea) then if not (ifacea == "lo" or ifacea == "6in4-omr6in4" or ifacea == "mlvpn0" or ifacea:match("^ifb.*") or ifacea:match("^sit.*") or ifacea:match("^gre.*") or ifacea:match("^ip6.*") or ifacea:match("^teql.*") or ifacea:match("^erspan.*")) then
%> %>
<option value="<%=ifacea%>"><%=ifacea%></option> <option value="<%=ifacea%>"><%=ifacea%></option>
<% <%

View file

@ -23,25 +23,27 @@ omr_intf_set() {
config_get ifname "$1" ifname config_get ifname "$1" ifname
config_get device "$1" device config_get device "$1" device
config_get proto "$1" proto config_get proto "$1" proto
config_get addlatency "$1" addlatency "0" config_get type "$1" type
config_get addlatency "$1" addlatency
[ -z "$addlatency" ] && addlatency=0
devicename=$(echo "$device" | cut -d'/' -f3) devicename=$(echo "$device" | cut -d'/' -f3)
[ -z "$ifname" ] && ifname=$(ifstatus "$1" | jsonfilter -q -e '@["l3_device"]') [ -z "$ifname" ] && ifname=$(ifstatus "$1" | jsonfilter -q -e '@["l3_device"]')
if [ -n "$ifname" ]; then if [ -n "$ifname" ]; then
if [ "$addlatency" = "0" ] && [ "$(tc qdisc show $ifname | grep delay)" != "" ]; then if [ "$addlatency" = "0" ] && [ "$(tc qdisc show dev $ifname | grep delay)" != "" ]; then
tc qdisc del dev ${ifname} root netem tc qdisc del dev ${ifname} root netem
fi fi
if [ "$addlatency" != "0" ]; then if [ "$addlatency" != "0" ]; then
if [ "$(tc qdisc show $ifname | grep delay)" != "" ]; then if [ "$(tc qdisc show dev $ifname | grep delay)" != "" ]; then
tc qdisc add dev ${ifname} root netem delay ${addlatency}ms tc qdisc add dev ${ifname} root netem delay ${addlatency}ms
elif [ "$(tc qdisc show $ifname | awk '/delay/ { print $10 }' | sed 's/ms//')" != "$addlatency" ]; then elif [ "$(tc qdisc show dev $ifname | awk '/delay/ { print $10 }' | sed 's/ms//')" != "$addlatency" ]; then
tc qdisc replace dev ${ifname} root netem delay ${addlatency}ms tc qdisc replace dev ${ifname} root netem delay ${addlatency}ms
fi fi
fi fi
fi fi
if [ -n "$ifname" ] && [ -f /sys/class/net/${ifname}/device/uevent ]; then if [ "$type" != "macvlan" ] && [ -n "$ifname" ] && [ -f /sys/class/net/${ifname}/device/uevent ]; then
devicepath=$(readlink -f /sys/class/net/${ifname}) devicepath=$(readlink -f /sys/class/net/${ifname})
if [ -n "$devicepath" ] && [ "$(echo ${devicepath} | grep virtual)" = "" ]; then if [ -n "$devicepath" ] && [ "$(echo ${devicepath} | grep virtual)" = "" ]; then
uci -q set network.$1.modalias="$(cat /sys/class/net/${ifname}/device/uevent | grep MODALIAS | cut -d '=' -f2 | tr -d '\n')" uci -q set network.$1.modalias="$(cat /sys/class/net/${ifname}/device/uevent | grep MODALIAS | cut -d '=' -f2 | tr -d '\n')"
@ -50,7 +52,7 @@ omr_intf_set() {
uci -q delete network.$1.device uci -q delete network.$1.device
uci -q delete network.$1.modalias uci -q delete network.$1.modalias
fi fi
elif [ -n "$device" ] && [ -f /sys/bus/usb-serial/devices/${devicename}/device/uevent ]; then elif [ "$type" != "macvlan" ] && [ -n "$device" ] && [ -f /sys/bus/usb-serial/devices/${devicename}/device/uevent ]; then
uci -q set network.$1.modalias="$(cat /sys/bus/usb-serial/devices/${devicename}/device/uevent | grep MODALIAS | cut -d '=' -f2 | tr -d '\n')" uci -q set network.$1.modalias="$(cat /sys/bus/usb-serial/devices/${devicename}/device/uevent | grep MODALIAS | cut -d '=' -f2 | tr -d '\n')"
uci -q set network.$1.product="$(cat /sys/bus/usb-serial/devices/${devicename}/device/uevent | grep PRODUCT | cut -d '=' -f2 | tr -d '\n')" uci -q set network.$1.product="$(cat /sys/bus/usb-serial/devices/${devicename}/device/uevent | grep PRODUCT | cut -d '=' -f2 | tr -d '\n')"
fi fi

View file

@ -67,6 +67,7 @@ _setup_interface() {
[ -z "$(uci -q get network.$1.masterintf)" ] && uci -q set network.$1.masterintf=$(uci -q get network.$1_dev.ifname) [ -z "$(uci -q get network.$1.masterintf)" ] && uci -q set network.$1.masterintf=$(uci -q get network.$1_dev.ifname)
[ -n "$(uci -q get network.$1.masterintf)" ] && uci -q set network.$1_dev.ifname=$(uci -q get network.$1.masterintf) [ -n "$(uci -q get network.$1.masterintf)" ] && uci -q set network.$1_dev.ifname=$(uci -q get network.$1.masterintf)
[ -z "$(uci -q get network.$1.macaddr)" ] && uci -q set network.$1_dev.macaddr=$(uci -q get network.$1.macaddr) [ -z "$(uci -q get network.$1.macaddr)" ] && uci -q set network.$1_dev.macaddr=$(uci -q get network.$1.macaddr)
uci set network.$1.ifname=$1
uci -q commit network uci -q commit network
return 0 return 0
} }

View file

@ -2,7 +2,7 @@ config mlvpn 'general'
option enable '0' option enable '0'
option password '' option password ''
option timeout '30' option timeout '30'
option reorder_buffer_size '64' option reorder_buffer_size '128'
option loss_tolerence '50' option loss_tolerence '50'
option mode 'client' option mode 'client'
option host '128.128.128.128' option host '128.128.128.128'

View file

@ -4,7 +4,6 @@ START=88
SERVICE_DAEMONIZE=1 SERVICE_DAEMONIZE=1
#SERVICE_SIG="KILL" #SERVICE_SIG="KILL"
interface_multipath_settings() { interface_multipath_settings() {
local mode port local mode port
local config="$1" local config="$1"
@ -53,9 +52,9 @@ start() {
mode = "${mode}" mode = "${mode}"
interface_name = "${interface_name}" interface_name = "${interface_name}"
timeout = ${timeout} timeout = ${timeout}
#reorder_buffer = yes reorder_buffer = yes
reorder_buffer_size = ${reorder_buffer_size} reorder_buffer_size = ${reorder_buffer_size}
#loss_tolerence = ${loss_tolerence} loss_tolerence = ${loss_tolerence}
password = "${password}" password = "${password}"
mtu = 1452 mtu = 1452
EOF EOF
@ -71,3 +70,8 @@ start() {
stop() { stop() {
service_stop /usr/sbin/mlvpn service_stop /usr/sbin/mlvpn
} }
reload() {
stop
start
}

View file

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

View file

@ -511,13 +511,11 @@ if [ "$multipath_config" = "master" ]; then
if [ "$(uci -q get openmptcprouter.settings.master)" != "failover" ]; then if [ "$(uci -q get openmptcprouter.settings.master)" != "failover" ]; then
config_foreach set_server_default_route server config_foreach set_server_default_route server
fi fi
ip route replace default via $OMR_TRACKER_DEVICE_GATEWAY dev $OMR_TRACKER_DEVICE table 991337
fi 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" ] && [ "$(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 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") 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 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="" routesbalancing=""
routesbalancingbackup="" routesbalancingbackup=""
nbintf=0 nbintf=0
@ -537,6 +535,9 @@ if [ "$multipath_config" = "master" ]; then
} }
fi fi
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 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 /etc/init.d/openmptcprouter-vps restart >/dev/null 2>&1
fi fi

View file

@ -2,15 +2,15 @@ config defaults 'defaults'
option enabled '1' option enabled '1'
list hosts '4.2.2.1' list hosts '4.2.2.1'
list hosts '8.8.8.8' list hosts '8.8.8.8'
list hosts '80.67.169.12'
list hosts '8.8.4.4' list hosts '8.8.4.4'
list hosts '9.9.9.9' list hosts '9.9.9.9'
list hosts '1.1.1.1'
list hosts '1.0.0.1' list hosts '1.0.0.1'
list hosts '114.114.115.115'
list hosts '1.2.4.8' list hosts '1.2.4.8'
list hosts '80.67.169.12'
list hosts '80.67.169.40' list hosts '80.67.169.40'
list hosts '114.114.114.114' list hosts '114.114.114.114'
list hosts '114.114.115.115' list hosts '1.1.1.1'
option timeout '2' option timeout '2'
option tries '3' option tries '3'
option interval '2' option interval '2'
@ -20,12 +20,12 @@ config defaults 'defaults'
config proxy 'proxy' config proxy 'proxy'
option enabled '1' option enabled '1'
list hosts '1.1.1.1'
list hosts '1.0.0.1' list hosts '1.0.0.1'
list hosts '212.27.48.10' list hosts '212.27.48.10'
list hosts '198.27.92.1' list hosts '198.27.92.1'
list hosts '151.101.129.164' list hosts '151.101.129.164'
list hosts '77.88.55.77' list hosts '77.88.55.77'
list hosts '1.1.1.1'
list hosts '74.82.42.42' list hosts '74.82.42.42'
list hosts '176.103.130.130' list hosts '176.103.130.130'
option timeout '10' option timeout '10'

View file

@ -11,8 +11,10 @@ _setup_rules() {
_setup_routes() { _setup_routes() {
config_get lookup $1 lookup config_get lookup $1 lookup
config_get gateway $1 gateway config_get gateway $1 gateway
intf=$(ifstatus | jsonfilter -e '@.l3_device' | tr -d "\n") intf=$(ifstatus $1 | jsonfilter -e '@.l3_device' | tr -d "\n")
ip route replace default via $gateway dev $intf table $lookup if [ -n "$lookup" ] && [ -n "$intf" ] && [ -n "$gateway" ]; then
ip route replace default via $gateway dev $intf table $lookup
fi
} }
config_load network config_load network
config_foreach _setup_rules interface config_foreach _setup_rules interface

View file

@ -668,6 +668,7 @@ _set_vpn_ip() {
vpnip_remote=$(ip -4 r list dev ${vpnifname} | grep via | grep -v default | grep -v / | grep -v metric | awk '{print $1}' | tr -d "\n") vpnip_remote=$(ip -4 r list dev ${vpnifname} | grep via | grep -v default | grep -v / | grep -v metric | awk '{print $1}' | tr -d "\n")
[ -z "$vpnip_remote" ] && vpnip_remote=$(ip -4 r list dev ${vpnifname} | grep kernel | awk '{print $1}' | tr -d "\n") [ -z "$vpnip_remote" ] && vpnip_remote=$(ip -4 r list dev ${vpnifname} | grep kernel | awk '{print $1}' | tr -d "\n")
[ -z "$vpnip_remote" ] && vpnip_remote=$(ip -4 r list dev ${vpnifname} | grep "proto static src" | awk '{print $3}' | tr -d "\n") [ -z "$vpnip_remote" ] && vpnip_remote=$(ip -4 r list dev ${vpnifname} | grep "proto static src" | awk '{print $3}' | tr -d "\n")
[ -z "$vpnip_remote" ] && vpnip_remote=$(ifstatus omrvpn | jsonfilter -e '@.route[0].nexthop')
ula="$(uci -q get network.globals.ula_prefix)" ula="$(uci -q get network.globals.ula_prefix)"
ula_current="$(echo "$vps_config" | jsonfilter -q -e '@.ip6in4.ula')" ula_current="$(echo "$vps_config" | jsonfilter -q -e '@.ip6in4.ula')"
if [ "$vpnip_remote" != "" ] && [ "$vpnip_local" != "" ] && ([ "$vpnip_remote" != "$vpnip_remote_current" ] || [ "$vpnip_local" != "$vpnip_local_current" ] || [ "$ula" != "$ula_current" ]); then if [ "$vpnip_remote" != "" ] && [ "$vpnip_local" != "" ] && ([ "$vpnip_remote" != "$vpnip_remote_current" ] || [ "$vpnip_local" != "$vpnip_local_current" ] || [ "$ula" != "$ula_current" ]); then
@ -724,7 +725,7 @@ _vps_firewall_redirect_port() {
#uci -q delete firewall.$1 #uci -q delete firewall.$1
#return #return
fi fi
[ "$(v2ray.main.enabled)" = "0" ] && v2ray="0" [ "$(uci -q get v2ray.main.enabled)" = "0" ] && v2ray="0"
[ "$proto" = "all" ] && proto="tcp udp" [ "$proto" = "all" ] && proto="tcp udp"
[ "$proto" = "" ] && proto="tcp udp" [ "$proto" = "" ] && proto="tcp udp"
[ "$src" = "vpn" ] && [ -n "$proto" ] && [ -n "$src_dport" ] && [ "$enabled" != "0" ] && { [ "$src" = "vpn" ] && [ -n "$proto" ] && [ -n "$src_dport" ] && [ "$enabled" != "0" ] && {

View file

@ -16,16 +16,16 @@ if [ "$(uci -q get firewall.@zone[2].name)" = "vpn" ]; then
fi fi
if [ "$(uci -q get firewall.zone_vpn)" = "" ]; then if [ "$(uci -q get firewall.zone_vpn)" = "" ]; then
uci -q batch <<-EOF >/dev/null uci -q batch <<-EOF >/dev/null
set firewall.zone_vpn=zone set firewall.zone_vpn=zone
set firewall.zone_vpn.name=vpn set firewall.zone_vpn.name=vpn
set firewall.zone_vpn.network=glorytun set firewall.zone_vpn.network=glorytun
set firewall.zone_vpn.masq=1 set firewall.zone_vpn.masq=1
set firewall.zone_vpn.input=REJECT set firewall.zone_vpn.input=REJECT
set firewall.zone_vpn.forward=ACCEPT set firewall.zone_vpn.forward=ACCEPT
set firewall.zone_vpn.output=ACCEPT set firewall.zone_vpn.output=ACCEPT
commit firewall commit firewall
EOF EOF
fi fi
if [ "$(uci -q get firewall.@rule[5].name)" = "Allow-ICMPv6-Input" ]; then if [ "$(uci -q get firewall.@rule[5].name)" = "Allow-ICMPv6-Input" ]; then
@ -131,6 +131,26 @@ if [ "$(uci -q get firewall.fwlantovpn)" = "" ]; then
commit firewall commit firewall
EOF EOF
fi fi
if [ "$(uci -q get firewall.blockquicproxy)" = "" ]; then
uci -q batch <<-EOF >/dev/null
set firewall.blockquicproxy=rule
set firewall.blockquicproxy.name='Block QUIC Proxy'
set firewall.blockquicproxy.proto='udp'
set firewall.blockquicproxy.dest_port='443'
set firewall.blockquicproxy.target='DROP'
set firewall.blockquicproxy.src='lan'
set firewall.blockquicall=rule
set firewall.blockquicall.name='Block QUIC All'
set firewall.blockquicall.proto='udp'
set firewall.blockquicall.src='*'
set firewall.blockquicall.dest='*'
set firewall.blockquicall.dest_port='443'
set firewall.blockquicall.target='DROP'
commit firewall
EOF
fi
uci -q batch <<-EOF >/dev/null uci -q batch <<-EOF >/dev/null
set firewall.@zone[0].mtu_fix='1' set firewall.@zone[0].mtu_fix='1'
set firewall.zone_vpn.mtu_fix='1' set firewall.zone_vpn.mtu_fix='1'

View file

@ -23,7 +23,7 @@ if [ -z "$(uci -q get v2ray.main)" ]; then
set v2ray.policy_level_0=policy_level set v2ray.policy_level_0=policy_level
set v2ray.policy_level_0.level='0' set v2ray.policy_level_0.level='0'
set v2ray.policy_level_0.handshake='4' set v2ray.policy_level_0.handshake='4'
set v2ray.policy_level_0.conn_idle='600' set v2ray.policy_level_0.conn_idle='2400'
set v2ray.policy_level_0.uplink_only='0' set v2ray.policy_level_0.uplink_only='0'
set v2ray.policy_level_0.downlink_only='0' set v2ray.policy_level_0.downlink_only='0'
set v2ray.policy_level_0.buffer_size='512' set v2ray.policy_level_0.buffer_size='512'
@ -94,11 +94,17 @@ EOF
if [ "$(uci -q get firewall.v2ray)" = "" ]; then if [ "$(uci -q get firewall.v2ray)" = "" ]; then
uci -q batch <<-EOF >/dev/null uci -q batch <<-EOF >/dev/null
set firewall.v2ray=include set firewall.v2ray=include
set firewall.v2ray.path=/etc/firewall.v2ray set firewall.v2ray.path=/etc/firewall.v2ray-rules
set firewall.v2ray.reload=1 set firewall.v2ray.reload=1
commit firewall commit firewall
EOF EOF
fi fi
if [ "$(uci -q get firewall.v2ray.path)" != "/etc/firewall.v2ray-rules" ]; then
uci -q batch <<-EOF >/dev/null
set firewall.v2ray.path=/etc/firewall.v2ray-rules
commit firewall
EOF
fi
if [ "$(uci -q get v2ray.main_reverse.bridges | grep omrbridge)" = "" ]; then if [ "$(uci -q get v2ray.main_reverse.bridges | grep omrbridge)" = "" ]; then
uci -q batch <<-EOF >/dev/null uci -q batch <<-EOF >/dev/null