mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-03-09 15:40:03 +00:00
Fix merge
This commit is contained in:
commit
8e9389f476
160 changed files with 26795 additions and 3701 deletions
|
@ -26,7 +26,11 @@ end
|
|||
function interface_from_device(dev)
|
||||
for _, iface in ipairs(net:get_networks()) do
|
||||
local ifacen = iface:name()
|
||||
local ifacename = ucic:get("network",ifacen,"ifname")
|
||||
local ifacename = ""
|
||||
ifacename = ucic:get("network",ifacen,"device")
|
||||
if ifacename == "" then
|
||||
ifacename = ucic:get("network",ifacen,"ifname")
|
||||
end
|
||||
if ifacename == dev then
|
||||
return ifacen
|
||||
end
|
||||
|
@ -34,6 +38,17 @@ function interface_from_device(dev)
|
|||
return ""
|
||||
end
|
||||
|
||||
function uci_device_from_interface(intf)
|
||||
intfname = ucic:get("network",intf,"device")
|
||||
deviceuci = ""
|
||||
ucic:foreach("network", "device", function(s)
|
||||
if intfname == ucic:get("network",s[".name"],"name") then
|
||||
deviceuci = s[".name"]
|
||||
end
|
||||
end)
|
||||
return deviceuci
|
||||
end
|
||||
|
||||
function wizard_add()
|
||||
local gostatus = true
|
||||
|
||||
|
@ -113,7 +128,10 @@ function wizard_add()
|
|||
end)
|
||||
local defif = "eth0"
|
||||
if add_interface_ifname == "" then
|
||||
local defif1 = ucic:get("network","wan1_dev","ifname") or ""
|
||||
local defif1 = ucic:get("network","wan1_dev","device") or ""
|
||||
if defif1 == "" then
|
||||
defif1 = ucic:get("network","wan1_dev","ifname") or ""
|
||||
end
|
||||
if defif1 ~= "" then
|
||||
defif = defif1
|
||||
end
|
||||
|
@ -126,17 +144,29 @@ function wizard_add()
|
|||
if ointf ~= "" then
|
||||
if ucic:get("network",ointf,"type") == "" then
|
||||
ucic:set("network",ointf,"type","macvlan")
|
||||
ucic:set("network",ointf,"device",ointf)
|
||||
ucic:set("network",ointf .. "_dev","device")
|
||||
ucic:set("network",ointf .. "_dev","type","macvlan")
|
||||
ucic:set("network",ointf .. "_dev","mode","vepa")
|
||||
ucic:set("network",ointf .. "_dev","ifname",defif)
|
||||
ucic:set("network",ointf .. "_dev","name",ointf)
|
||||
end
|
||||
wanif = "wan" .. i
|
||||
end
|
||||
|
||||
ucic:set("network","wan" .. i,"interface")
|
||||
ucic:set("network","wan" .. i,"ifname",defif)
|
||||
ucic:set("network","wan" .. i,"device",defif)
|
||||
ucic:set("network","wan" .. i,"proto","static")
|
||||
ucic:set("openmptcprouter","wan" .. i,"interface")
|
||||
if ointf ~= "" then
|
||||
ucic:set("network","wan" .. i,"type","macvlan")
|
||||
ucic:set("network","wan" .. i,"device","wan" .. i)
|
||||
ucic:set("network","wan" .. i,"masterintf",defif)
|
||||
ucic:set("network","wan" .. i .. "_dev","device")
|
||||
ucic:set("network","wan" .. i .. "_dev","type","macvlan")
|
||||
ucic:set("network","wan" .. i .. "_dev","mode","vepa")
|
||||
ucic:set("network","wan" .. i .. "_dev","ifname",defif)
|
||||
ucic:set("network","wan" .. i .. "_dev","name","wan" .. i)
|
||||
end
|
||||
ucic:set("network","wan" .. i,"ip4table","wan")
|
||||
if multipath_master then
|
||||
|
@ -171,7 +201,7 @@ function wizard_add()
|
|||
ucic:set("sqm","wan" .. i,"script","simple.qos")
|
||||
ucic:set("sqm","wan" .. i,"qdisc_advanced","0")
|
||||
ucic:set("sqm","wan" .. i,"linklayer","none")
|
||||
ucic:set("sqm","wan" .. i,"enabled","0")
|
||||
ucic:set("sqm","wan" .. i,"enabled","1")
|
||||
ucic:set("sqm","wan" .. i,"debug_logging","0")
|
||||
ucic:set("sqm","wan" .. i,"verbosity","5")
|
||||
ucic:set("sqm","wan" .. i,"download","0")
|
||||
|
@ -197,7 +227,10 @@ function wizard_add()
|
|||
local delete_intf = luci.http.formvaluetable("delete") or ""
|
||||
if delete_intf ~= "" then
|
||||
for intf, _ in pairs(delete_intf) do
|
||||
local defif = ucic:get("network",intf,"ifname")
|
||||
local defif = ucic:get("network",intf,"ifname") or ""
|
||||
if defif == "" then
|
||||
defif = ucic:get("network",intf,"ifname")
|
||||
end
|
||||
ucic:delete("network",intf)
|
||||
if ucic:get("network",intf .. "_dev") ~= "" then
|
||||
ucic:delete("network",intf .. "_dev")
|
||||
|
@ -251,6 +284,7 @@ function wizard_add()
|
|||
local sqmenabled = luci.http.formvalue("cbid.sqm.%s.enabled" % intf) or "0"
|
||||
local multipath = luci.http.formvalue("cbid.network.%s.multipath" % intf) or "on"
|
||||
local lan = luci.http.formvalue("cbid.network.%s.lan" % intf) or "0"
|
||||
local ttl = luci.http.formvalue("cbid.network.%s.ttl" % intf) or ""
|
||||
if typeintf ~= "" then
|
||||
if typeintf == "normal" then
|
||||
typeintf = ""
|
||||
|
@ -262,15 +296,42 @@ function wizard_add()
|
|||
end
|
||||
if typeintf == "macvlan" and masterintf ~= "" then
|
||||
ucic:set("network",intf,"type","macvlan")
|
||||
ucic:set("network",intf .. "_dev","device")
|
||||
ucic:set("network",intf .. "_dev","type","macvlan")
|
||||
ucic:set("network",intf .. "_dev","ifname",masterinf)
|
||||
ucic:set("network",intf .. "_dev","mode","vepa")
|
||||
ucic:set("network",intf .. "_dev","name",intf)
|
||||
ucic:set("network",intf,"masterintf",masterintf)
|
||||
elseif typeintf == "" and ifname ~= "" and (proto == "static" or proto == "dhcp" or proto == "dhcpv6") then
|
||||
ucic:set("network",intf,"ifname",ifname)
|
||||
ucic:set("network",intf,"device",ifname)
|
||||
if uci_device_from_interface(intf) == "" then
|
||||
ucic:set("network",intf .. "_dev","device")
|
||||
ucic:set("network",intf .. "_dev","name",ifname)
|
||||
end
|
||||
elseif typeintf == "" and device ~= "" and proto == "ncm" then
|
||||
ucic:set("network",intf,"device",device_ncm)
|
||||
if uci_device_from_interface(intf) == "" then
|
||||
ucic:set("network",intf .. "_dev","device")
|
||||
ucic:set("network",intf .. "_dev","name",device_ncm)
|
||||
end
|
||||
elseif typeintf == "" and device ~= "" and proto == "qmi" then
|
||||
ucic:set("network",intf,"device",device_qmi)
|
||||
if uci_device_from_interface(intf) == "" then
|
||||
ucic:set("network",intf .. "_dev","device")
|
||||
ucic:set("network",intf .. "_dev","name",device_qmi)
|
||||
end
|
||||
elseif typeintf == "" and device ~= "" and proto == "modemmanager" then
|
||||
ucic:set("network",intf,"device",device_manager)
|
||||
if uci_device_from_interface(intf) == "" then
|
||||
ucic:set("network",intf .. "_dev","device")
|
||||
ucic:set("network",intf .. "_dev","name",device_manager)
|
||||
end
|
||||
elseif typeintf == "" and ifname ~= "" and proto == "static" then
|
||||
ucic:set("network",intf,"device",ifname)
|
||||
if uci_device_from_interface(intf) == "" then
|
||||
ucic:set("network",intf .. "_dev","device")
|
||||
ucic:set("network",intf .. "_dev","name",ifname)
|
||||
end
|
||||
end
|
||||
if proto == "pppoe" then
|
||||
ucic:set("network",intf,"pppd_options","persist maxfail 0")
|
||||
|
@ -278,6 +339,13 @@ function wizard_add()
|
|||
if proto ~= "other" then
|
||||
ucic:set("network",intf,"proto",proto)
|
||||
end
|
||||
|
||||
uci_device = uci_device_from_interface(intf)
|
||||
if uci_device == "" then
|
||||
uci_device = intf .. "_dev"
|
||||
end
|
||||
ucic:set("network",uci_device,"ttl",ttl)
|
||||
|
||||
ucic:set("network",intf,"apn",apn)
|
||||
ucic:set("network",intf,"pincode",pincode)
|
||||
ucic:set("network",intf,"delay",delay)
|
||||
|
@ -342,7 +410,10 @@ function wizard_add()
|
|||
if not ucic:get("sqm",intf) ~= "" then
|
||||
local defif = get_device(intf)
|
||||
if defif == "" then
|
||||
defif = ucic:get("network",intf,"ifname") or ""
|
||||
defif = ucic:get("network",intf,"device") or ""
|
||||
if defif == "" then
|
||||
defif = ucic:get("network",intf,"ifname") or ""
|
||||
end
|
||||
end
|
||||
ucic:set("sqm",intf,"queue")
|
||||
ucic:set("sqm",intf,"interface",defif)
|
||||
|
@ -442,7 +513,7 @@ function wizard_add()
|
|||
ucic:set("network","omrvpn","proto","bonding")
|
||||
end
|
||||
if vpn_intf ~= "" then
|
||||
ucic:set("network","omrvpn","ifname",vpn_intf)
|
||||
ucic:set("network","omrvpn","device",vpn_intf)
|
||||
ucic:set("sqm","omrvpn","interface",vpn_intf)
|
||||
ucic:save("network")
|
||||
ucic:commit("network")
|
||||
|
@ -809,7 +880,7 @@ function wizard_add()
|
|||
|
||||
local dsvpn_key = luci.http.formvalue("dsvpn_key")
|
||||
if dsvpn_key ~= "" then
|
||||
ucic:set("dsvpn","vpn","port","65011")
|
||||
ucic:set("dsvpn","vpn","port","65401")
|
||||
ucic:set("dsvpn","vpn","key",dsvpn_key)
|
||||
ucic:set("dsvpn","vpn","localip","10.255.251.2")
|
||||
ucic:set("dsvpn","vpn","remoteip","10.255.251.1")
|
||||
|
@ -894,7 +965,7 @@ function wizard_add()
|
|||
-- Restart all
|
||||
menuentry = ucic:get("openmptcprouter","settings","menu") or "openmptcprouter"
|
||||
if gostatus == true then
|
||||
luci.sys.call("/etc/init.d/macvlan restart >/dev/null 2>/dev/null")
|
||||
--luci.sys.call("/etc/init.d/macvlan restart >/dev/null 2>/dev/null")
|
||||
luci.sys.call("(env -i /bin/ubus call network reload) >/dev/null 2>/dev/null")
|
||||
luci.sys.call("ip addr flush dev tun0 >/dev/null 2>/dev/null")
|
||||
luci.sys.call("/etc/init.d/omr-tracker stop >/dev/null 2>/dev/null")
|
||||
|
|
|
@ -473,7 +473,7 @@
|
|||
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.*") or ifacea:match("^bond.*")) and device_notvirtual(ifacea) 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,"device") == ifacea then iffind = 1 %> selected="selected"<% end %>><%=ifacea%></option>
|
||||
<%
|
||||
else
|
||||
%>
|
||||
|
@ -483,9 +483,9 @@
|
|||
end
|
||||
end
|
||||
if uci:get("network",ifname,"proto") ~= "macvlan" then
|
||||
if iffind == 0 and uci:get("network",ifname,"ifname") ~= nil then
|
||||
if iffind == 0 and uci:get("network",ifname,"device") ~= nil then
|
||||
%>
|
||||
<option value="<%=uci:get("network",ifname,"ifname")%>" selected="selected"><%=uci:get("network",ifname,"ifname")%></option>
|
||||
<option value="<%=uci:get("network",ifname,"device")%>" selected="selected"><%=uci:get("network",ifname,"device")%></option>
|
||||
<%
|
||||
end
|
||||
else
|
||||
|
@ -616,7 +616,7 @@
|
|||
<select class="cbi-input-select" data-update="change" id="cbid.network.<%=ifname%>.intf" name="cbid.network.<%=ifname%>.intf" size="1">
|
||||
<%
|
||||
iffind=0
|
||||
uciifname=uci:get("network",ifname,"ifname")
|
||||
uciifname=uci:get("network",ifname,"device")
|
||||
if uciifname ~= nil then
|
||||
if uciifname:match("/") then
|
||||
realifname=uciifname
|
||||
|
@ -682,7 +682,7 @@
|
|||
<div class="cbi-value" id="cbi-network-<%=ifname%>-ipv6address" data-index="8">
|
||||
<label class="cbi-value-title"><%:IPv6 address%></label>
|
||||
<div class="cbi-value-field">
|
||||
<input type="text" id="cbid.network.<%=ifname%>.ip6addr" name="cbid.network.<%=ifname%>.ip6addr" class="cbi-input-text" value="<%=value%>" data-type="ip6addr">
|
||||
<input type="text" id="cbid.network.<%=ifname%>.ip6addr" name="cbid.network.<%=ifname%>.ip6addr" class="cbi-input-text" value="<%=value%>" data-type="ip6addr" data-optional="true">
|
||||
<br />
|
||||
<div class="cbi-value-description">
|
||||
<%:Set an IP in the same network as the modem%>
|
||||
|
@ -696,7 +696,7 @@
|
|||
<div class="cbi-value" id="cbi-network-<%=ifname%>-ip6gw" data-index="9">
|
||||
<label class="cbi-value-title"><%:IPv6 gateway%></label>
|
||||
<div class="cbi-value-field">
|
||||
<input type="text" id="cbid.network.<%=ifname%>.ip6gw" name="cbid.network.<%=ifname%>.ip6gw" class="cbi-input-text" value="<%=uci:get("network",ifname,"ip6gw")%>" data-type="ip6addr">
|
||||
<input type="text" id="cbid.network.<%=ifname%>.ip6gw" name="cbid.network.<%=ifname%>.ip6gw" class="cbi-input-text" value="<%=uci:get("network",ifname,"ip6gw")%>" data-type="ip6addr" data-optional="true">
|
||||
<br />
|
||||
<div class="cbi-value-description">
|
||||
<%:Set here IP of the modem%>
|
||||
|
@ -893,6 +893,16 @@
|
|||
<%
|
||||
end
|
||||
%>
|
||||
<div class="cbi-value" data-index="14">
|
||||
<label class="cbi-value-title"><%:Force TTL%></label>
|
||||
<div class="cbi-value-field">
|
||||
<input type="text" name="cbid.network.<%=ifname%>.ttl" class="cbi-input-text" value="<%=ttl%>" data-type="uinteger" data-optional="true">
|
||||
<br />
|
||||
<div class="cbi-value-description">
|
||||
<%:You can force a TTL. Some LTE provider detect tethering by inpecting packet TTL value, setting it to 65 often solve the issue.%>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%
|
||||
local download = "0"
|
||||
|
@ -909,7 +919,7 @@
|
|||
-- end
|
||||
--end
|
||||
%>
|
||||
<div class="cbi-value" data-index="14">
|
||||
<div class="cbi-value" data-index="15">
|
||||
<label class="cbi-value-title"><%:MPTCP over VPN%></label>
|
||||
<div class="cbi-value-field">
|
||||
<input class="cbi-input-checkbox" type="checkbox" name="multipathvpn.<%=ifname%>.enabled" value="1" <% if uci:get("openmptcprouter",ifname,"multipathvpn") == "1" then %>checked<% end %> />
|
||||
|
@ -919,7 +929,7 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cbi-value" data-index="15">
|
||||
<div class="cbi-value" data-index="16">
|
||||
<label class="cbi-value-title"><%:Enable SQM%></label>
|
||||
<div class="cbi-value-field">
|
||||
<input class="cbi-input-checkbox" type="checkbox" name="cbid.sqm.<%=ifname%>.enabled" value="1" <% if uci:get("sqm",ifname,"enabled") == "1" then %>checked<% end %> />
|
||||
|
@ -929,7 +939,7 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cbi-value" data-index="16">
|
||||
<div class="cbi-value" data-index="17">
|
||||
<label class="cbi-value-title"><%:Download speed (Kb/s)%></label>
|
||||
<div class="cbi-value-field">
|
||||
<input type="text" name="cbid.sqm.<%=ifname%>.download" class="cbi-input-text" value="<%=download%>" data-type="uinteger">
|
||||
|
@ -945,7 +955,7 @@
|
|||
-->
|
||||
</div>
|
||||
</div>
|
||||
<div class="cbi-value" data-index="17">
|
||||
<div class="cbi-value" data-index="18">
|
||||
<label class="cbi-value-title"><%:Upload speed (Kb/s)%></label>
|
||||
<div class="cbi-value-field">
|
||||
<input type="text" name="cbid.sqm.<%=ifname%>.upload" class="cbi-input-text" value="<%=upload%>" data-type="uinteger">
|
||||
|
|
|
@ -12,9 +12,17 @@ get_mptcp_from_server() {
|
|||
get_mptcp() {
|
||||
serverip=$1
|
||||
if [ "$(echo $serverip | grep :)" ]; then
|
||||
support="$(curl -s -k -6 -m ${timeout} --interface $intf https://[$serverip]:$serverport/mptcpsupport)"
|
||||
if [ -f /proc/sys/net/mptcp/enabled ]; then
|
||||
support="$(mptcpize run curl -s -k -6 -m ${timeout} --interface $intf https://[$serverip]:$serverport/mptcpsupport)"
|
||||
else
|
||||
support="$(curl -s -k -6 -m ${timeout} --interface $intf https://[$serverip]:$serverport/mptcpsupport)"
|
||||
fi
|
||||
else
|
||||
support="$(curl -s -k -4 -m ${timeout} --interface $intf https://$serverip:$serverport/mptcpsupport)"
|
||||
if [ -f /proc/sys/net/mptcp/enabled ]; then
|
||||
support="$(mptcpize run curl -s -k -4 -m ${timeout} --interface $intf https://$serverip:$serverport/mptcpsupport)"
|
||||
else
|
||||
support="$(curl -s -k -4 -m ${timeout} --interface $intf https://$serverip:$serverport/mptcpsupport)"
|
||||
fi
|
||||
fi
|
||||
[ -n "$support" ] && {
|
||||
support=$(echo $support | jsonfilter -e '@.mptcp')
|
||||
|
@ -56,8 +64,10 @@ get_mptcp_from_website6() {
|
|||
support=""
|
||||
config_load openmptcprouter
|
||||
config_foreach get_mptcp_from_server server
|
||||
[ -z "$support" ] && [ -n "$(ip -4 a show dev $intf)" ] && get_mptcp_from_website
|
||||
[ -z "$support" ] && [ -n "$(ip -6 a show dev $intf)" ] && get_mptcp_from_website6
|
||||
if [ ! -f /proc/sys/net/mptcp/enabled ] && [ -z "$support" ]; then
|
||||
[ -n "$(ip -4 a show dev $intf)" ] && get_mptcp_from_website
|
||||
[ -n "$(ip -6 a show dev $intf)" ] && get_mptcp_from_website6
|
||||
fi
|
||||
if [ "$support" = "working" ]; then
|
||||
echo "MPTCP enabled"
|
||||
elif [ "$support" = "not working" ]; then
|
||||
|
|
0
luci-app-openmptcprouter/root/etc/hotplug.d/net/99-omr-rename
Normal file → Executable file
0
luci-app-openmptcprouter/root/etc/hotplug.d/net/99-omr-rename
Normal file → Executable file
|
@ -6,6 +6,8 @@ START=5
|
|||
|
||||
USE_PROCD=1
|
||||
|
||||
. /lib/functions/network.sh
|
||||
|
||||
omr_intf_del() {
|
||||
[ -z "$1" ] && return
|
||||
uci -q delete openmptcprouter.$1
|
||||
|
@ -18,11 +20,14 @@ omr_intf_check() {
|
|||
omr_intf_set() {
|
||||
local device
|
||||
local ifname
|
||||
config_get device "$1" device
|
||||
config_get type "$1" type
|
||||
|
||||
ifname=$(ifstatus "$1" | jsonfilter -q -e '@["l3_device"]')
|
||||
network_get_device ifname $1
|
||||
[ -z "$ifname" ] && network_get_physdev ifname $1
|
||||
[ -z "$ifname" ] && config_get ifname "$1" device
|
||||
[ -z "$ifname" ] && config_get ifname "$1" ifname
|
||||
[ -z "$ifname" ] && ifname=$(ifstatus "$1" | jsonfilter -q -e '@["l3_device"]')
|
||||
#config_get devicename "$1" _modem_device
|
||||
devicename=${ifname}
|
||||
config_get type "$1" type
|
||||
|
||||
if [ "$type" != "macvlan" ] && [ -n "$ifname" ] && [ -f /sys/class/net/${ifname}/device/uevent ]; then
|
||||
devicepath=$(readlink -f /sys/class/net/${ifname})
|
||||
|
@ -38,7 +43,7 @@ omr_intf_set() {
|
|||
uci -q delete network.$1.modalias
|
||||
uci -q delete network.$1.product
|
||||
fi
|
||||
elif [ "$type" != "macvlan" ] && [ -n "$device" ] && [ -f /sys/bus/usb-serial/devices/${devicename}/device/uevent ] && [ "$(cat /sys/class/net/${ifname}/device/uevent | grep PRODUCT)" != "" ]; then
|
||||
elif [ "$type" != "macvlan" ] && [ -n "$devicename" ] && [ -f /sys/bus/usb-serial/devices/${devicename}/device/uevent ] && [ "$(cat /sys/class/net/${ifname}/device/uevent | grep PRODUCT)" != "" ]; then
|
||||
mac=""
|
||||
if [ -f /sys/class/net/${ifname}/address ]; then
|
||||
mac="$(cat /sys/class/net/${ifname}/address | tr -d '\n')"
|
||||
|
@ -56,6 +61,10 @@ omr_set_settings() {
|
|||
local ifname
|
||||
local multipath
|
||||
config_get multipath "$1" multipath
|
||||
network_get_device ifname $1
|
||||
[ -z "$ifname" ] && network_get_physdev ifname $1
|
||||
[ -z "$ifname" ] && config_get ifname "$1" device
|
||||
[ -z "$ifname" ] && config_get ifname "$1" ifname
|
||||
config_get device "$1" device
|
||||
config_get proto "$1" proto
|
||||
config_get type "$1" type
|
||||
|
@ -144,15 +153,13 @@ start_service() {
|
|||
del_list dhcp.@dnsmasq[0].server='127.0.0.1#5353'
|
||||
add_list dhcp.@dnsmasq[0].server='114.114.114.114'
|
||||
set dhcp.@dnsmasq[0].dnsseccheckunsigned='0'
|
||||
delete dhcp.@dnsmasq[0].dnssec='1'
|
||||
delete dhcp.@dnsmasq[0].dnssec
|
||||
commit dhcp
|
||||
EOF
|
||||
elif [ "$(uci -q get openmptcprouter.settings.country)" = "world" ] && [ -n "$(uci -q get dhcp.@dnsmasq[0].server | grep '114.114.114.114')" ]; then
|
||||
uci -q batch <<-EOF > /dev/null
|
||||
add_list dhcp.@dnsmasq[0].server='127.0.0.1#5353'
|
||||
del_list dhcp.@dnsmasq[0].server='114.114.114.114'
|
||||
set dhcp.@dnsmasq[0].dnsseccheckunsigned='1'
|
||||
set dhcp.@dnsmasq[0].dnssec='1'
|
||||
commit dhcp
|
||||
EOF
|
||||
fi
|
||||
|
|
|
@ -11,7 +11,7 @@ local jsonc = require "luci.jsonc"
|
|||
function interface_from_device(dev)
|
||||
for _, iface in ipairs(net:get_networks()) do
|
||||
local ifacen = iface:name()
|
||||
local ifacename = ucic:get("network",ifacen,"ifname")
|
||||
local ifacename = ucic:get("network",ifacen,"device")
|
||||
if ifacename == dev then
|
||||
return ifacen
|
||||
end
|
||||
|
@ -72,7 +72,7 @@ function add_interface(add_interface_ifname)
|
|||
end
|
||||
|
||||
ucic:set("network","wan" .. i,"interface")
|
||||
ucic:set("network","wan" .. i,"ifname",defif)
|
||||
ucic:set("network","wan" .. i,"device",defif)
|
||||
ucic:set("network","wan" .. i,"proto","static")
|
||||
if ointf ~= "" then
|
||||
ucic:set("network","wan" .. i,"type","macvlan")
|
||||
|
@ -128,7 +128,7 @@ end
|
|||
|
||||
function remove_interface(intf)
|
||||
-- Remove existing interface
|
||||
local defif = ucic:get("network",intf,"ifname")
|
||||
local defif = ucic:get("network",intf,"device")
|
||||
ucic:delete("network",intf)
|
||||
ucic:delete("network",intf .. "_dev")
|
||||
ucic:save("network")
|
||||
|
@ -170,7 +170,7 @@ function set_interface(intf,proto,ipaddr,netmask,gateway,sqmenabled,downloadspee
|
|||
if not ucic:get("sqm",intf) ~= "" then
|
||||
local defif = get_device(intf)
|
||||
if defif == "" then
|
||||
defif = ucic:get("network",intf,"ifname") or ""
|
||||
defif = ucic:get("network",intf,"device") or ""
|
||||
end
|
||||
ucic:set("sqm",intf,"queue")
|
||||
ucic:set("sqm",intf,"interface",defif)
|
||||
|
@ -268,7 +268,7 @@ function default_vpn(default_vpn)
|
|||
ucic:set("network","omrvpn","proto","dhcp")
|
||||
end
|
||||
if vpn_intf ~= "" then
|
||||
ucic:set("network","omrvpn","ifname",vpn_intf)
|
||||
ucic:set("network","omrvpn","device",vpn_intf)
|
||||
ucic:save("network")
|
||||
ucic:commit("network")
|
||||
end
|
||||
|
@ -824,7 +824,7 @@ function interfaces_status()
|
|||
if mArray.openmptcprouter["external_check"] ~= false then
|
||||
mArray.openmptcprouter["proxy_addr"] = ut.trim(sys.exec("curl -s -4 --socks5 " .. tracker_ip .. ":" .. tracker_port .. " -m " .. timeout .. " " .. check_ipv4_website))
|
||||
if mArray.openmptcprouter["proxy_addr"] == "" then
|
||||
mArray.openmptcprouter["proxy_addr"] = ut.trim(sys.exec("curl -s -4 --socks5 " .. tracker_ip .. ":" .. tracker_port .. " -m " .. timeout .. " ifconfig.co"))
|
||||
mArray.openmptcprouter["proxy_addr"] = ut.trim(sys.exec("curl -s -4 --socks5 " .. tracker_ip .. ":" .. tracker_port .. " -m " .. timeout .. " ifconfig.me"))
|
||||
end
|
||||
--mArray.openmptcprouter["ss_addr6"] = sys.exec("curl -s -6 --socks5 " .. tracker_ip .. ":" .. tracker_port .. " -m 3 http://ipv6.openmptcprouter.com")
|
||||
end
|
||||
|
@ -961,7 +961,10 @@ function interfaces_status()
|
|||
if string.find(sys.exec("/usr/bin/pgrep '^(/usr/sbin/)?glorytun(-udp)?$'"), "%d+") or string.find(sys.exec("/usr/bin/pgrep '^(/usr/sbin/)?dsvpn?$'"), "%d+") or string.find(sys.exec("/usr/bin/pgrep '^(/usr/sbin/)?mlvpn?$'"), "%d+") or string.find(sys.exec("/usr/bin/pgrep '^(/usr/sbin/)?openvpn?$'"), "%d+") then
|
||||
mArray.openmptcprouter["tun_service"] = true
|
||||
mArray.openmptcprouter["tun_ip"] = get_ip("omrvpn")
|
||||
local tun_dev = uci:get("network","omrvpn","ifname")
|
||||
local tun_dev = uci:get("network","omrvpn","device")
|
||||
if tun_dev == "" then
|
||||
tun_dev = uci:get("network","omrvpn","ifname")
|
||||
end
|
||||
if tun_dev == "" then
|
||||
tun_dev = get_device("omrvpn")
|
||||
end
|
||||
|
@ -1139,14 +1142,14 @@ function interfaces_status()
|
|||
|
||||
local ifname = get_device(interface)
|
||||
if ifname == "" or ifname == nil then
|
||||
ifname = section["ifname"] or ""
|
||||
ifname = section["device"] or ""
|
||||
end
|
||||
--if ifname ~= nil and ifname:match("^tun.*") and interface:match("^ovpn.*") then
|
||||
--ifname = get_device(interface:sub(5))
|
||||
--end
|
||||
|
||||
duplicateif = false
|
||||
if ifname ~= "" and ifname ~= nil and not (section["ifname"] ~= nil and section["ifname"]:match("^@.*")) then
|
||||
if ifname ~= "" and ifname ~= nil and not (section["device"] ~= nil and section["device"]:match("^@.*")) then
|
||||
if allintf[ifname] then
|
||||
connectivity = "ERROR"
|
||||
duplicateif = true
|
||||
|
@ -1156,7 +1159,7 @@ function interfaces_status()
|
|||
end
|
||||
|
||||
duplicatemac = false
|
||||
if mac ~= "" and mac ~= nil and not (section["ifname"] ~= nil and section["ifname"]:match("^@.*")) and not (ifname ~= nil and ifname:match("%.")) then
|
||||
if mac ~= "" and mac ~= nil and not (section["device"] ~= nil and section["device"]:match("^@.*")) and not (ifname ~= nil and ifname:match("%.")) then
|
||||
if allmac[mac] then
|
||||
connectivity = "ERROR"
|
||||
duplicatemac = true
|
||||
|
@ -1371,7 +1374,8 @@ function interfaces_status()
|
|||
if adminport == "" then
|
||||
adminport = "65500"
|
||||
end
|
||||
if server_ping == "UP" and uci:get("openmptcprouter", "settings", "disableserverhttptest") ~= "1" and ipaddr ~= "" and adminport ~= "" then
|
||||
-- httping disable for now, with -l (ssl) timeout is ignored
|
||||
if false and server_ping == "UP" and uci:get("openmptcprouter", "settings", "disableserverhttptest") ~= "1" and ipaddr ~= "" and adminport ~= "" then
|
||||
local server_http_result = ""
|
||||
local server_http_test = ""
|
||||
if mArray.openmptcprouter["service_addr_ip"] ~= "" then
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue