mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-03-09 15:40:03 +00:00
OMR-ByPass rules can be enabled or disabled
This commit is contained in:
parent
58196720a1
commit
d0e3a051f0
2 changed files with 52 additions and 0 deletions
|
@ -39,8 +39,11 @@ _bypass_ip() {
|
|||
_bypass_domains() {
|
||||
local domain
|
||||
local intf
|
||||
local enabled
|
||||
config_get domain $1 name
|
||||
config_get intf $1 interface
|
||||
config_get enabled $1 enabled
|
||||
[ "$enabled" = "0" ] && return
|
||||
_bypass_domain $domain $intf
|
||||
}
|
||||
|
||||
|
@ -82,8 +85,11 @@ _bypass_domain() {
|
|||
_bypass_mac() {
|
||||
local mac
|
||||
local intf
|
||||
local enabled
|
||||
config_get mac $1 mac
|
||||
config_get intf $1 interface
|
||||
config_get enabled $1 enabled
|
||||
[ "$enabled" = "0" ] && return
|
||||
local intfid="$(uci -q get omr-bypass.$intf.id)"
|
||||
|
||||
[ -z "$intf" ] && intf="all"
|
||||
|
@ -120,8 +126,11 @@ _bypass_mac() {
|
|||
_bypass_lan_ip() {
|
||||
local ip
|
||||
local intf
|
||||
local enabled
|
||||
config_get ip $1 ip
|
||||
config_get intf $1 interface
|
||||
config_get enabled $1 enabled
|
||||
[ "$enabled" = "0" ] && return
|
||||
local intfid="$(uci -q get omr-bypass.$intf.id)"
|
||||
|
||||
[ -z "$intf" ] && intf="all"
|
||||
|
@ -171,9 +180,14 @@ _bypass_lan_ip() {
|
|||
|
||||
_bypass_dest_port() {
|
||||
local intf
|
||||
local enabled
|
||||
local dport
|
||||
local proto
|
||||
config_get dport $1 dport
|
||||
config_get proto $1 proto
|
||||
config_get intf $1 interface
|
||||
config_get enabled $1 enabled
|
||||
[ "$enabled" = "0" ] && return
|
||||
local intfid="$(uci -q get omr-bypass.$intf.id)"
|
||||
|
||||
[ -z "$intf" ] && intf="all"
|
||||
|
@ -221,9 +235,14 @@ _bypass_dest_port() {
|
|||
|
||||
_bypass_src_port() {
|
||||
local intf
|
||||
local enabled
|
||||
local sport
|
||||
local proto
|
||||
config_get sport $1 sport
|
||||
config_get proto $1 proto
|
||||
config_get intf $1 interface
|
||||
config_get enabled $1 enabled
|
||||
[ "$enabled" = "0" ] && return
|
||||
local intfid="$(uci -q get omr-bypass.$intf.id)"
|
||||
|
||||
[ -z "$intf" ] && intf="all"
|
||||
|
@ -272,8 +291,11 @@ _bypass_src_port() {
|
|||
_bypass_proto() {
|
||||
local proto
|
||||
local intf
|
||||
local enabled
|
||||
config_get proto $1 proto
|
||||
config_get intf $1 interface
|
||||
config_get enabled $1 enabled
|
||||
[ "$enabled" = "0" ] && return
|
||||
local intfid="$(uci -q get omr-bypass.$intf.id)"
|
||||
|
||||
[ -z "$intf" ] && intf="all"
|
||||
|
@ -411,16 +433,22 @@ _intf_rule() {
|
|||
_bypass_ip_set() {
|
||||
local ip
|
||||
local interface
|
||||
local enabled
|
||||
config_get ip $1 ip
|
||||
config_get interface $1 interface
|
||||
config_get enabled $1 enabled
|
||||
[ "$enabled" = "0" ] && return
|
||||
_bypass_ip $ip $interface
|
||||
}
|
||||
|
||||
_bypass_asn() {
|
||||
local asn
|
||||
local interface
|
||||
local enabled
|
||||
config_get asn $1 asn
|
||||
config_get interface $1 interface
|
||||
config_get enabled $1 enabled
|
||||
[ "$enabled" = "0" ] && return
|
||||
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue