All of lore.kernel.org
 help / color / mirror / Atom feed
* about pppd termination?
@ 2008-05-21  6:47 cyx_mail
  2008-05-21  6:56 ` James Cameron
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: cyx_mail @ 2008-05-21  6:47 UTC (permalink / raw)
  To: linux-ppp

Hi, All:

	I think there are two reasons that cause pppd terminate himself: (1) the link has down (2) pppd has received SIGTERM
Whether these two kinds of termination process eventually go to a same path? or they finally call the same function. And the function is "die()" ? Thanks :) 



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: about pppd termination?
  2008-05-21  6:47 about pppd termination? cyx_mail
@ 2008-05-21  6:56 ` James Cameron
  2008-05-21  7:10 ` cyx_mail
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: James Cameron @ 2008-05-21  6:56 UTC (permalink / raw)
  To: linux-ppp

Consider the ip_down_hook plugin hook if you want to catch either event.

pppd can also be killed with SIGKILL, unhandled, and so kernel destroys
interface.  No code in pppd executed.  No ip_down_hook executed.

-- 
James Cameron                         http://quozl.netrek.org/
HP Open Source, Volunteer             http://opensource.hp.com/
PPTP Client Project, Release Engineer http://pptpclient.sourceforge.net/

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Re: about pppd termination?
  2008-05-21  6:47 about pppd termination? cyx_mail
  2008-05-21  6:56 ` James Cameron
@ 2008-05-21  7:10 ` cyx_mail
  2008-05-21 14:23 ` James Carlson
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: cyx_mail @ 2008-05-21  7:10 UTC (permalink / raw)
  To: linux-ppp

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="windows-1254", Size: 1114 bytes --]

Thank you!
	BTW,why the function "kill_my_pg(sig)" do a system call "kill(0,sig)" with the first parameter "0"? why not to kill himself only but a whole group?

2008-05-21 
cyx_mail 

·¢¼þÈË£º James Cameron 
·¢ËÍʱ¼ä£º 2008-05-21  14:55:44 
ÊÕ¼þÈË£º cyx_mail 
³­ËÍ£º linux-ppp 
Ö÷Ì⣺ Re: about pppd termination? 
 
Consider the ip_down_hook plugin hook if you want to catch either event.
pppd can also be killed with SIGKILL, unhandled, and so kernel destroys
interface.  No code in pppd executed.  No ip_down_hook executed.
-- 
James Cameron                         http://quozl.netrek.org/
HP Open Source, Volunteer             http://opensource.hp.com/
PPTP Client Project, Release Engineer http://pptpclient.sourceforge.net/
--
To unsubscribe from this list: send the line "unsubscribe linux-ppp" in
the body of a message to majordomo@vger.kernel.org
__________ NOD32 3090 (20080509) Information __________
This message was checked by NOD32 antivirus system.
http://www.nod32cn.com
ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þšiþ)í…æèw*\x1fjg¬±¨\x1e¶‰šŽŠÝ¢jÿ¾\a«þG«éÿ¢¸\f¢·¦j:+v‰¨ŠwèjØm¶Ÿÿþø\x1e¯ù\x1e®w¥þŠàþf£¢·hšâúÿ†Ù¥

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Re: about pppd termination?
  2008-05-21  6:47 about pppd termination? cyx_mail
  2008-05-21  6:56 ` James Cameron
  2008-05-21  7:10 ` cyx_mail
@ 2008-05-21 14:23 ` James Carlson
  2008-05-21 23:08 ` James Cameron
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: James Carlson @ 2008-05-21 14:23 UTC (permalink / raw)
  To: linux-ppp

cyx_mail writes:
> 	BTW,why the function "kill_my_pg(sig)" do a system call "kill(0,sig)" with the first parameter "0"? why not to kill himself only but a whole group?

pppd acts as a process group leader, and sending a signal to the
process group means that all children created by pppd (at least those
that haven't gone off to start new process groups) will get the
signal.  This basically cleans up any charshunt or script that might
be running in preparation to exit.

There'd be no point in pppd sending the signal to himself only.  The
whole reason that pppd is doing this at all is that it's about to
exit!  It has already gotten the signal; and talking to yourself is
often not useful.

For more information about the kill(2) system call and process groups,
see your system manual pages, or any reference book on UNIX or POSIX
programming.

-- 
James Carlson         42.703N 71.076W         <carlsonj@workingcode.com>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Re: about pppd termination?
  2008-05-21  6:47 about pppd termination? cyx_mail
                   ` (2 preceding siblings ...)
  2008-05-21 14:23 ` James Carlson
@ 2008-05-21 23:08 ` James Cameron
  2008-05-21 23:14 ` James Carlson
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: James Cameron @ 2008-05-21 23:08 UTC (permalink / raw)
  To: linux-ppp

On Wed, May 21, 2008 at 10:23:53AM -0400, James Carlson wrote:
> pppd acts as a process group leader, and sending a signal to the
> process group means that all children created by pppd (at least those
> that haven't gone off to start new process groups) will get the
> signal.  This basically cleans up any charshunt or script that might
> be running in preparation to exit.

That reminds me.  In the pptpconfig GUI we must define a handler for
SIGINT before starting pppd, because if we don't the SIGINT we send to
pppd comes back to us because of "kill(0,sig)".  Why is this?  popen is
used to activate pppd, so that output from pppd is redirected to GUI.

-- 
James Cameron                         http://quozl.netrek.org/
HP Open Source, Volunteer             http://opensource.hp.com/
PPTP Client Project, Release Engineer http://pptpclient.sourceforge.net/

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Re: about pppd termination?
  2008-05-21  6:47 about pppd termination? cyx_mail
                   ` (3 preceding siblings ...)
  2008-05-21 23:08 ` James Cameron
@ 2008-05-21 23:14 ` James Carlson
  2008-05-22  0:00 ` James Cameron
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: James Carlson @ 2008-05-21 23:14 UTC (permalink / raw)
  To: linux-ppp

James Cameron writes:
> On Wed, May 21, 2008 at 10:23:53AM -0400, James Carlson wrote:
> > pppd acts as a process group leader, and sending a signal to the
> > process group means that all children created by pppd (at least those
> > that haven't gone off to start new process groups) will get the
> > signal.  This basically cleans up any charshunt or script that might
> > be running in preparation to exit.
> 
> That reminds me.  In the pptpconfig GUI we must define a handler for
> SIGINT before starting pppd, because if we don't the SIGINT we send to
> pppd comes back to us because of "kill(0,sig)".  Why is this?  popen is
> used to activate pppd, so that output from pppd is redirected to GUI.

I'm not familiar with that GUI.  Is this a "nodetach" case?  An
alternative might be to avoid sending signals to the process group if
pppd is not actually the group leader.

pppd ought to be in charge of its progeny, but parricide doesn't sound
like the right answer.  ;-}

-- 
James Carlson         42.703N 71.076W         <carlsonj@workingcode.com>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Re: about pppd termination?
  2008-05-21  6:47 about pppd termination? cyx_mail
                   ` (4 preceding siblings ...)
  2008-05-21 23:14 ` James Carlson
@ 2008-05-22  0:00 ` James Cameron
  2008-05-22  0:38 ` James Carlson
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: James Cameron @ 2008-05-22  0:00 UTC (permalink / raw)
  To: linux-ppp

On Wed, May 21, 2008 at 07:14:13PM -0400, James Carlson wrote:
> I'm not familiar with that GUI.

Good, I'm trying to let it die.  It is written in PHP-GTK.

> Is this a "nodetach" case?

No, updetach is used.

> An alternative might be to avoid sending signals to the process group
> if pppd is not actually the group leader.

This would have the side effect of not terminating the processes that
pppd started.  Wouldn't it be better if pppd made itself the group
leader?

-- 
James Cameron                         http://quozl.netrek.org/
HP Open Source, Volunteer             http://opensource.hp.com/
PPTP Client Project, Release Engineer http://pptpclient.sourceforge.net/

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Re: about pppd termination?
  2008-05-21  6:47 about pppd termination? cyx_mail
                   ` (5 preceding siblings ...)
  2008-05-22  0:00 ` James Cameron
@ 2008-05-22  0:38 ` James Carlson
  2008-05-22  0:38 ` Paul Mackerras
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: James Carlson @ 2008-05-22  0:38 UTC (permalink / raw)
  To: linux-ppp

James Cameron writes:
> On Wed, May 21, 2008 at 07:14:13PM -0400, James Carlson wrote:
> > An alternative might be to avoid sending signals to the process group
> > if pppd is not actually the group leader.
> 
> This would have the side effect of not terminating the processes that
> pppd started.  Wouldn't it be better if pppd made itself the group
> leader?

Yes ... I was just trying to understand how you got into that state.

The detach() function (as long as you don't use nodetach) should get
you into that process group leader status.

Is it possible that the signal was sent before the setsid() was done
(i.e., before IPCP went Opened)?  If so, then we might need to tweak
how the process group is managed in the special case of (at least)
updetach.

-- 
James Carlson         42.703N 71.076W         <carlsonj@workingcode.com>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Re: about pppd termination?
  2008-05-21  6:47 about pppd termination? cyx_mail
                   ` (6 preceding siblings ...)
  2008-05-22  0:38 ` James Carlson
@ 2008-05-22  0:38 ` Paul Mackerras
  2008-05-22  0:52 ` James Cameron
  2008-05-22  0:56 ` James Cameron
  9 siblings, 0 replies; 11+ messages in thread
From: Paul Mackerras @ 2008-05-22  0:38 UTC (permalink / raw)
  To: linux-ppp

James Cameron writes:

> That reminds me.  In the pptpconfig GUI we must define a handler for
> SIGINT before starting pppd, because if we don't the SIGINT we send to
> pppd comes back to us because of "kill(0,sig)".  Why is this?  popen is
> used to activate pppd, so that output from pppd is redirected to GUI.

Because pppd does kill_my_pg when it gets a SIGTERM, SIGINT or SIGHUP
even if it hasn't detached, and it probably shouldn't.  Calling
kill_my_pg is the right thing to do if pppd has detached, because then
it has done a setsid.  But if it hasn't detached, then any signal sent
to the process group will get to any connector/disconnector processes
that are running anyway.  There does still remain the question of how
pppd gets any connector/disconnector processes to stop if pppd has to
terminate for other reasons, such as getting a SIGSEGV, though.

Paul.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Re: about pppd termination?
  2008-05-21  6:47 about pppd termination? cyx_mail
                   ` (7 preceding siblings ...)
  2008-05-22  0:38 ` Paul Mackerras
@ 2008-05-22  0:52 ` James Cameron
  2008-05-22  0:56 ` James Cameron
  9 siblings, 0 replies; 11+ messages in thread
From: James Cameron @ 2008-05-22  0:52 UTC (permalink / raw)
  To: linux-ppp

On Wed, May 21, 2008 at 08:38:22PM -0400, James Carlson wrote:
> Is it possible that the signal was sent before the setsid() was done
> (i.e., before IPCP went Opened)?  If so, then we might need to tweak
> how the process group is managed in the special case of (at least)
> updetach.

Yes, that's the situation.  I remember now.  Until we added the handler
for SIGINT in the GUI, what would happen is that the GUI would die with
a SIGINT as a result of the user hitting the "Cancel" button before the
tunnel was established.  That button sent a SIGINT to the pppd which had
not yet detached.

-- 
James Cameron                         http://quozl.netrek.org/
HP Open Source, Volunteer             http://opensource.hp.com/
PPTP Client Project, Release Engineer http://pptpclient.sourceforge.net/

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Re: about pppd termination?
  2008-05-21  6:47 about pppd termination? cyx_mail
                   ` (8 preceding siblings ...)
  2008-05-22  0:52 ` James Cameron
@ 2008-05-22  0:56 ` James Cameron
  9 siblings, 0 replies; 11+ messages in thread
From: James Cameron @ 2008-05-22  0:56 UTC (permalink / raw)
  To: linux-ppp

On Thu, May 22, 2008 at 10:38:39AM +1000, Paul Mackerras wrote:
> There does still remain the question of how pppd gets any
> connector/disconnector processes to stop if pppd has to terminate for
> other reasons, such as getting a SIGSEGV, though.

Yes, or SIGKILL.  I remember one user who habitually used -9 and then
complained that the connector (pptp) wasn't terminating forthwith.

Tracking each process created would be effective, and could remove the
need for a process group kill.  I'm just not sure if that level of
change is justified.

-- 
James Cameron                         http://quozl.netrek.org/
HP Open Source, Volunteer             http://opensource.hp.com/
PPTP Client Project, Release Engineer http://pptpclient.sourceforge.net/

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2008-05-22  0:56 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-21  6:47 about pppd termination? cyx_mail
2008-05-21  6:56 ` James Cameron
2008-05-21  7:10 ` cyx_mail
2008-05-21 14:23 ` James Carlson
2008-05-21 23:08 ` James Cameron
2008-05-21 23:14 ` James Carlson
2008-05-22  0:00 ` James Cameron
2008-05-22  0:38 ` James Carlson
2008-05-22  0:38 ` Paul Mackerras
2008-05-22  0:52 ` James Cameron
2008-05-22  0:56 ` James Cameron

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.