From nobody@FreeBSD.org  Mon Feb 11 10:02:01 2002
Return-Path: <nobody@FreeBSD.org>
Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21])
	by hub.freebsd.org (Postfix) with ESMTP id E18D037B405
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 11 Feb 2002 10:02:00 -0800 (PST)
Received: (from nobody@localhost)
	by freefall.freebsd.org (8.11.6/8.11.6) id g1BI20j40188;
	Mon, 11 Feb 2002 10:02:00 -0800 (PST)
	(envelope-from nobody)
Message-Id: <200202111802.g1BI20j40188@freefall.freebsd.org>
Date: Mon, 11 Feb 2002 10:02:00 -0800 (PST)
From: Brandon Poyner <bpoyner@thebiz.net>
To: freebsd-gnats-submit@FreeBSD.org
Subject: syslogd fails to create additional log socket when socket already exists
X-Send-Pr-Version: www-1.0

>Number:         34839
>Category:       misc
>Synopsis:       syslogd fails to create additional log socket when socket already exists
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    maxim
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Feb 11 10:10:01 PST 2002
>Closed-Date:    Wed Feb 27 00:44:01 PST 2002
>Last-Modified:  Wed Feb 27 00:44:50 PST 2002
>Originator:     Brandon Poyner
>Release:        4.5
>Organization:
BiznessOnline
>Environment:
FreeBSD sandbox.ct.thebiz.net 4.5-RELEASE FreeBSD 4.5-RELEASE #0: Mon Jan 28 14:31:56 GMT 2002     murray@builder.freebsdmall.com:/usr/src/sys/compile/GENERIC  i386

>Description:
If syslogd is run with -l flag to create additional log sockets it can
under certain circumstances fail to unlink those log sockets before
syslogd is started again.  Syslogd will then report

	syslogd: cannot create /usr/jail/log: Address already in use

>How-To-Repeat:
If the server is power cycled (improper shutdown) syslogd will not get
a signal to be killed and therefore not unlink() the additional log sockets.
I have also seen this behavior during a 'sync;reboot' but I'm having 
trouble recreating that scenario.
>Fix:
Suggest that syslogd on startup automatically unlink() all sockets 
specified with -l as it currently does with /var/run/log, or a new
flag to force the unlinking.
>Release-Note:
>Audit-Trail:

From: Maxim Konovalov <maxim@macomnet.ru>
To: Brandon Poyner <bpoyner@thebiz.net>
Cc: freebsd-gnats-submit@FreeBSD.ORG
Subject: Re: misc/34839: syslogd fails to create additional log socket when
 socket already exists
Date: Mon, 11 Feb 2002 21:39:29 +0300 (MSK)

 Could you please try a patch below (obtained from OpenBSD):
 
 Index: syslogd.c
 ===================================================================
 RCS file: /home/ncvs/src/usr.sbin/syslogd/syslogd.c,v
 retrieving revision 1.95
 diff -u -r1.95 syslogd.c
 --- syslogd.c	9 Jan 2002 17:36:53 -0000	1.95
 +++ syslogd.c	11 Feb 2002 18:26:24 -0000
 @@ -444,6 +444,8 @@
  #define SUN_LEN(unp) (strlen((unp)->sun_path) + 2)
  #endif
  	for (i = 0; i < nfunix; i++) {
 +		(void)unlink(funixn[i]);
 +
  		memset(&sunx, 0, sizeof(sunx));
  		sunx.sun_family = AF_UNIX;
  		(void)strlcpy(sunx.sun_path, funixn[i], sizeof(sunx.sun_path));
 
 -- 
 Maxim Konovalov, MAcomnet, Internet-Intranet Dept., system engineer
 phone: +7 (095) 796-9079, mailto:maxim@macomnet.ru
 

From: Brandon Poyner <brandon@thebiz.net>
To: Maxim Konovalov <maxim@macomnet.ru>
Cc: freebsd-gnats-submit@FreeBSD.ORG
Subject: Re: misc/34839: syslogd fails to create additional log socket when
 socket already exists
Date: Mon, 11 Feb 2002 14:07:03 -0500 (EST)

 Thank you, the patch works as expected.  The socket was re-created
 during startup after a powercycle (improper shutdown).
 
 --
 Brandon Poyner, Unix Systems Engineer       brandon@thebiz.net
 BiznessOnline.com, Inc.                     http://www.BiznessOnline.com/
 
 On Mon, 11 Feb 2002, Maxim Konovalov wrote:
 
 >
 > Could you please try a patch below (obtained from OpenBSD):
 >
 > Index: syslogd.c
 > ===================================================================
 > RCS file: /home/ncvs/src/usr.sbin/syslogd/syslogd.c,v
 > retrieving revision 1.95
 > diff -u -r1.95 syslogd.c
 > --- syslogd.c	9 Jan 2002 17:36:53 -0000	1.95
 > +++ syslogd.c	11 Feb 2002 18:26:24 -0000
 > @@ -444,6 +444,8 @@
 >  #define SUN_LEN(unp) (strlen((unp)->sun_path) + 2)
 >  #endif
 >  	for (i = 0; i < nfunix; i++) {
 > +		(void)unlink(funixn[i]);
 > +
 >  		memset(&sunx, 0, sizeof(sunx));
 >  		sunx.sun_family = AF_UNIX;
 >  		(void)strlcpy(sunx.sun_path, funixn[i], sizeof(sunx.sun_path));
 >
 >
 
State-Changed-From-To: open->analyzed 
State-Changed-By: maxim 
State-Changed-When: Wed Feb 13 00:41:00 PST 2002 
State-Changed-Why:  
Fixed in -current, thanks. 


Responsible-Changed-From-To: freebsd-bugs->maxim 
Responsible-Changed-By: maxim 
Responsible-Changed-When: Wed Feb 13 00:41:00 PST 2002 
Responsible-Changed-Why:  
I will MFC the fix. 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=34839 
State-Changed-From-To: analyzed->closed 
State-Changed-By: maxim 
State-Changed-When: Wed Feb 27 00:44:01 PST 2002 
State-Changed-Why:  
Fixed in -current and -stable. Thanks for the report. 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=34839 
>Unformatted:
