ac8469524b290fd7ce5a45d276ae59dc353f3f49
[openwrt/svn-archive/archive.git] / package / firewall / files / firewall.hotplug
1 #!/bin/sh
2 # This script is executed as part of the hotplug event with
3 # HOTPLUG_TYPE=iface, triggered by various scripts when an interface
4 # is configured (ACTION=ifup) or deconfigured (ACTION=ifdown). The
5 # interface is available as INTERFACE, the real device as DEVICE.
6
7 [ "$DEVICE" == "lo" ] && exit 0
8
9 . /etc/functions.sh
10 . /lib/firewall/core.sh
11
12 fw_init
13 fw_is_loaded || exit 0
14
15 case "$ACTION" in
16 ifup)
17 fw_configure_interface "$INTERFACE" add "$DEVICE" &
18 ;;
19 ifdown)
20 fw_configure_interface "$INTERFACE" del "$DEVICE" &
21 ;;
22 esac