#!/bin/sh
#
# Debian ifupdown hook script for madwifi-ng
#
# Author: Matt Brown <matt@mattb.net.nz>
# Modified by: Kel Modderman <kelrin@tpg.com.au>
#
# Copyright (C) 2005 - 2006   Matt Brown
#
# This is free software; you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
#
# This is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# On Debian GNU/Linux systems, the text of the GPL license can be found in
# /usr/share/common-licenses/GPL

WLANCONFIG=/sbin/wlanconfig

if [ ! -x "$WLANCONFIG" ]; then
	exit 0
fi

if [ ! -n "$IF_MADWIFI_BASE" ]; then
	exit 0
fi

if [ -n "$IF_MADWIFI_VAP" ]; then
	VAP="$IF_MADWIFI_VAP"
else
	VAP="$IFACE"
fi

# Destroy 
$WLANCONFIG $VAP destroy

exit $?
