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 2021-02-04 00:48:36 +08:00
commit 25b1b48294
8 changed files with 76 additions and 31 deletions

View file

@ -1,12 +1,12 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=bcm27xx-eeprom PKG_NAME:=bcm27xx-eeprom
PKG_VERSION:=16bb29427f96dc8276a7102c0526154a1084bffd PKG_VERSION:=3d6165304cb04bda4454e460dea791b5f92a122a
PKG_RELEASE:=3 PKG_RELEASE:=4
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/raspberrypi/rpi-eeprom/tar.gz/$(PKG_VERSION)? PKG_SOURCE_URL:=https://codeload.github.com/raspberrypi/rpi-eeprom/tar.gz/$(PKG_VERSION)?
PKG_HASH:=9bf42edbcd5ce38538750860c3c788af435206aa441b7d78cf88d094631dbb14 PKG_HASH:=d6f25e3d962ea3c770ca1af78466371c47970381b48fb7c2acaf838966d327fc
PKG_LICENSE:=BSD-3-Clause Custom PKG_LICENSE:=BSD-3-Clause Custom
PKG_LICENSE_FILES:=LICENSE PKG_LICENSE_FILES:=LICENSE

View file

@ -375,13 +375,25 @@ _bypass_proto() {
_intf_rule_ss_rules() { _intf_rule_ss_rules() {
rule_name=$1 rule_name=$1
[ "$rule_name" = "ss_rules" ] && rule_name="def" [ "$rule_name" = "ss_rules" ] && rule_name="def"
if [ "$(iptables --wait=40 -t nat -L -n | grep ssr_${rule_name}_pre_src)" != "" ] && [ "$(iptables-save | grep ssr | grep omr_dst_bypass_$intf)" = "" ]; then if [ "$(iptables --wait=40 -t nat -L -n | grep ssr_${rule_name}_dst)" != "" ] && [ "$(iptables-save | grep ssr_${rule_name}_dst | grep omr_dst_bypass_$intf)" = "" ]; then
iptables-restore -w --wait=60 --noflush <<-EOF iptables-restore -w --wait=60 --noflush <<-EOF
*nat *nat
-I ssr_${rule_name}_dst 1 -m set --match-set omr_dst_bypass_$intf dst -j MARK --set-mark 0x539$count -I ssr_${rule_name}_dst 1 -m set --match-set omr_dst_bypass_$intf dst -j MARK --set-mark 0x539$count
-I ssr_${rule_name}_dst 2 -m mark --mark 0x539$count -j RETURN -I ssr_${rule_name}_dst 2 -m mark --mark 0x539$count -j RETURN
COMMIT
EOF
fi
if [ "$(iptables --wait=40 -t nat -L -n | grep ssr_${rule_name}_local_out)" != "" ] && [ "$(iptables-save | grep ssr_${rule_name}_local_out | grep omr_dst_bypass_$intf)" = "" ]; then
iptables-restore -w --wait=60 --noflush <<-EOF
*nat
-I ssr_${rule_name}_local_out 1 -m set --match-set omr_dst_bypass_$intf dst -j MARK --set-mark 0x539$count -I ssr_${rule_name}_local_out 1 -m set --match-set omr_dst_bypass_$intf dst -j MARK --set-mark 0x539$count
-I ssr_${rule_name}_local_out 2 -m mark --mark 0x539$count -j RETURN -I ssr_${rule_name}_local_out 2 -m mark --mark 0x539$count -j RETURN
COMMIT
EOF
fi
if [ "$(iptables --wait=40 -t nat -L -n | grep ssr_${rule_name}_pre_src)" != "" ] && [ "$(iptables-save | grep ssr_${rule_name}_pre_src | grep omr_dst_bypass_$intf)" = "" ]; then
iptables-restore -w --wait=60 --noflush <<-EOF
*nat
-I ssr_${rule_name}_pre_src 1 -m set --match-set omr_dst_bypass_$intf dst -j MARK --set-mark 0x539$count -I ssr_${rule_name}_pre_src 1 -m set --match-set omr_dst_bypass_$intf dst -j MARK --set-mark 0x539$count
-I ssr_${rule_name}_pre_src 2 -m mark --mark 0x539$count -j RETURN -I ssr_${rule_name}_pre_src 2 -m mark --mark 0x539$count -j RETURN
COMMIT COMMIT
@ -493,6 +505,7 @@ _intf_rule() {
iptables-restore -w --wait=60 --noflush <<-EOF iptables-restore -w --wait=60 --noflush <<-EOF
*mangle *mangle
-I omr-bypass 1 -m set --match-set omr_dst_bypass_$intf dst -j MARK --set-mark 0x539$count -I omr-bypass 1 -m set --match-set omr_dst_bypass_$intf dst -j MARK --set-mark 0x539$count
-I omr-bypass-local 1 -m set --match-set omr_dst_bypass_$intf dst -j MARK --set-mark 0x539$count
COMMIT COMMIT
EOF EOF
fi fi

View file

@ -220,6 +220,7 @@ function wizard_add()
local typeintf = luci.http.formvalue("cbid.network.%s.type" % intf) or "" local typeintf = luci.http.formvalue("cbid.network.%s.type" % intf) or ""
local masterintf = luci.http.formvalue("cbid.network.%s.masterintf" % intf) or "" local masterintf = luci.http.formvalue("cbid.network.%s.masterintf" % intf) or ""
local ifname = luci.http.formvalue("cbid.network.%s.intf" % intf) or "" local ifname = luci.http.formvalue("cbid.network.%s.intf" % intf) or ""
local vlan = luci.http.formvalue("cbid.network.%s.vlan" % intf) or ""
local device_ncm = luci.http.formvalue("cbid.network.%s.device.ncm" % intf) or "" local device_ncm = luci.http.formvalue("cbid.network.%s.device.ncm" % intf) or ""
local device_qmi = luci.http.formvalue("cbid.network.%s.device.qmi" % intf) or "" local device_qmi = luci.http.formvalue("cbid.network.%s.device.qmi" % intf) or ""
local device_modemmanager = luci.http.formvalue("cbid.network.%s.device.modemmanager" % intf) or "" local device_modemmanager = luci.http.formvalue("cbid.network.%s.device.modemmanager" % intf) or ""
@ -244,6 +245,9 @@ function wizard_add()
end end
ucic:set("network",intf,"type",typeintf) ucic:set("network",intf,"type",typeintf)
end end
if vlan ~= "" then
ifname = ifname .. '.' .. vlan
end
if typeintf == "macvlan" and masterintf ~= "" then if typeintf == "macvlan" and masterintf ~= "" then
ucic:set("network",intf,"type","macvlan") ucic:set("network",intf,"type","macvlan")
ucic:set("network",intf,"masterintf",masterintf) ucic:set("network",intf,"masterintf",masterintf)
@ -901,6 +905,9 @@ function settings_add()
-- Enable/disable debug -- Enable/disable debug
local debug = luci.http.formvalue("debug") or "0" local debug = luci.http.formvalue("debug") or "0"
ucic:set("openmptcprouter","settings","debug",debug) ucic:set("openmptcprouter","settings","debug",debug)
ucic:foreach("shadowsocks-libev", "ss_redir", function (section)
ucic:set("shadowsocks-libev",section[".name"],"verbose",debug)
end)
-- Enable/disable vnstat backup -- Enable/disable vnstat backup
local savevnstat = luci.http.formvalue("savevnstat") or "0" local savevnstat = luci.http.formvalue("savevnstat") or "0"

View file

@ -21,6 +21,17 @@
end end
return true return true
end end
function splitstring(inputstr, sep)
if sep == nil then
sep = "%s"
end
local t={}
for str in string.gmatch(inputstr, "([^"..sep.."]+)") do
table.insert(t, str)
end
return t
end
%> %>
<script type="text/javascript" src="<%=resource%>/cbi.js?v=git-18.243.49640-2f13420" data-strings="{&#34;path&#34;:{&#34;resource&#34;:&#34;\/luci-static\/resources&#34;,&#34;browser&#34;:&#34;\/cgi-bin\/luci\/admin\/filebrowser&#34;}}"></script> <script type="text/javascript" src="<%=resource%>/cbi.js?v=git-18.243.49640-2f13420" data-strings="{&#34;path&#34;:{&#34;resource&#34;:&#34;\/luci-static\/resources&#34;,&#34;browser&#34;:&#34;\/cgi-bin\/luci\/admin\/filebrowser&#34;}}"></script>
@ -537,20 +548,25 @@
<select class="cbi-input-select" data-update="change" id="cbid.network.<%=ifname%>.intf" name="cbid.network.<%=ifname%>.intf" size="1"> <select class="cbi-input-select" data-update="change" id="cbid.network.<%=ifname%>.intf" name="cbid.network.<%=ifname%>.intf" size="1">
<% <%
iffind=0 iffind=0
uciifname=uci:get("network",ifname,"ifname")
realifname=splitstring(uciifname,'.')[1] or ""
vlan=splitstring(uciifname,'.')[2] or ""
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.*")) and device_notvirtual(ifacea) then
%> %>
<option value="<%=ifacea%>"<% if uci:get("network",ifname,"ifname") == ifacea then iffind = 1 %> selected="selected"<% end %>><%=ifacea%></option> <option value="<%=ifacea%>"<% if realifname == ifacea then iffind = 1 %> selected="selected"<% end %>><%=ifacea%></option>
<% <%
end end
end end
if iffind == 0 and uci:get("network",ifname,"ifname") ~= nil then if iffind == 0 and uciifname ~= nil then
%> %>
<option value="<%=uci:get("network",ifname,"ifname")%>" selected="selected"><%=uci:get("network",ifname,"ifname")%></option> <option value="<%=uciifname%>" selected="selected"><%=uciifname%></option>
<% <%
end end
%> %>
</select> </select>
<label><%:VLAN%></label>
<input type="text" id="cbid.network.<%=ifname%>.vlan" name="cbid.network.<%=ifname%>.vlan" class="cbi-input-text" placeholder="<%:VLAN%>" value="<%=vlan%>" data-optional="true">
<br /> <br />
<div class="cbi-value-description"> <div class="cbi-value-description">
<%:Choose physical interface.%> <%:Choose physical interface.%>
@ -885,7 +901,7 @@
end end
end end
for _, ifacea in ipairs(net:get_networks()) do for _, ifacea in ipairs(net:get_networks()) do
if not (ifacea:name() == "loopback" or ifacea:name() == "omr6in4" or ifacea:name() == "omrvpn" or ifacea:name():match("^omrip.*")) then if not (ifacea:name() == "loopback" or ifacea:name() == "lan" or ifacea:name() == "omr6in4" or ifacea:name() == "omrvpn" or ifacea:name():match("^omrip.*")) then
%> %>
<option value="<%='@' .. ifacea:name()%>"><%='@' .. ifacea:name() .. ' (alias)'%></option> <option value="<%='@' .. ifacea:name()%>"><%='@' .. ifacea:name() .. ' (alias)'%></option>
<% <%

View file

@ -75,7 +75,7 @@
<%+header%> <%+header%>
<h2 name="content"><%:Sysupgrade%></h2> <h2 name="content"><%:Sysupgrade%></h2>
<div class="cbi-map-descr"> <div class="cbi-map-descr">
Easily search and install new releases and package upgrades. Sysupgrade firmware are created on demand based on locally installed packages. <%:Easily search and install new releases and package upgrades.%>
</div> </div>
<div style="display: none" id="status_box" class="alert-message info"></div> <div style="display: none" id="status_box" class="alert-message info"></div>
<div style="display: none" id="packages" class="alert-message success"></div> <div style="display: none" id="packages" class="alert-message success"></div>
@ -87,27 +87,27 @@
<div class="cbi-selection-node"> <div class="cbi-selection-node">
<div class="cbi-value" id="keep_container" style="display: none"> <div class="cbi-value" id="keep_container" style="display: none">
<div class="cbi-section-descr"> <div class="cbi-section-descr">
Check "Keep settings" to retain the current configuration (requires a compatible firmware). <%:Check "Keep settings" to retain the current configuration.%>
</div> </div>
<label class="cbi-value-title" for="keep">Keep settings:</label> <label class="cbi-value-title" for="keep"><%:Keep settings:%></label>
<div class="cbi-value-field"> <div class="cbi-value-field">
<input name="keep" id="keep" checked="checked" type="checkbox"> <input name="keep" id="keep" checked="checked" type="checkbox">
</div> </div>
</div> </div>
<div class="cbi-value" id="edit_button" style="display: none"> <div class="cbi-value" id="edit_button" style="display: none">
<div class="cbi-value-field"> <div class="cbi-value-field">
<input class="cbi-button" value="Edit installed packages" onclick="edit_packages()" type="button"> <input class="cbi-button" value="<%:Edit installed packages%>" onclick="edit_packages()" type="button">
</div> </div>
</div> </div>
<div class="cbi-value cbi-value" id="server_div" style="display:none"> <div class="cbi-value cbi-value" id="server_div" style="display:none">
<label class="cbi-value-title" for="server">Server:</label> <label class="cbi-value-title" for="server"><%:Server:%></label>
<div class="cbi-value-field"> <div class="cbi-value-field">
<input onclick="edit_server()" class="cbi-button cbi-button-edit" value="" type="button" id="server" name="server"> <input onclick="edit_server()" class="cbi-button cbi-button-edit" value="" type="button" id="server" name="server">
</div> </div>
</div> </div>
<div class="cbi-value cbi-value-last"> <div class="cbi-value cbi-value-last">
<div class="cbi-value-field"> <div class="cbi-value-field">
<input class="cbi-button cbi-button-apply" value="Search for upgrades" style="display: none" onclick="upgrade_check()" type="button" id="upgrade_button"> <input class="cbi-button cbi-button-apply" value="<%:Search for upgrades%>" style="display: none" onclick="upgrade_check()" type="button" id="upgrade_button">
</div> </div>
</div> </div>
</div> </div>

View file

@ -1,3 +1,4 @@
'require ui';
function $(s) { function $(s) {
return document.getElementById(s.substring(1)); return document.getElementById(s.substring(1));
} }
@ -161,7 +162,7 @@ function upgrade_check() {
var candidates = [] var candidates = []
hide("#status_box"); hide("#status_box");
hide("#server_div"); hide("#server_div");
set_status("info", "Searching for upgrades", true); set_status("info", _("Searching for upgrades"), true);
fetch(data.url + "/api/versions") fetch(data.url + "/api/versions")
.then(response => response.json()) .then(response => response.json())
.then(response => { .then(response => {
@ -188,7 +189,7 @@ function upgrade_check() {
if (candidates.length > 0) { if (candidates.length > 0) {
var info_output = "<h3>New release <b>" + candidates[0].latest + "</b> available</h3>" var info_output = "<h3>New release <b>" + candidates[0].latest + "</b> available</h3>"
info_output += "Installed version: " + data.release.version info_output += _('Installed version:') + " " + data.release.version
// tell server the currently installed version // tell server the currently installed version
request_dict.current_version = request_dict.version; request_dict.current_version = request_dict.version;
@ -205,13 +206,13 @@ function upgrade_check() {
show("#edit_button"); show("#edit_button");
} }
var upgrade_button = $("#upgrade_button") var upgrade_button = $("#upgrade_button")
upgrade_button.value = "Request firmware"; upgrade_button.value = _("Request firmware");
upgrade_button.style.display = "block"; upgrade_button.style.display = "block";
upgrade_button.disabled = false; upgrade_button.disabled = false;
upgrade_button.onclick = upgrade_request; upgrade_button.onclick = upgrade_request;
} else { } else {
set_status("success", "No upgrades available") set_status("success", _("No upgrades available"))
} }
}); });
@ -265,7 +266,7 @@ function upgrade_request_callback(response) {
function flash_image() { function flash_image() {
// Flash image via rpc-sys upgrade_start // Flash image via rpc-sys upgrade_start
set_status("warning", "Flashing firmware. Don't unpower device", true) set_status("warning", _("Flashing firmware. Don't unpower device"), true)
ubus_call("rpc-sys", "upgrade_start", { ubus_call("rpc-sys", "upgrade_start", {
"keep": $("#keep").checked "keep": $("#keep").checked
}, 'message'); }, 'message');
@ -281,11 +282,11 @@ function ping_ubus() {
var request = new XMLHttpRequest(); var request = new XMLHttpRequest();
request.open("GET", ubus_url, true); request.open("GET", ubus_url, true);
request.addEventListener('error', function(event) { request.addEventListener('error', function(event) {
set_status("warning", "Rebooting device - please wait!", true); set_status("warning", _("Rebooting device - please wait!"), true);
setTimeout(ping_ubus, 5000) setTimeout(ping_ubus, 5000)
}); });
request.addEventListener('load', function(event) { request.addEventListener('load', function(event) {
set_status("success", "Success! Please reload web interface"); set_status("success", _("Success! Please reload web interface"));
$("#upgrade_button").value = "Reload page"; $("#upgrade_button").value = "Reload page";
show("#upgrade_button"); show("#upgrade_button");
$("#upgrade_button").disabled = false; $("#upgrade_button").disabled = false;
@ -295,13 +296,13 @@ function ping_ubus() {
}); });
request.send(); request.send();
} else { } else {
set_status("danger", "Web interface could not reconnect to your device. Please reload web interface or check device manually") set_status("danger", _("Web interface could not reconnect to your device. Please reload web interface or check device manually"))
} }
} }
function upload_image(blob) { function upload_image(blob) {
// Uploads received blob data to the server using cgi-io // Uploads received blob data to the server using cgi-io
set_status("info", "Uploading firmware to device", true); set_status("info", _("Uploading firmware to device"), true);
var request = new XMLHttpRequest(); var request = new XMLHttpRequest();
var form_data = new FormData(); var form_data = new FormData();
@ -316,7 +317,7 @@ function upload_image(blob) {
}); });
request.addEventListener('error', function(event) { request.addEventListener('error', function(event) {
set_status("danger", "Upload of firmware failed, please retry by reloading web interface") set_status("danger", _("Upload of firmware failed, please retry by reloading web interface"))
}); });
request.open('POST', origin + '/cgi-bin/cgi-upload'); request.open('POST', origin + '/cgi-bin/cgi-upload');
@ -340,7 +341,7 @@ function download_image() {
upload_image(blob) upload_image(blob)
} }
}; };
set_status("info", "Downloading firmware to web browser memory", true); set_status("info", _("Downloading firmware to web browser memory"), true);
download_request.send(); download_request.send();
} }

View file

@ -27,8 +27,12 @@ if [ -z "$INTERFACE" ]; then
curl -4 $HOST >/dev/null || echo curl -4 $HOST >/dev/null || echo
else else
domain=$(echo $HOST | awk -F/ '{print $3}') domain=$(echo $HOST | awk -F/ '{print $3}')
hostip=$(dig +nocmd +noall +answer A $domain | grep -v CNAME | awk '{print $5}' | tr -d "\n") hostip=$(dig +nocmd +noall +answer A $domain | grep -v CNAME | awk '{print $5}' | tr '\n' ' ')
ipset add ss_rules_dst_bypass_all $hostip for ip in $hostip; do
ipset add ss_rules_dst_bypass_all $ip
done
curl -4 --interface $INTERFACE $HOST >/dev/null || echo curl -4 --interface $INTERFACE $HOST >/dev/null || echo
ipset del ss_rules_dst_bypass_all $hostip for ip in $hostip; do
ipset del ss_rules_dst_bypass_all $ip
done
fi fi

View file

@ -27,8 +27,12 @@ if [ -z "$INTERFACE" ]; then
curl -6 $HOST >/dev/null || echo curl -6 $HOST >/dev/null || echo
else else
domain=$(echo $HOST | awk -F/ '{print $3}') domain=$(echo $HOST | awk -F/ '{print $3}')
hostip=$(dig +nocmd +noall +answer AAAA $domain | grep -v CNAME | awk '{print $5}' | tr -d "\n") hostip=$(dig +nocmd +noall +answer AAAA $domain | grep -v CNAME | awk '{print $5}' | tr '\n' ' ')
ipset add ss_rules6_dst_bypass_all $hostip for ip in $hostip; do
ipset add ss_rules6_dst_bypass_all $ip
done
curl -6 --interface $INTERFACE $HOST >/dev/null || echo curl -6 --interface $INTERFACE $HOST >/dev/null || echo
ipset del ss_rules6_dst_bypass_all $hostip for ip in $hostip; do
ipset del ss_rules6_dst_bypass_all $ip
done
fi fi