#!/bin/sh
# This script receives the arguments passed to /etc/ppp/ip-up by pppd
# $6 is (not all the time "pppdialin")
# $7 is the user id
# $6 and $7 are passed by the pppd ipparam parameter when
# called by ppplogin
PPPPARMS=/usr/lib/linuxconf/lib/pppparms
USER=$7
if [ "$6" = "pppdialin" ] ; then
	# Check out the routing
	$PPPPARMS routing $USER | \
		while read net mask
		do
			/sbin/route add -net $net netmask $mask dev $1
		done
	# check out for a postconnect command
	eval `$PPPPARMS pppdopt $USER defppp`
	if [ "$PPP_POSTCONCMD" != "" ] ; then
		eval $PPP_POSTCONCMD
	fi
	if [ "$PPP_DELIVERMAIL" != "" ] ; then
		/usr/sbin/sendmail -qR$PPP_DELIVERMAIL
	fi
	echo $1 >/var/run/pppdialin.$USER
	if [ "$PPP_FIREWALL" = "yes" ] ; then
		/bin/linuxconf --modulemain firewall --update
	fi
fi

