#!/bin/sh
#
#        +-----------------------------------------------------------------------------+
#        | Endian Firewall                                                             |
#        +-----------------------------------------------------------------------------+
#        | Copyright (c) 2005-2006 Endian                                              |
#        |         Endian GmbH/Srl                                                     |
#        |         Bergweg 41 Via Monte                                                |
#        |         39057 Eppan/Appiano                                                 |
#        |         ITALIEN/ITALIA                                                      |
#        |         info@endian.it                                                      |
#        |                                                                             |
#        | This program 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 program 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.                                |
#        |                                                                             |
#        | You should have received a copy of the GNU General Public License           |
#        | along with this program; if not, write to the Free Software                 |
#        | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. |
#        | http://www.fsf.org/                                                         |
#        +-----------------------------------------------------------------------------+
#

#
# This file is triggered when a pppd link goes down and it will
# deactivate the uplink associated with it
#

if [ -z "$LINKNAME" ]; then
    logger "pppd: ip-down not triggered, no linkname set"
    exit 1
fi

PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin
. /etc/rc.d/efw_lib.sh

if [ ! -d "${UPLINK_VAR}/$LINKNAME" ]; then
    # this ppp connection is not an uplink, so do not do anything here
    exit 0
fi

. ${UPLINK_SCRIPTS}/generic/route.sh
. ${UPLINK_SCRIPTS}/generic/hookery.sh

umask 0022

init_variables $LINKNAME "stop"
route_stop
set_inactive "$LINKNAME"

exit 0
