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

Merge pull request #69 from Ysurac/develop

sync
This commit is contained in:
suyuan 2021-02-13 23:52:13 +08:00 committed by GitHub
commit c122aa2232
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 326 additions and 117 deletions

View file

@ -36,6 +36,15 @@ end
function wizard_add()
local gostatus = true
-- Force WAN zone firewall members to be a list
local fwwan = sys.exec("uci -q get firewall.@zone[1].network")
luci.sys.call("uci -q delete firewall.@zone[1].network")
for interface in fwwan:gmatch("%S+") do
luci.sys.call("uci -q add_list firewall.@zone[1].network=" .. interface)
end
ucic:save("firewall")
-- Add new server
local add_server = luci.http.formvalue("add_server") or ""
local add_server_name = luci.http.formvalue("add_server_name") or ""
@ -190,7 +199,9 @@ function wizard_add()
for intf, _ in pairs(delete_intf) do
local defif = ucic:get("network",intf,"ifname")
ucic:delete("network",intf)
ucic:delete("network",intf .. "_dev")
if ucic:get("network",intf .. "_dev") ~= "" then
ucic:delete("network",intf .. "_dev")
end
ucic:save("network")
ucic:commit("network")
ucic:delete("sqm",intf)
@ -298,7 +309,9 @@ function wizard_add()
if proto == "dhcpv6" then
ucic:set("network",intf,"reqaddress","try")
ucic:set("network",intf,"reqprefix","auto")
ucic:set("network",intf,"reqprefix","no")
ucic:set("network",intf,"iface_map","0")
ucic:set("network",intf,"ipv6","1")
end
ucic:delete("openmptcprouter",intf,"lc")

View file

@ -68,7 +68,7 @@
</div>
<h3><%=servername%></h3>
<div class="cbi-section-node" id="cbi-omr-wizard-<%=servername%>">
<div class="cbi-value" id="<%=servername%>.server_ip" data-depends="[{&#34;enableipv6&#34;:&#34;1&#34;}]" data-index="8">
<div class="cbi-value" id="<%=servername%>.server_ip" data-depends="[{&#34;enableipv6&#34;:&#34;1&#34;}]" data-index="1">
<label class="cbi-value-title" for="server_ip.1"><%:Server IP%></label>
<div class="cbi-value-field">
<input name="<%=servername%>.serverip.ip1" id="<%=servername%>.server_ip.1" placeholder="<%:Server IP%>" class="cbi-input-text" value="<%=uci:get_list("openmptcprouter",servername,"ip")[1]%>" data-optional="false">
@ -77,7 +77,7 @@
</div>
</div>
</div>
<div class="cbi-value" id="<%=servername%>.server_ipv6" data-depends="[{&#34;enableipv6&#34;:&#34;0&#34;}]" data-index="8">
<div class="cbi-value" id="<%=servername%>.server_ipv6" data-depends="[{&#34;enableipv6&#34;:&#34;0&#34;}]" data-index="1">
<label class="cbi-value-title" for="server_ip.1"><%:Server IP%></label>
<div class="cbi-value-field">
<input name="<%=servername%>.serverip.ip1" id="<%=servername%>.server_ip.1" placeholder="<%:Primary server IP%>" class="cbi-input-text" value="<%=uci:get_list("openmptcprouter",servername,"ip")[1]%>" data-optional="false">
@ -86,12 +86,12 @@
<%:Server IP will be set for proxy and VPN%>
</div>
<div class="cbi-value-description">
<%:A secondary server IP can be set for dual IPv4/IPv6 server contact if WAN IPv6 are set%>
<%:A second server's IP can be set for dual IPv4/IPv6 server if WAN IPv6 are set%>
</div>
</div>
</div>
<br />
<div class="cbi-value">
<div class="cbi-value" data-index="2">
<label class="cbi-value-title"><%:Server username%></label>
<div class="cbi-value-field">
<input type="text" name="<%=servername%>.openmptcprouter_vps_username" placeholder="<%:Server username%>" class="cbi-input-text" value="<%=uci:get("openmptcprouter",servername,"username")%>" data-optional="false">
@ -101,7 +101,7 @@
</div>
</div>
</div>
<div class="cbi-value">
<div class="cbi-value" data-index="3">
<label class="cbi-value-title"><%:Server key%></label>
<div class="cbi-value-field">
<input type="text" name="<%=servername%>.openmptcprouter_vps_key" placeholder="<%:Server key%>" class="cbi-input-text" value="<%=uci:get("openmptcprouter",servername,"password")%>" data-optional="false">
@ -115,7 +115,7 @@
if nbserver > 1 then
%>
<br />
<div class="cbi-value">
<div class="cbi-value" data-index="4">
<label class="cbi-value-title"><%:Set server as master%></label>
<div class="cbi-value-field">
<input class="cbi-input-radio" type="radio" name="master" value="<%=servername%>" <% if uci:get("openmptcprouter",servername,"master") == "1" then %>checked<% end %>/>
@ -129,7 +129,7 @@
end
%>
<br />
<div class="cbi-value">
<div class="cbi-value" data-index="5">
<label class="cbi-value-title"><%:Disable server%></label>
<div class="cbi-value-field">
<input class="cbi-input-radio" type="checkbox" name="<%=servername%>.openmptcprouter_vps_disabled" value="1" <% if uci:get("openmptcprouter",servername,"disabled") == "1" then %>checked<% end %>/>

View file

@ -1,5 +1,5 @@
#!/bin/sh /etc/rc.common
# Copyright (C) 2018 Ycarus (Yannick Chabanois) <ycarus@zugaina.org>
# Copyright (C) 2018-2021 Ycarus (Yannick Chabanois) <ycarus@zugaina.org> for OpenMPTCProuter
# Released under GPL 3. See LICENSE for the full terms.
START=5
@ -66,7 +66,7 @@ omr_set_settings() {
uci -q set openmptcprouter.$1=interface
uci -q set openmptcprouter.$1.multipath="$multipath"
config_get disable_ipv6 settings disable_ipv6 "0"
if [ "$disable_ipv6" = "1" ] || [ "$1" != "omr6in4" ]; then
if [ "$proto" != "dhcpv6" ] && ([ "$disable_ipv6" = "1" ] || [ "$1" != "omr6in4" ]); then
uci -q set network.$1.ipv6=0
else
uci -q set network.$1.ipv6=1
@ -78,6 +78,13 @@ omr_set_settings() {
[ -z "$ifname" ] && ifname=$(ifstatus "$1" | jsonfilter -q -e '@["l3_device"]')
if [ -n "$ifname" ]; then
if [ "$proto" = "dhcpv6" ]; then
# Change interface name for sysctl in case of VLAN (eth0.2 => eth0/2)
ifnamesys=$(echo $ifname | sed 's:\.:/:')
sysctl -qw net.ipv6.conf.${ifnamesys}.disable_ipv6=0
sysctl -qw net.ipv6.conf.${ifnamesys}.accept_ra=1
fi
if [ "$addlatency" = "0" ] && [ "$(tc qdisc show dev $ifname | grep delay)" != "" ]; then
tc qdisc del dev ${ifname} root netem
fi

View file

@ -1232,7 +1232,12 @@ function interfaces_status()
if gateway ~= "" or gateway6 ~= "" then
if uci:get("openmptcprouter", "settings", "disablegwping") ~= "1" and connectivity ~= "ERROR" then
if gateway ~= "" then
local gw_ping_test = ut.trim(sys.exec("ping -w 1 -c 1 " .. gateway .. " | grep '100% packet loss'"))
local gw_ping_test = ""
if ifname ~= "" and ifname ~= nil then
gw_ping_test = ut.trim(sys.exec("ping -w 1 -c 1 -I " .. ifname .. " " .. gateway .. " | grep '100% packet loss'"))
else
gw_ping_test = ut.trim(sys.exec("ping -w 1 -c 1 " .. gateway .. " | grep '100% packet loss'"))
end
if gw_ping_test ~= "" then
gw_ping = "DOWN"
if connectivity == "OK" then
@ -1241,7 +1246,12 @@ function interfaces_status()
end
end
if gateway6 ~= "" then
local gw_ping6_test = ut.trim(sys.exec("ping -w 1 -c 1 " .. gateway6 .. " | grep '100% packet loss'"))
local gw_ping6_test = ""
if ifname ~= "" and ifname ~= nil then
gw_ping6_test = ut.trim(sys.exec("ping -w 1 -c 1 -I " .. ifname .. " " .. gateway6 .. " | grep '100% packet loss'"))
else
gw_ping6_test = ut.trim(sys.exec("ping -w 1 -c 1 " .. gateway6 .. " | grep '100% packet loss'"))
end
if gw_ping6_test ~= "" then
gw_ping6 = "DOWN"
if connectivity == "OK" then