#!/bin/sh

if [ -f /etc/ppp/pap-secrets.sav ]; then
	mv /etc/ppp/pap-secrets.sav /etc/ppp/pap-secrets
fi
if [ -f /etc/ppp/chap-secrets.sav ]; then
	mv /etc/ppp/chap-secrets.sav /etc/ppp/chap-secrets
fi

GW=`route -n | while read line; do
	set - $line
	case "$4" in
	*G*H*|*H*G*)
		echo $2
		route del -host "$1" gw "$2" || exit 1
		;;
	esac
done`
set - ${GW}
GW=$1

killall pptp
route del -net default
route add -net default gw ${GW} || exit 1
