summaryrefslogtreecommitdiffstats
path: root/package/relayd/files/relay.hotplug
blob: b992fca08c8da8dd5441168431cb5deb4305278a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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