Add new package for configuring 6rd tunnels.
[openwrt/.git] / package / 6rd / files / 6rd.hotplug
1 #!/bin/sh
2
3 if [ "$ACTION" = ifup ]; then
4         . /lib/functions.sh
5
6         INCLUDE_ONLY=1
7         . /lib/netifd/proto/6rd.sh
8
9         include /lib/network
10         scan_interfaces
11
12         update_tunnel() {
13                 local cfg="$1"
14
15                 local proto
16                 config_get proto "$cfg" proto
17                 [ "$proto" = 6rd ] || return 0
18
19                 local wandev
20                 config_get wandev "$cfg" wan_device "$(find_6rd_wanif)"
21                 [ "$wandev" = "$DEVICE" ] || return 0
22
23                 local wanip=$(find_6rd_wanip "$wandev")
24
25                 [ -n "$wanip" ] && ifup "$cfg"
26         }
27
28         config_foreach update_tunnel interface
29 fi