Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 143914 - sys-apps/baselayout-1.12.4-r4 = infinite net.ppp0 restart when pptp is killed
Summary: sys-apps/baselayout-1.12.4-r4 = infinite net.ppp0 restart when pptp is killed
Status: RESOLVED CANTFIX
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] baselayout (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo Dialup Developers
URL:
Whiteboard:
Keywords:
: 143916 (view as bug list)
Depends on:
Blocks: 143988
  Show dependency tree
 
Reported: 2006-08-14 12:07 UTC by Sergey Belyashov
Modified: 2006-08-20 22:01 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
/var/log/messages (log.txt,64.06 KB, text/plain)
2006-08-15 04:49 UTC, Sergey Belyashov
Details
log when pppd_ppp0 with debug option (ppp_debug.log,24.74 KB, text/plain)
2006-08-15 08:48 UTC, Sergey Belyashov
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Sergey Belyashov 2006-08-14 12:07:29 UTC
Tomorrow I update baselayout and ppp packages (I remove previous /etc/init.d/net.ppp0 and /etc/conf.d/net.ppp0 files).
I make link to net.lo with name 'net.ppp0'.
I add to /etc/conf.d/net next lines:
config_ppp0=( "ppp" )
link_ppp0="pty 'pptp --sync ppp.some-isp.ru --nolaunchpppd --loglevel 0'"
username_ppp0='bsa'
depend_ppp0() {
    need net.eth0
}
pppd_ppp0=(
    lock
    sync
    require-mschap
    noauth
    nopcomp
    noaccomp
    nobsdcomp
    nodeflate
    defaultroute
)
And I start net.ppp0. All starts and works fine. But I need some extra features: when real link is up it's need to add some routes, change some configs and reload some services (bind and postfix, for example). It is need for two separate internet channels. To check them I add to /etc/conf.d/net next functions:
postup() {
    logger -t $1 Interface $1 up
}

postdown() {
    logger -t $1 Interface $1 down
}
Restart net.ppp0. And run 'killall pptp'...
Next I run tail -f /var/log/messages:
Aug 14 22:03:56 bsa pptp[19941]: anon log[ctrlp_disp:pptp_ctrl.c:738]: Received Start Control Connection Reply
Aug 14 22:03:56 bsa pptp[19941]: anon log[ctrlp_disp:pptp_ctrl.c:772]: Client connection established.
Aug 14 22:03:57 bsa pptp[19941]: anon log[ctrlp_rep:pptp_ctrl.c:251]: Sent control packet type is 7 'Outgoing-Call-Request'
Aug 14 22:03:57 bsa pptp[19941]: anon log[ctrlp_disp:pptp_ctrl.c:857]: Received Outgoing Call Reply.
Aug 14 22:03:57 bsa pptp[19941]: anon log[ctrlp_disp:pptp_ctrl.c:896]: Outgoing call established (call ID 0, peer's call ID 0).
Aug 14 22:03:57 bsa pppd[19921]: CHAP authentication succeeded: <some code>
Aug 14 22:03:57 bsa pppd[19921]: CHAP authentication succeeded
Aug 14 22:03:57 bsa pppd[19921]: local  IP address yyy.yyy.yyy.yyy
Aug 14 22:03:57 bsa pppd[19921]: remote IP address xxx.xxx.xxx.xxx
Aug 14 22:03:58 bsa ppp0: Interface ppp0 up
Aug 14 22:04:40 bsa sudo:   bsa : TTY=pts/3 ; PWD=/home/bsa ; USER=root ; COMMAND=/bin/killall pptp
Aug 14 22:04:40 bsa pppd[19921]: Modem hangup
Aug 14 22:04:40 bsa pppd[19921]: Connect time 0.8 minutes.
Aug 14 22:04:40 bsa pppd[19921]: Sent 1028 bytes, received 2145 bytes.
Aug 14 22:04:40 bsa pptp[19941]: anon log[callmgr_main:pptp_callmgr.c:231]: Closing connection (unhandled)
Aug 14 22:04:40 bsa pptp[19941]: anon log[ctrlp_rep:pptp_ctrl.c:251]: Sent control packet type is 12 'Call-Clear-Request'
Aug 14 22:04:40 bsa pptp[19941]: anon log[call_callback:pptp_callmgr.c:78]: Closing connection (call state)
Aug 14 22:04:40 bsa pppd[19921]: Connection terminated.
Aug 14 22:04:41 bsa ppp0: Interface ppp0 down
Aug 14 22:04:41 bsa pppd[19921]: Using interface ppp0
Aug 14 22:04:41 bsa pppd[19921]: Connect: ppp0 <--> /dev/pts/4
Aug 14 22:04:41 bsa pptp[20817]: anon log[main:pptp.c:267]: The synchronous pptp option is activated
Aug 14 22:04:41 bsa pptp[20830]: anon log[ctrlp_rep:pptp_ctrl.c:251]: Sent control packet type is 1 'Start-Control-Connection-Request'
Aug 14 22:04:41 bsa pptp[20830]: anon log[ctrlp_disp:pptp_ctrl.c:738]: Received Start Control Connection Reply
Aug 14 22:04:41 bsa pptp[20830]: anon log[ctrlp_disp:pptp_ctrl.c:772]: Client connection established.
Aug 14 22:04:42 bsa pptp[20830]: anon log[ctrlp_rep:pptp_ctrl.c:251]: Sent control packet type is 7 'Outgoing-Call-Request'
Aug 14 22:04:42 bsa pptp[20830]: anon log[ctrlp_disp:pptp_ctrl.c:857]: Received Outgoing Call Reply.
Aug 14 22:04:42 bsa pptp[20830]: anon log[ctrlp_disp:pptp_ctrl.c:896]: Outgoing call established (call ID 0, peer's call ID 128).
Aug 14 22:04:42 bsa pppd[19921]: CHAP authentication succeeded: <some code>
Aug 14 22:04:42 bsa pppd[19921]: CHAP authentication succeeded
Aug 14 22:04:42 bsa pppd[19921]: local  IP address yyy.yyy.yyy.yyy
Aug 14 22:04:42 bsa pppd[19921]: remote IP address xxx.xxx.xxx.xxx
Aug 14 22:04:43 bsa ppp0: Interface ppp0 up
Aug 14 22:04:45 bsa pptp[20830]: anon log[callmgr_main:pptp_callmgr.c:231]: Closing connection (unhandled)
Aug 14 22:04:45 bsa pptp[20830]: anon log[ctrlp_rep:pptp_ctrl.c:251]: Sent control packet type is 12 'Call-Clear-Request'
Aug 14 22:04:45 bsa pptp[20830]: anon log[call_callback:pptp_callmgr.c:78]: Closing connection (call state)
Aug 14 22:04:45 bsa pppd[19921]: Modem hangup
Aug 14 22:04:45 bsa pppd[19921]: Connect time 0.1 minutes.

.... etc (cycled).

Then I check /etc/ppp/ip-up script and found next lines:
if [ -x /etc/init.d/net.$1 ]; then
        if ! /etc/init.d/net.$1 --quiet status ; then
                export IN_BACKGROUND="true"
                /etc/init.d/net.$1 --quiet start
        fi
fi

This can be read as: if /etc/init.d/net.ppp0 present and /etc/init.d/net.ppp0 not started then start it.
But. As I know ip-up executed every time link up, but not pppd starts (for example, when isp cause link abort to change dynamic IP, and pppd automatically reconnects).
In ip-down present same lines which stops script when it started.

In this case:
I kill pptp. pptp finishes and pppd execute ip-down and pptp again to restore link...
at this time ip-down calls 'net.ppp0 stop' and pppd calls ip-up because link were up...
ip-up calls 'net.ppp0 start' and pppd calls ip-down before terminating...
etc...
Comment 1 Sergey Belyashov 2006-08-14 12:15:59 UTC
*** Bug 143916 has been marked as a duplicate of this bug. ***
Comment 2 Alin Năstac (RETIRED) gentoo-dev 2006-08-15 03:54:34 UTC
You misunderstood the functionality.
When IN_BACKGROUND is set to true, "/etc/init.d/net.ppp0 start" command performs the inactive->started transition, while the stop operation performs the reverse transition.

The link continues to come up because pppd is launched with "persist" option activated, which means it will continue to start the link until user stop it by running /etc/init.d/net.ppp0 stop. This is not a bug, it is the way we designed PPP baselayout support in the first place.
Comment 3 Sergey Belyashov 2006-08-15 04:41:26 UTC
I see that net.ppp0 service change their status to inactive.
But why my /var/log/messages fills by many messages that ppp link up/down? In my previous post I copy only 2 cycles of these messages. I can post my full log. It contain much more same messages.
Comment 4 Sergey Belyashov 2006-08-15 04:49:28 UTC
Created attachment 94304 [details]
/var/log/messages

This is my actions:
Aug 14 22:03:19 - I stop previous version of pppd...
Aug 14 22:03:56 - I start new version with new config (net.ppp0 start)
Aug 14 22:04:40 - I kill pptp
Aug 14 22:05:49 - I run /etc/init.d/net.ppp0 stop
Aug 14 22:07:15 - I start net.ppp0 again
Aug 14 22:07:53 - And run kill -9 pptp
Aug 14 22:08:50 - I stop net.ppp0
Aug 14 22:09:04 - And start again
Aug 14 22:10:57 - Final restart.
Comment 5 Alin Năstac (RETIRED) gentoo-dev 2006-08-15 05:32:06 UTC
I don't know why your connection gets restarted so often, but did you tried without --sync?
Comment 6 Sergey Belyashov 2006-08-15 07:19:14 UTC
I try to remove '--sync' from pptp options and 'sync' from pppd options. This does not fix problem.

1. First I try to comment start & stop lines in /etc/init.d/net.lo (for example, in start() and stop() functions I comment calls to run function). But It does not solve my problem.

2. Then I try to comment line #36 ('net.$1 --quiet stop') of /etc/ppp/ip-down:
But it does not solve problem too.
3. I comment line #35 ('if /etc/init.d/net.$1 --quiet status ; then') and line #37 ('fi'). It solve problem.
4. I rewrite line #35 to 'if [ -e /var/lib/init.d/started/net.$1 ]; then ' and decomment line #36. Problem arives back.

some lines from ip-down script:
34:if [ -x /etc/init.d/net.$1 ]; then
35:    if /etc/init.d/net.$1 --quiet status ; then
36:         export IN_BACKGROUND="true"
37:         /etc/init.d/net.$1 --quiet stop
38:    fi
39:fi

I try to run '/etc/init.d/net.ppp0 --quiet status' manually (when net.ppp0 were started). But no destructive effects.
I think that problem is causes when /etc/init.d/net.ppp0 called from ip-down script only.

May be good way is to build special function which inactivates this service?
Comment 7 Sergey Belyashov 2006-08-15 07:24:08 UTC
I'm sorry. My post have misstakes in line numbers:
33:if [ -x /etc/init.d/net.$1 ]; then
34:       if /etc/init.d/net.$1 --quiet status ; then
35:               export IN_BACKGROUND="true"
36:               /etc/init.d/net.$1 --quiet stop
37:       fi
38:fi

2. I comment line #36
3. I comment lines #34 & #37
4. I rewrite line #34, decomment lines #36 & #37
Comment 8 Alin Năstac (RETIRED) gentoo-dev 2006-08-15 08:14:23 UTC
Please add "debug" to pppd_ppp0, in case you didn't had it in /etc/ppp/options.

Roy, do you have any idea?
Comment 9 Sergey Belyashov 2006-08-15 08:48:59 UTC
Created attachment 94329 [details]
log when pppd_ppp0 with debug option

Aug 15 19:32:06 : I kill pptp when my CPU used for compile qt-4.1.4. As result pppd restore connection and do not abort it. But it were not works.

Aug 15 19:34:10 : I pause compilation (Ctrl-Z) and kill pptp again. You can see that pppd use cyclic reconnections.
Comment 10 Alin Năstac (RETIRED) gentoo-dev 2006-08-15 09:55:44 UTC
Does it work when you don't kill the pptp process? 
Why exactly do you kill it anyway?
Comment 11 Sergey Belyashov 2006-08-15 10:21:17 UTC
Yes. It work properly.

Also I try to remove ethernet cable from network card. pppd restarts link properly (without loopping).

I use kill pptp method to check script because it is more possible than physical influence on remote server. ;-) On previous net.ppp0 script it works as need...
Comment 12 Alin Năstac (RETIRED) gentoo-dev 2006-08-15 11:41:16 UTC
Wouldn't it be better to kill -HUP pppd instead?
Comment 13 Sergey Belyashov 2006-08-15 12:12:39 UTC
may be. But what is if pptp killed by segfault?
I want to check all variants and pessimistic too.
Comment 14 Roy Marples (RETIRED) gentoo-dev 2006-08-15 15:34:24 UTC
With ppp started, whats the contents of /var/lib/init.d/daemons/net.ppp0?
Comment 15 Sergey Belyashov 2006-08-16 09:03:16 UTC
$ cat /var/lib/init.d/daemons/net.ppp0
RC_DAEMONS[0]="/usr/sbin/pppd"
RC_PIDFILES[0]="/var/run/ppp-ppp0.pid"
Comment 16 Roy Marples (RETIRED) gentoo-dev 2006-08-16 09:08:46 UTC
Right then

/etc/init.d/net.ppp0 --quiet status
also checks the daemons started and if any have been stopped then it calls stop on itself if we are root as some of the daemons "crashed". I think that killing pptp is either killing pppd or at least causing pppd to use a different PID which I think is what we are seeing here.

Solutions - don't call status and just do a start/stop or document this as a known issue. I don't care either way really, but FWIW other re-entrant net.foo programs such as ifplugd,netplug,wpa_supplicant don't check status either - they just call start/stop respectively.
Comment 17 Sergey Belyashov 2006-08-16 09:37:30 UTC
(In reply to comment #16)
> Solutions - don't call status and just do a start/stop or document this as a
> known issue. I don't care either way really, but FWIW other re-entrant net.foo
> programs such as ifplugd,netplug,wpa_supplicant don't check status either -
> they just call start/stop respectively.

See my comments #6 and #7. I try to remove call to status. But no effect.
Also I try to check your version about pid changing. Result: pppd pid IS NOT CHANGING after killing pptp. You can see it in my logs. ;-)
Comment 18 Roy Marples (RETIRED) gentoo-dev 2006-08-17 04:57:48 UTC
OK, document the issue then. I can see no other solution. Back with you Alin :)
Comment 19 Alin Năstac (RETIRED) gentoo-dev 2006-08-20 22:01:15 UTC
closing it as CANTFIX