e9d167b79df2c23499c4d4d7ade447208d4fb543
[openwrt/openwrt.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 . /etc/functions.sh
7
8 [ "$DEVICE" == "lo" ] && exit 0
9
10 . /lib/firewall/core.sh
11 fw_init
12 fw_is_loaded || exit 0
13
14 case "$ACTION" in
15 ifup)
16 fw_configure_interface "$INTERFACE" add "$DEVICE" ;;
17 ifdown)
18 fw_configure_interface "$INTERFACE" del "$DEVICE" ;;
19 esac