#!/bin/sh
# This script is executed as part of the hotplug event with
# HOTPLUG_TYPE=iface, triggered by various scripts when an interface
# is configured (ACTION=ifup) or deconfigured (ACTION=ifdown).  The
# interface is available as INTERFACE, the real device as DEVICE.
FREESTRATEGY_LIBDIR=/lib/freeStrategy
. $FREESTRATEGY_LIBDIR/core_rule.sh
[ "$DEVICE" == "lo" ] && exit 0

case "$ACTION" in
	ifup)
		#fw_acl_event_interface "$INTERFACE" add
		echo "$INTERFACE" | grep -q "^wan" || return 0
		echo "$INTERFACE" | grep -q "wan.*_v6" && return 0
		[ $INTERFACE != "lan" -a $INTERFACE != "loopback" ] && {
			/lib/freeStrategy/add_delete.sh url &
			wportal_external_url_freeStrategy_exit
			wportal_external_url_freeStrategy_start
		}
	;;
	ifdown)
		#fw_acl_event_interface "$INTERFACE" del
		#/lib/freeStrategy/interface.sh "$INTERFACE"
		
	;;
	ifupdate)
		# do nothing
	;;
esac