diff options
author | jow <jow@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2011-02-25 23:23:40 +0000 |
---|---|---|
committer | jow <jow@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2011-02-25 23:23:40 +0000 |
commit | fff64a6387ca4502516c188d0c590e0a92b840ef (patch) | |
tree | f61312513cc07cd2211fef2140757bdcbcab4445 /package/relayd/files/relay.hotplug | |
parent | 13bfc6e1cffbe40f512c585bb9b272d899f0f90e (diff) |
[package] relayd: add uci integration
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@25714 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/relayd/files/relay.hotplug')
-rw-r--r-- | package/relayd/files/relay.hotplug | 36 |
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 000000000..b992fca08 --- /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 + |