Strange problem with ip-down (invoked from pppd) under Linux

Strange problem with ip-down (invoked from pppd) under Linux

Post by Bob William » Sun, 14 Jan 1996 04:00:00



PPP wizards,

I have an unusual problem with "ip-down".  We're running Yggdrasil Fall '95
plug'n'play (version B).  The login banner reports Linux version 1.2.13.  
The pppd is the stock version - straight out of the CD-ROM.  Running pppd
--version returns:
    pppd version 2.1 patch level 2 (Linux 1.0.1)

We can make a connection to the ISP over our ISDN modem (a Motorola
BitSurfer Pro), and the connection stays up for hours, sometimes days, at a
time.

The problem is that the ISP (or the ISDN modem) drops the line occasionally,
even though we have a ping running every 2 minutes.

OK, I took a look at the man page for pppd - cool! There's a script that's
called when pppd dies, it's called /etc/ppp/ip-down.  So...  I stuffed the
following commands into ip-down:

    #!/bin/sh
    echo Restarting ppp > /dev/console
    (/bin/sleep 45;/etc/ppp/startppp.isdn)&

That oughtta work (startppp.isdn is a script that fires off pppd, and works
correctly from the shell, and also from /etc/rc.d/rc.net2).  To test it, we
powered off the BitSurfer - pppd gets the SIGHUP, and executes ip-down (I
can see the "Restarting ppp" message on the console).  The idea of putting
the parentheses around the sleep/startppp is to let the ip-down script exit,
and possibly pppd exit, before restarting pppd.

Nada, Nyet, Nothing!  We get the "restarting" message, then nothing.  Do a
ps -fe | fgrep sleep, nothing!

We run ip-down from the shell as root - it works, firing off pppd after 45
seconds - we know the script works.

OK, maybe the attempt to put it in the background is the problem, so we
change the script to:

    #!/bin/sh
    echo "$0 $*" > /dev/console
    echo Restarting ppp > /dev/console
    /bin/sleep 45
    echo Finished sleeping - waking up  startppp.isdn > /dev/console
    /etc/ppp/startppp.isdn

Same thing, and we never see the "Finished sleeping..." message, no sleep in
ps -fe | fgrep sleep, nada, nix, nothing!

OK, maybe there's a signal problem, so I load up the beginning of the script
with:

    trap "echo ip-down: caught SIGHUP > /dev/console " 1
    trap "echo ip-down: caught SIGINT > /dev/console " 2
    trap "echo ip-down: caught SIGQUIT > /dev/console " 3

and so on, up to SIGPWR (30), just to see if there's a signal that's killing
the script.  Nothing shows up.

/bin/sh is a symlink to /bin/bash - could this be a problem with bash?  
Could it be a problem with sleep(1)?

So, I've run out of things to try.  Any suggestions?

Also, on another PPPD note, what are the correct MTU, MRU, MSS to set when
using both 56K ISDN channels, or is this something that the ISP's system
negotiates with my pppd, and I don't have to worry about it?  The best FTP
transfer rate I've seen since we started using both channels is 6.7K/second.

Thanks in advance for any help...

Bob Williams
--
============================================================================

                   Nuthin's certain, that's for sure!
============================================================================

 
 
 

Strange problem with ip-down (invoked from pppd) under Linux

Post by David Woolle » Mon, 15 Jan 1996 04:00:00




Quote:

>    #!/bin/sh
>    echo "$0 $*" > /dev/console
>    echo Restarting ppp > /dev/console
>    /bin/sleep 45
>    echo Finished sleeping - waking up  startppp.isdn > /dev/console
>    /etc/ppp/startppp.isdn

There is a problem with sleep in some versions of pppd and some versions
of Gnu libc, at least for the ip-up script.  pppd masks out the alarm
signal and shells with it still masked out and Gnu sleep(3) doesn't
override this (as a correct Posix implementation requires - interaction
is only allowed if it happens after the start of the sleep).  (This may
be true of latest versions, but I haven't had time to verify this yet.
I'm not sure whether it sets SIGIGN or actually masks it out (defers it)
or both.)

This doesn't seem to be your case, as you say that you can't see the
sleep process.  If you could see the third echo, I'd say that the
problem was that the final close hadn't occurred on the PPP line before
you ran startppp, but, as it is, I can't explain this behaviour.  You
may have to close any file descriptors open to PPP before the sleep,
although this is based on a theory I have about behaviour of pppd which
I haven't verified by reference to the code.

Another thought is that you are getting a SIGHUP when the line is
disconnected.

--


 
 
 

Strange problem with ip-down (invoked from pppd) under Linux

Post by Joe Philip » Wed, 24 Jan 1996 04:00:00


For me, pppd was LEGENDARY for not providing a working sleep in ip-up.

My ISP has switched to dynamic routing of incoming connects
(terminal/port server connects to the least loaded PPP server
machine).  It was announced a couple of months ago, but not
implemented until recently.  As such, there is an up to 15 second
delay where packets may not be routed to the PPP server.  Therefore,
much of my ip-up work had to be delayed 15 seconds.  I had many, many
ways that I tried to use a sleep mechanism (I even coded up my own C
program that called signal(2) and alarm(2), but to NO avail!).  I
eventually set up a login that had .hushlogin and .rhosts, and did
nothing but sleep 15 then log out ! :^) :^)

Eventually, I upgraded to ppp2.2.0c, and most of my problems went
away.  Now that I can see what was programmed (C source, where before
all I had was the binary), the new pppd does things a lot more
"correctly:" in particular, it makes a call to setsid(), so now, sleep
in any form ( (1) (3) ) works just fine.  Since I hopscotch between
providers, and it's therefore desireable to reset hostname and
domainname (which require you to run with uid == euid == 0), it's a
definite improvement to setuid(geteuid()); setgid(getegid()); before
running ip-{up,down}.  I no longer have to run my program that does
the same thing!

If you're trying to debug your PPP connects (LCP, IPCP), the logging
looks a lot more helpful in this rev.

To all Linuxers:  if you're having pppd problems, if you're getting
"fsm" messages in your debugs in syslog, if you're having any
weirdness whatsoever and you've done and rechecked all your network
setups.... do yourself a BIG favor and upgrade to ppp2.2.0x for x
later than "b".  Few will be disappointed.  I personally run the "c"
rev., and I hear it only gets better with the "d" and "e" revs.

 
 
 

Strange problem with ip-down (invoked from pppd) under Linux

Post by R.D. Auchterloun » Thu, 25 Jan 1996 04:00:00


[ on problems with ip-down scripts]

Quote:

>>    #!/bin/sh
>>    echo "$0 $*" > /dev/console
>>    echo Restarting ppp > /dev/console
>>    /bin/sleep 45
>>    echo Finished sleeping - waking up  startppp.isdn > /dev/console
>>    /etc/ppp/startppp.isdn
>There is a problem with sleep in some versions of pppd and some versions
>of Gnu libc, at least for the ip-up script.  pppd masks out the alarm

[...]

Having just spent all afternoon trying to debug the same problem
(and _then_ looked in this newsgroup... sigh) I can add some more
details:

  1) ip-up and ip-down are affected by the SIGALRM problem

  2) this affects other programs which use SIGALRM, not just sleep()
     eg. I was trying to get link stats back from the modem using
     "dip" (or "modem-stats") and both these hang just like sleep does
     when called from ip-down.

Quote:>This doesn't seem to be your case, as you say that you can't see the
>sleep process.  If you could see the third echo, I'd say that the
[...]
>Another thought is that you are getting a SIGHUP when the line is
>disconnected.

  3) this is the problem I think. It only affects ip-down, and then
     only randomly (depends on how long the modem takes to hangup ?).
     I suggest a ' trap "" 1 ' in ip-down.

[ Trying to debug the SIGHUP problem,  before you know about SIGALRM,
  by using trap and a loop with "sleep 1" doesn't help :( ]

Another poster has suggested that upgrading to 2.2.0? should cure at
least the SIGALRM problem - I will be trying that soon....

ray

--
Ray Auchterlounie                Research Student (still) at:


                "Don't ask me about my thesis (TM)"

 
 
 

Strange problem with ip-down (invoked from pppd) under Linux

Post by Joerg Ahre » Mon, 29 Jan 1996 04:00:00






>[ on problems with ip-down scripts]

>>>    #!/bin/sh
>>>    echo "$0 $*" > /dev/console
>>>    echo Restarting ppp > /dev/console
>>>    /bin/sleep 45
>>>    echo Finished sleeping - waking up  startppp.isdn > /dev/console
>>>    /etc/ppp/startppp.isdn
>>There is a problem with sleep in some versions of pppd and some versions
>>of Gnu libc, at least for the ip-up script.  pppd masks out the alarm

[...]

Quote:>Another poster has suggested that upgrading to 2.2.0? should cure at
>least the SIGALRM problem - I will be trying that soon....

Try using csh (#!/.../csh) in the scripts. csh resets signal masks! It works
for me in any case.

Joerg
--
------------------------------------------------------------------------------
Joerg Ahrens                                              _/          
Koenigsberger Strasse 32                                _/_/
31226 Peine                                           _/  _/
Tel.: 05171/57308                             _/    _/_/_/_/

------------------------------------------------------------------------------