| Summary: | cleanup of ppp server socket on unclean startup | ||||||
|---|---|---|---|---|---|---|---|
| Product: | Base System | Reporter: | Dmitry Morozovsky <marck> | ||||
| Component: | bin | Assignee: | freebsd-bugs (Nobody) <bugs> | ||||
| Status: | Closed FIXED | ||||||
| Severity: | Affects Only Me | ||||||
| Priority: | Normal | ||||||
| Version: | 4.3-STABLE | ||||||
| Hardware: | Any | ||||||
| OS: | Any | ||||||
| Attachments: |
|
||||||
|
Description
Dmitry Morozovsky
2001-08-22 22:00:00 UTC
On Thu, Aug 23, 2001 at 12:53:59AM +0400, Dmitry Morozovsky wrote: [snip] > >Description: > > After unclean shutdown (e.g, crash) ppp server socket > remains on file system. Then, if ppp started automatically > during startup, it cannot bind to that socket > > >How-To-Repeat: > > ppp_enable="YES" at /etc/rc.conf > > boot > > killall -9 ppp > shutdown -r now This is actually a more general issue than dealing with start-ups. You can just do, # ppp -background WhatEver Working in background mode Using interface: tun0 PPP enabled # kill -KILL `cat /var/run/tun.pid` ppp -background Earthlink Working in background mode Using interface: tun0 Warning: Local: bind: Address already in use Warning: set server: Failed 2 And get the same failure. > >Fix: > > Add another little knob to rc.conf and appropriate part to > rc.network Actually, a much easier fix is to put your server socket above /var/run. Everything above /var/run is already cleaned during the boot process. It's simply not possible to make the rc(8) scripts completely bulletproof when coming up from a crash. I personally don't see a need for this addition to the process. Using /var/run or some other location automatically cleaned at boot for your socket seems to be a much more general solution. Unless someone has some compelling arguments on why ppp(8) needs this special treatment in rc(8) scripts, I'll close this PR tomorrow. -- Crist J. Clark cjclark@alum.mit.edu Hello ther Crist, On Wed, 22 Aug 2001, Crist J. Clark wrote: CJC> > After unclean shutdown (e.g, crash) ppp server socket CJC> > remains on file system. Then, if ppp started automatically CJC> > during startup, it cannot bind to that socket [snip] CJC> Actually, a much easier fix is to put your server socket above CJC> /var/run. Everything above /var/run is already cleaned during the boot CJC> process. Unfortunately, it's not such easy now. I use my socket in /var/run/ppp and it is not cleaned. AFAICC, the only files that are now cleaned from /var/run is pid files -- and it's not "The Right Thing (tm)" for me to name socket ending with .pid ;-) Or did I miss some serious changes with purgedir()? CJC> It's simply not possible to make the rc(8) scripts completely CJC> bulletproof when coming up from a crash. I personally don't see a need CJC> for this addition to the process. Using /var/run or some other CJC> location automatically cleaned at boot for your socket seems to be a CJC> much more general solution. Unless someone has some compelling CJC> arguments on why ppp(8) needs this special treatment in rc(8) scripts, CJC> I'll close this PR tomorrow. Thank you for your cooperation and especially for quick reaction. Sincerely, D.Marck [DM5020, DM268-RIPE, DM3-RIPN] ------------------------------------------------------------------------ *** Dmitry Morozovsky --- D.Marck --- Wild Woozle --- marck@rinet.ru *** ------------------------------------------------------------------------ /var/run is cleaned now, so please put all files that must be removed at the boot time there. It won't be sensible to have an rc.conf knob for every such case. On Thu, Aug 23, 2001 at 02:16:12PM +0400, Dmitry Morozovsky wrote: [snip] > oops. seems I miss something during mergemaster. Yes, now it should remove > anything which is not directory. So, my trouble gone away. The only thing > I suppose is useful according to this issue now is change ppp.conf both in > /etc/ppp and in examples to move example server sockets to /var/run. Finally got to this. I'll commit these soon. Any place else anyone can see 'set server' in the ppp(8) examples or documentation? Index: src/etc/mtree/BSD.var.dist =================================================================== RCS file: /export/ncvs/src/etc/mtree/BSD.var.dist,v retrieving revision 1.50 diff -u -r1.50 BSD.var.dist --- src/etc/mtree/BSD.var.dist 2001/10/01 08:54:16 1.50 +++ src/etc/mtree/BSD.var.dist 2001/10/13 04:53:25 @@ -57,6 +57,7 @@ run named uname=bind gname=bind .. + ppp gname=network mode=0775 .. rwho gname=daemon mode=0775 .. Index: src/share/examples/ppp/ppp.conf.isdn =================================================================== RCS file: /export/ncvs/src/share/examples/ppp/ppp.conf.isdn,v retrieving revision 1.8 diff -u -r1.8 ppp.conf.isdn --- src/share/examples/ppp/ppp.conf.isdn 2001/05/25 12:11:02 1.8 +++ src/share/examples/ppp/ppp.conf.isdn 2001/10/13 04:39:07 @@ -75,7 +75,7 @@ link * set mode auto # Automatically manage the second link set autoload 10 80 30 # Down @10% usage, up at 80%, 30s sample - set server /tmp/ppp-isdn "" 0177 # The diagnostic port (-rw-------) + set server /var/run/ppp/ppp-isdn "" 0177 # The diagnostic port (-rw-------) # # When phone calls become free (say 0:00 Saturday morning), we may want Index: src/share/examples/ppp/ppp.conf.sample =================================================================== RCS file: /export/ncvs/src/share/examples/ppp/ppp.conf.sample,v retrieving revision 1.27 diff -u -r1.27 ppp.conf.sample --- src/share/examples/ppp/ppp.conf.sample 2001/07/24 13:11:57 1.27 +++ src/share/examples/ppp/ppp.conf.sample 2001/10/13 04:40:35 @@ -156,7 +156,7 @@ set mru 1504 # Some extra room for the MP header - set server /tmp/ppp-TA "" 0177 # The diagnostic port (-rw-------) + set server /var/run/ppp/ppp-TA "" 0177 # The diagnostic port (-rw-------) # Example segments @@ -182,7 +182,7 @@ # First, you must set up your control socket. It's safest to use # a UNIX domain socket, and watch the permissions: # - set server /var/tmp/internet MySecretPassword 0177 + set server /var/run/ppp/internet MySecretPassword 0177 # # Although a TCP port may be used if you want to allow control # connections from other machines: @@ -566,7 +566,7 @@ set dial set login set ifaddr 127.0.0.2 127.0.0.3 - set server /var/tmp/loop "" 0177 + set server /var/run/ppp/loop "" 0177 loop-in: set timeout 0 Index: src/share/examples/ppp/ppp.conf.span-isp.working =================================================================== RCS file: /export/ncvs/src/share/examples/ppp/ppp.conf.span-isp.working,v retrieving revision 1.3 diff -u -r1.3 ppp.conf.span-isp.working --- src/share/examples/ppp/ppp.conf.span-isp.working 2000/08/17 14:40:42 1.3 +++ src/share/examples/ppp/ppp.conf.span-isp.working 2001/10/13 04:42:45 @@ -94,7 +94,7 @@ enable chap disable lqr set ifaddr 127.0.0.2 127.0.0.3 - set server /var/tmp/vpn-in "" 0177 + set server /var/run/ppp/vpn-in "" 0177 isp-in-7: Index: src/share/examples/ppp/ppp.linkup.span-isp =================================================================== RCS file: /export/ncvs/src/share/examples/ppp/ppp.linkup.span-isp,v retrieving revision 1.2 diff -u -r1.2 ppp.linkup.span-isp --- src/share/examples/ppp/ppp.linkup.span-isp 1999/08/28 00:19:31 1.2 +++ src/share/examples/ppp/ppp.linkup.span-isp 2001/10/13 04:42:12 @@ -14,4 +14,4 @@ !bg ppp -background vpnN vpn vpn: - set server /var/tmp/vpn "" 0177 + set server /var/run/ppp/vpn "" 0177 Index: src/share/examples/ppp/ppp.linkup.span-isp.working =================================================================== RCS file: /export/ncvs/src/share/examples/ppp/ppp.linkup.span-isp.working,v retrieving revision 1.2 diff -u -r1.2 ppp.linkup.span-isp.working --- src/share/examples/ppp/ppp.linkup.span-isp.working 1999/08/28 00:19:31 1.2 +++ src/share/examples/ppp/ppp.linkup.span-isp.working 2001/10/13 04:42:33 @@ -14,4 +14,4 @@ !bg ppp -background vpn3 vpn vpn: - set server /var/tmp/vpn "" 0177 + set server /var/run/ppp/vpn "" 0177 -- Crist J. Clark | cjclark@alum.mit.edu | cjclark@jhu.edu http://people.freebsd.org/~cjc/ | cjc@freebsd.org On Sat, Oct 13, 2001 at 01:17:18PM +0100, Brian Somers wrote: > > Finally got to this. I'll commit these soon. Any place else anyone can > > see 'set server' in the ppp(8) examples or documentation? > > > > Index: src/etc/mtree/BSD.var.dist > > =================================================================== > > RCS file: /export/ncvs/src/etc/mtree/BSD.var.dist,v > > retrieving revision 1.50 > > diff -u -r1.50 BSD.var.dist > > --- src/etc/mtree/BSD.var.dist 2001/10/01 08:54:16 1.50 > > +++ src/etc/mtree/BSD.var.dist 2001/10/13 04:53:25 > > @@ -57,6 +57,7 @@ > > run > > named uname=bind gname=bind > > .. > > + ppp gname=network mode=0775 > > .. > > rwho gname=daemon mode=0775 > > .. > [.....] > > I suggested this a very long time ago and it was rejected on the > grounds that it's not necessary to create a ``standard'' hierarchy > under /var/run as ppp is generally run at most once or twice on a > given machine. > > I believe putting these sockets in /var/run is perfectly fine and the > patch should not be applied. The reason for the directory is to give write permission to the group 'network.' ppp(8) is not always run by root. This is the same reason there is a 'named' directory in there. -- Crist J. Clark | cjclark@alum.mit.edu | cjclark@jhu.edu http://people.freebsd.org/~cjc/ | cjc@freebsd.org > On Sat, Oct 13, 2001 at 01:17:18PM +0100, Brian Somers wrote: > > > Finally got to this. I'll commit these soon. Any place else anyone can > > > see 'set server' in the ppp(8) examples or documentation? > > > > > > Index: src/etc/mtree/BSD.var.dist > > > =================================================================== > > > RCS file: /export/ncvs/src/etc/mtree/BSD.var.dist,v > > > retrieving revision 1.50 > > > diff -u -r1.50 BSD.var.dist > > > --- src/etc/mtree/BSD.var.dist 2001/10/01 08:54:16 1.50 > > > +++ src/etc/mtree/BSD.var.dist 2001/10/13 04:53:25 > > > @@ -57,6 +57,7 @@ > > > run > > > named uname=bind gname=bind > > > .. > > > + ppp gname=network mode=0775 > > > .. > > > rwho gname=daemon mode=0775 > > > .. > > [.....] > > > > I suggested this a very long time ago and it was rejected on the > > grounds that it's not necessary to create a ``standard'' hierarchy > > under /var/run as ppp is generally run at most once or twice on a > > given machine. > > > > I believe putting these sockets in /var/run is perfectly fine and the > > patch should not be applied. > > The reason for the directory is to give write permission to the group > 'network.' ppp(8) is not always run by root. This is the same reason > there is a 'named' directory in there. Hmm, ok, I retract my objection in that case :) > -- > Crist J. Clark | cjclark@alum.mit.edu > | cjclark@jhu.edu > http://people.freebsd.org/~cjc/ | cjc@freebsd.org -- Brian <brian@freebsd-services.com> <brian@Awfulhak.org> http://www.freebsd-services.com/ <brian@[uk.]FreeBSD.org> Don't _EVER_ lose your sense of humour ! <brian@[uk.]OpenBSD.org> State Changed From-To: open->closed A /var/run/ppp directory writable by the network group is now created in -CURRENT and -STABLE. The /usr/share/examples/ppp files have been changed to reflect this. |