summaryrefslogtreecommitdiff
path: root/package/relayd/files/relay.hotplug
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2011-02-25 23:23:40 +0000
committerJo-Philipp Wich <jow@openwrt.org>2011-02-25 23:23:40 +0000
commitc16efad4287cd0ec5731058b21aedd2c899bebf1 (patch)
tree81ea4fd6ff49d56d59453bc6cda803a3970bb337 /package/relayd/files/relay.hotplug
parent73468de8d1fad601c5dc6460cc33c02af47c51f8 (diff)
downloadmtk-20170518-c16efad4287cd0ec5731058b21aedd2c899bebf1.zip
mtk-20170518-c16efad4287cd0ec5731058b21aedd2c899bebf1.tar.gz
mtk-20170518-c16efad4287cd0ec5731058b21aedd2c899bebf1.tar.bz2
relayd: add uci integration
SVN-Revision: 25714
Diffstat (limited to 'package/relayd/files/relay.hotplug')
-rw-r--r--package/relayd/files/relay.hotplug36
1 files changed, 36 insertions, 0 deletions
diff --git a/package/relayd/files/relay.hotplug b/package/relayd/files/relay.hotplug
new file mode 100644
index 0000000..b992fca
--- /dev/null
+++ b/package/relayd/files/relay.hotplug
@@ -0,0 +1,36 @@
+#!/bin/sh
+
+# Break recursion
+[ "$PROTO" = "relay" ] && exit 0
+
+include /lib/network
+scan_interfaces
+
+restart_relayd() {
+ local cfg="$1"
+
+ local proto
+ config_get proto "$1" proto
+ [ "$proto" = "relay" ] || return 0
+
+ local net networks
+ config_get networks "$cfg" network
+ for net in $networks; do
+ [ "$net" = "$INTERFACE" ] && {
+ env -i /sbin/ifup "$cfg" &
+ return 0
+ }
+ done
+
+ local ifn ifnames
+ config_get ifnames "$cfg" ifname
+ for ifn in $ifnames; do
+ [ "$ifn" = "$DEVICE" ] && {
+ env -i /sbin/ifup "$cfg" &
+ return 0
+ }
+ done
+}
+
+config_foreach restart_relayd interface
+