Root/package/relayd/files/relay.hotplug

1#!/bin/sh
2
3# Break recursion
4[ "$PROTO" = "relay" ] && exit 0
5
6include /lib/network
7scan_interfaces
8
9restart_relayd() {
10    local cfg="$1"
11    
12    local proto
13    config_get proto "$1" proto
14    [ "$proto" = "relay" ] || return 0
15
16    local net networks
17    config_get networks "$cfg" network
18    for net in $networks; do
19        [ "$net" = "$INTERFACE" ] && {
20            env -i /sbin/ifup "$cfg" &
21            return 0
22        }
23    done
24
25    local ifn ifnames
26    config_get ifnames "$cfg" ifname
27    for ifn in $ifnames; do
28        [ "$ifn" = "$DEVICE" ] && {
29            env -i /sbin/ifup "$cfg" &
30            return 0
31        }
32    done
33}
34
35config_foreach restart_relayd interface
36
37

Archive Download this file



interactive