Bug 6291 - ifup hangs when using demand-dialling
Summary: ifup hangs when using demand-dialling
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: initscripts
Version: 6.1
Hardware: i386
OS: Linux
Target Milestone: ---
Assignee: Nalin Dahyabhai
QA Contact:
: 9552 (view as bug list)
Depends On:
TreeView+ depends on / blocked
Reported: 1999-10-23 23:07 UTC by rh-devel
Modified: 2008-05-01 15:37 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2001-03-04 21:15:11 UTC

Attachments (Terms of Use)

Description rh-devel 1999-10-23 23:07:22 UTC
I customarily have my single PPP device configured with the
'demand' pppd option; with such a configuration the ppp
device is always around, and uses a 10-net IP and a
defaultroute when not connected.  When 'ifup pppN' is run
(for whatever N), pppd is started properly, sets up its IP
and route, and starts waiting for traffic, but ifup doesn't
exit (if it's interrupted, things work okay).

At boot time, when the interface is brought up, the process
hangs for a bit, then marks the attempt as failed, explains
that it's retrying in the background, then proceeds -- a
moment later it dials (despite having no net traffic to
trigger the demand-dial), gets the wrong IP, and needs to be
killed and restarted manually.

Comment 1 rh-devel 1999-10-23 23:09:59 UTC
This problem also affects usernet; if usernet is used to bring up a
PPP interface using demand-dialling, the "Waiting for Connection"
window never goes away even after the interface is, for purposes of
demand dial, up.  Presumably the same problem.

Comment 2 Dave Booth 1999-11-11 17:33:59 UTC
I have the same problem, and found the following workaround:

(1) modify ifup to pass the "daemon" option to ifup-ppp taking control
away from ppp-watch. I was tired last night and lazy so hardcoded it
whilst testing, sooner or later I'll get around to fixing ifup so it
passes that option if "demand" is one of the pppd options but
obviously I'd rather see an "official" fix :)

(2) you also need to fix ifup-ppp so that it forks pppd instead of
hanging onto it - otherwise ifup-ppp will never return until you kill
pppd. I just modified the 2 lines that start "exec pppd -detach ...."
to get rid of the "exec" and "-detach" Whatever else happens this mod
is a good idea since if the ifup-ppp script gets here at all we are
supposed to be starting a daemon process and so why hold on to it and
stop it forking?????

As things stand at the moment those mods break ifdown-ppp, since
ifdown-ppp depends on ppp-watch establishing the pid file you have to
kill pppd to force the interface down. "ifdown ppp0" wont do it.

Alternatively, you could modify ppp-watch so that it can also act as a
wrapper around demand-dialling configs but I havent even started to
address that one since there isnt any documentation on ppp-watch and I
havent gotten around to searching throught the SRPMS for the source...

Comment 3 Dave Booth 1999-11-16 22:58:59 UTC
POSSIBLE FIX: A much neater solution than the crude workaround from my last
comment. modified ifup-ppp and ifdown-ppp scripts to treat demand dialing as a
special case. ifup-ppp checks both for the "daemon" option or for a demand-dial
config before acting. if neither passes control to ppp-watch as normal,
otherwise proceeds to start pppd. If its a demand-dial config dont try and be
synchronous just start it, otherwise behave as ppp-watch expects. ifdown-ppp
also checks for a demand-dial config if it cant find the ppp-watch pid file and
if it is demand-dialled looks for the pppd pid file instead. when killing the
process if the first SIGTERM doesnt bring it down a demand-dialling pppd is sent
a SIGKILL directly whilst a ppp-watch controlled pppd is dealt with as at
present. This works fine on my system (vanilla RH6.1 install) but YMMV. mail me
if you want my modified scripts.

Comment 4 Göran Uddeborg 1999-11-19 21:34:59 UTC
Just to give you a few more ideas how to do an official fix I'll tell you about
my workaround.  Things hang because ppp-watch isn't told by any do_netreport
call.  That is since ifup-post is called from ip-up, which isn't executed until
the connection actually is up.

So I added a couple of "(sleep X; do_netreport)&" lines before pppd is exec'ed.
I used a few different values for X.  That causes in effect ppp-watch to poll
att these times, and sees that the interface is up at one of them.

Similarily, I added a couple of do_netreport calls between the checks on
/proc/PID in ifdown-ppp.

Comment 5 Michael K. Johnson 1999-12-06 19:20:59 UTC
Dave's suggestions make the most sense, but to act on them we need to
extend the ifcfg format to have something like
in them so that we can easily check to see whether demand dialing
is being done.  This may require changes in rp3 as well, though.

We chose not to explicitly support pppd demand dialing so far in part
because of reports of problems with it unrelated to our scripts, and
in part because while we were doing the development, demand dialing
with a non-static IP was not supported.  We'll have to look into it
again for our next release.

Comment 6 Dave Booth 1999-12-06 20:05:59 UTC
You probably dont need to change the ifcfg format, its relatively trivial to
test for "demand" in the PPP_OPTIONS string. I'll mail the mods I made directly
to johnsonm@redhat.com, but in brief summary the only overhead it imposes is to
require ifup-ppp to get the config info *before* deciding whether or not to call
ppp-watch and changing the ifcfg format would impose the same condition so I
suspect its a moot point. Anyway, mail is on the way (fron dbooth@fibres.net
since I'm at work right now...) I suspect you dont need to do much more than
that. I'd be interested to find out whether those mods would, in fact, break
rp3... I dont think so but I'm not sure.

Comment 7 Michael K. Johnson 1999-12-06 20:17:59 UTC
I'm not going to look through the options, that makes for less
readable code.  We expand the list of defined tags for the ifcfg
files when we want to do something like this.  Keeps the code
more readable.

Comment 8 Dave Booth 1999-12-06 20:27:59 UTC
hmm, you already do in places.. not the options line but you do the "echo ...
|grep -q ..." thing for other parameters so it didnt seem much of much..

Fair enough, however you want to handle it :) pardon me whilst I just intercept
that email at the gateway...

Comment 9 Michael K. Johnson 1999-12-06 21:36:59 UTC
$ grep grep ifup-ppp

In some scripts, we don't have the option of keeping things as clean
as we would like, but at least in ifup-ppp we don't need to make
things harder for ourselves...  :-)

Anyway, thanks!

Comment 10 Göran Uddeborg 1999-12-07 21:20:59 UTC
Regardless of the technical issues:  To me it would make sense to have a
supported way to configure demand dialing, and the corresponding timout, without
having to rely on free form PPPOPTIIONS.

Comment 11 Michael K. Johnson 1999-12-08 16:51:59 UTC
Yes, of course it would make sense!  There's no argument about that.
The point is that there currently isn't one.

Comment 12 Bill Nottingham 2000-02-21 16:15:59 UTC
*** Bug 9552 has been marked as a duplicate of this bug. ***

Comment 13 Göran Uddeborg 2001-03-04 21:15:07 UTC
By now initscript supports a "DEMAND=yes" configurations.  So this bug can presumably be closed now.  Right?

Comment 14 Brent Fox 2002-06-05 04:41:50 UTC
Right.  Closing.

Note You need to log in before you can comment on or make changes to this bug.