firewall.hotplug 539 B

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