mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-03-09 15:40:03 +00:00
Add bypass ASN
This commit is contained in:
parent
8b03276de9
commit
a07de2be01
2 changed files with 30 additions and 0 deletions
|
@ -66,6 +66,18 @@ ip.optional = false
|
|||
ifl = s:option(Value, "interface", translate("Interface"))
|
||||
ifl.rmempty = true
|
||||
|
||||
s = m:section(TypedSection, "asns", translate("ASN"))
|
||||
s.addremove = true
|
||||
s.anonymous = true
|
||||
s.template = "cbi/tblsection"
|
||||
|
||||
asn = s:option(Value, "asn", translate("ASN"))
|
||||
asn.rmempty = true
|
||||
asn.optional = false
|
||||
|
||||
ifa = s:option(Value, "interface", translate("Interface"))
|
||||
ifa.rmempty = true
|
||||
|
||||
s = m:section(TypedSection, "dpis", translate("Protocols"))
|
||||
s.addremove = true
|
||||
s.anonymous = true
|
||||
|
@ -94,17 +106,21 @@ ifi.default = "all"
|
|||
ifp.default = "all"
|
||||
ifm.default = "all"
|
||||
ifl.default = "all"
|
||||
ifa.default = "all"
|
||||
ifd:value("all",translate("Default"))
|
||||
ifi:value("all",translate("Default"))
|
||||
ifp:value("all",translate("Default"))
|
||||
ifm:value("all",translate("Default"))
|
||||
ifl:value("all",translate("Default"))
|
||||
ifa:value("all",translate("Default"))
|
||||
for _, iface in ipairs(ifaces) do
|
||||
if iface:is_up() then
|
||||
ifd:value(iface:name(),"%s" % iface:name())
|
||||
ifi:value(iface:name(),"%s" % iface:name())
|
||||
ifp:value(iface:name(),"%s" % iface:name())
|
||||
ifm:value(iface:name(),"%s" % iface:name())
|
||||
ifl:value(iface:name(),"%s" % iface:name())
|
||||
ifa:value(iface:name(),"%s" % iface:name())
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -241,6 +241,19 @@ _bypass_ip_set() {
|
|||
_bypass_ip $ip $interface
|
||||
}
|
||||
|
||||
_bypass_asn() {
|
||||
local asn
|
||||
local interface
|
||||
config_get asn $1 asn
|
||||
config_get interface $1 interface
|
||||
local asnips
|
||||
asnips=`curl --max-time 4 -s -k https://stat.ripe.net/data/announced-prefixes/data.json?resource=${asn} | jsonfilter -q -e '@.data.prefixes.*.prefix'`
|
||||
for ip in $asnips; do
|
||||
_bypass_ip $ip $interface
|
||||
done
|
||||
|
||||
}
|
||||
|
||||
_bypass_omr_server() {
|
||||
local ip
|
||||
config_get ip $1 ip
|
||||
|
@ -288,6 +301,7 @@ start_service() {
|
|||
config_foreach _bypass_ip_set ips
|
||||
config_foreach _bypass_mac macs
|
||||
config_foreach _bypass_lan_ip lan_ip
|
||||
config_foreach _bypass_asn asns
|
||||
uci -q del dhcp.@dnsmasq[0].ipset
|
||||
config_foreach _bypass_domains domains
|
||||
uci -q commit dhcp
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue