Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 3 Dec 1996 14:35:48 +0100 (GMT+0100)
From:      af@biomath.jussieu.fr (Alain FAUCONNET)
To:        keithl@wakko.gil.net (Keith Leonard)
Cc:        questions@freebsd.org
Subject:   Re: Shutdown of pppd
Message-ID:  <199612031335.AA07567@iaka.biomath.jussieu.fr>
In-Reply-To: <Pine.LNX.3.95.961203071833.28587A-100000@wakko.gil.net> from Keith Leonard at "Dec 3, 96 07:28:22 am"

next in thread | previous in thread | raw e-mail | index | archive | help
Keith Leonard wrote / a ecrit:
> Howdy,
> 
> I seem to be having a little problem with shutting down my internet
> connection. On another UN*X (which will remain unnamed) I use the
> following scripts (with small config changes) to start-up and shutdown my
> connection to the net (I am using kernel ppp and not tun):
> 
> #!/bin/sh
> ps ax | grep pppd | grep -v grep
> PID=`ps ax | grep pppd | grep -v grep | awk '{print $1}'`
> 
> if [ "$PID" = "" ]
> then
> 	pppd connect 'chat -v "" ATDTXXXXXXX CONNECT ""\
> 	Name: XXXXXX Password: XXXXXXXXXXX' \
> 	/dev/cuaa0 38400 :
> fi


I  gather that you seem to be using the kernel version of PPP. Same as
the  one I use (not on FreeBSD, but that should not be much relevant).
So far, so good.


> 
> Not very elegant but it works for getting on - now for getting off:
> 
> #!/bin/sh
> pid=`ps ax | grep pppd | grep -v grep | awk '{print$1;}'`
> if [ X${pid} != "X" ] ; then
> 	echo 'killing pppd, PID=' ${pid}
> 	kill -9 ${pid}
> 	route flush
> fi
> 
> the route flush seems to work (added for FreeBSD) - Now here is the
> problem:
> 
> If I try to reconnect within a short time (less than 10 minutes) pppd (I
> think) goes through the usual and then informs me that the address already
> exist (I assume the ISP assign address - dynamic) and I can get nowhere
> (telnet, ftp, etc). What do I need to clean up the mess that this
> inelegant soulution has produced so that I can relogin without rebooting
> (I'm on a standalone machine).


Sending a KILL signal to pppd is NOT a good idea. This signal  is  not
catchable and thus pppd exits abruptly. I hasn't got a  chance  to  do
any cleanup, and that might be the cause for your trouble (route flush
should not be required if pppd exited cleanly nevertheless).

I  suggest  replacing  the  "kill -9" by "kill -INT" or "kill -2". The
pppd daemon will catch that signal and exit cleanly.

_Alain_
-- 
Alain FAUCONNET    Ingenieur systeme - System Manager     AP-HP/SIM
Public Health                91 bld de l'Hopital 75013 PARIS FRANCE
Medical Computing Research Labs         Mail: af@biomath.jussieu.fr
Tel: (+33) (0)1-40-77-96-19             Fax: (+33) (0)1-45-86-80-68
    I've RTFMed. It says: "Refer to your system administrator"
            But... I *am* the system administrator :-]



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199612031335.AA07567>