6to4: add netifd support
[openwrt/openwrt.git] / package / 6to4 / files / 6to4.hotplug
1 #!/bin/sh
2
3 if [ "$ACTION" = ifup ]; then
4 . /etc/functions.sh
5
6 INCLUDE_ONLY=1
7 . /lib/netifd/proto/6to4.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" = 6to4 ] || return 0
18
19 local wandev
20 config_get wandev "$cfg" wan_device "$(find_6to4_wanif)"
21 [ "$wandev" = "$DEVICE" ] || return 0
22
23 local wanip=$(find_6to4_wanip "$wandev")
24
25 [ -n "$wanip" ] && ifup "$cfg"
26 }
27
28 config_foreach update_tunnel interface
29 fi