mirror of https://github.com/hak5/openwrt.git
omcproxy: optimize interface triggers
Before installing an interface triggger check if an interface trigger for the interface is already in place. This avoids installing identical interface triggers for a given interface Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>openwrt-19.07
parent
df8f8bad08
commit
d405edb481
|
@ -8,7 +8,7 @@
|
||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=omcproxy
|
PKG_NAME:=omcproxy
|
||||||
PKG_RELEASE:=7
|
PKG_RELEASE:=8
|
||||||
|
|
||||||
PKG_SOURCE_PROTO:=git
|
PKG_SOURCE_PROTO:=git
|
||||||
PKG_SOURCE_URL=$(PROJECT_GIT)/project/omcproxy.git
|
PKG_SOURCE_URL=$(PROJECT_GIT)/project/omcproxy.git
|
||||||
|
|
|
@ -51,7 +51,16 @@ omcproxy_add_network_triggers() {
|
||||||
config_get downlinks $1 downlink
|
config_get downlinks $1 downlink
|
||||||
|
|
||||||
for link in $uplink $downlinks; do
|
for link in $uplink $downlinks; do
|
||||||
procd_add_interface_trigger "interface.*" $link /etc/init.d/omcproxy restart
|
local duplicate=0
|
||||||
|
|
||||||
|
for l in $LINKS; do
|
||||||
|
[ "$l" = "$link" ] && duplicate=1
|
||||||
|
done
|
||||||
|
|
||||||
|
[ "$duplicate" = 0 ] && {
|
||||||
|
LINKS="$LINKS $link"
|
||||||
|
procd_add_interface_trigger "interface.*" $link /etc/init.d/omcproxy restart
|
||||||
|
}
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,6 +123,8 @@ omcproxy_add_firewall_rules() {
|
||||||
}
|
}
|
||||||
|
|
||||||
service_triggers() {
|
service_triggers() {
|
||||||
|
LINKS=""
|
||||||
|
|
||||||
procd_add_reload_trigger "omcproxy"
|
procd_add_reload_trigger "omcproxy"
|
||||||
config_foreach omcproxy_add_network_triggers proxy
|
config_foreach omcproxy_add_network_triggers proxy
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue