#!/bin/bash
#
# /etc/ppp/ip-{up,down}.d/freeswan
#
# wrapper script to call freeswan if-up/if-down script to work around dial on
# demand problems with ifdown (#39048)

BASENAME=${0##*/}
INTERFACE="$1"
DEVICE="$2"
SPEED="$3"
LOCALIP="$4"
REMOTEIP="$5"
IPPARAM="$6"

if [ -z "$ifcfg" -o -z "$INTERFACE" ]; then
	echo "this script needs to be run from ip-up or ip-down"
	exit 0
fi


case "$0" in
	*ip-up*)
		/etc/sysconfig/network/if-up.d/freeswan "$ifcfg" "$INTERFACE"
	;;
	*ip-down*)
		/etc/sysconfig/network/if-down.d/freeswan "$ifcfg" "$INTERFACE"
	;;
	*) echo "this script needs to be run from ip-up or ip-down" ;;
esac

exit 0
