From visigoth@telemere.net  Sun Aug 27 10:59:28 2000
Return-Path: <visigoth@telemere.net>
Received: from mail.telemere.net (mail.telemere.net [63.224.9.4])
	by hub.freebsd.org (Postfix) with ESMTP id 75E4F37B43F
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 27 Aug 2000 10:59:28 -0700 (PDT)
Received: by mail.telemere.net (Postfix, from userid 1001)
	id 26B6C20F01; Sun, 27 Aug 2000 13:02:29 -0500 (CDT)
Message-Id: <20000827180229.26B6C20F01@mail.telemere.net>
Date: Sun, 27 Aug 2000 13:02:29 -0500 (CDT)
From: visigoth@telemere.net
Reply-To: visigoth@telemere.net
To: FreeBSD-gnats-submit@freebsd.org
Subject: syslogd.c still uses depreciated domain AF_UNIX
X-Send-Pr-Version: 3.2

>Number:         20889
>Category:       bin
>Synopsis:       [patch] syslogd.c still uses depreciated domain AF_UNIX
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    dwmalone
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Aug 27 11:00:03 PDT 2000
>Closed-Date:    Wed Feb 20 21:57:12 UTC 2008
>Last-Modified:  Wed Feb 20 22:00:06 UTC 2008
>Originator:     Damieon Stark
>Release:        FreeBSD 4.1-STABLE i386
>Organization:
Telemere Technologies Inc.
>Environment:

FreeBSD morpheus.telemere.net 4.1-STABLE FreeBSD 4.1-STABLE #0: Mon Aug 28 07:23:14 CDT 2000     visigoth@morpheus.telemere.net:/usr/src/sys/compile/MORPHEUS  i386


>Description:

	Acording to socket(2) man page, use of AF_UNIX domain in a call to 
socket(2) is depreciated for use of PF_LOCAL.  syslogd.c still calls socket with AF_UNIX

>How-To-Repeat:


>Fix:

--- syslogd.c.old	Mon Aug 28 12:38:55 2000
+++ syslogd.c	Mon Aug 28 12:40:53 2000
@@ -399,9 +399,9 @@
 #endif
 	for (i = 0; i < nfunix; i++) {
 		memset(&sunx, 0, sizeof(sunx));
-		sunx.sun_family = AF_UNIX;
+		sunx.sun_family = PF_LOCAL;
 		(void)strncpy(sunx.sun_path, funixn[i], sizeof(sunx.sun_path));
-		funix[i] = socket(AF_UNIX, SOCK_DGRAM, 0);
+		funix[i] = socket(PF_LOCAL, SOCK_DGRAM, 0);
 		if (funix[i] < 0 ||
 		    bind(funix[i], (struct sockaddr *)&sunx,
 			 SUN_LEN(&sunx)) < 0 ||



>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: gnats-admin->freebsd-bugs 
Responsible-Changed-By: jedgar 
Responsible-Changed-When: Sun Aug 27 18:10:58 PDT 2000 
Responsible-Changed-Why:  
Misfiled PR 

http://www.freebsd.org/cgi/query-pr.cgi?pr=20889 
Responsible-Changed-From-To: freebsd-bugs->dwmalone 
Responsible-Changed-By: dwmalone 
Responsible-Changed-When: Sun Aug 27 23:50:41 PDT 2000 
Responsible-Changed-Why:  
I've had my hand in syslogd recently, so I'll have a look at it. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=20889 
State-Changed-From-To: open->feedback 
State-Changed-By: linimon 
State-Changed-When: Sat Jan 26 15:00:52 UTC 2008 
State-Changed-Why:  
David, this PR seems to have gotten lost.  Bruce Cran reports that the 
patch is still valid against -current as of 20080126.  Can you take a 
look?  Thanks. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=20889 

From: linimon@lonesome.com (Mark Linimon)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/20889: syslogd.c still uses depreciated domain AF_UNIX
Date: Sat, 26 Jan 2008 17:09:25 -0600

 ----- Forwarded message from David Malone <dwmalone@maths.tcd.ie> -----
 
 From: David Malone <dwmalone@maths.tcd.ie>
 
 Hi Mark, Bruce,
 
 > David, this PR seems to have gotten lost.  Bruce Cran reports that the
 > patch is still valid against -current as of 20080126.  Can you take a
 > look?  Thanks.
 
 Sorry for letting this PR sit for so long. I was worried about the
 fact that it changes a AF_ to a PF_. Of course, this isn't a practical
 problem, as the #defines have the same values, but we're aiming for
 pedantically correct.
 
 Based on the information at this URL:
 
 	http://it-reading.org/ebook/unix.network.programming.vol1/content/0131411551_ch04lev1sec2.html
 
 I think the patch below would be correct, though the changes to the
 ai_family fields may just be unnecessary churn.
 
 	David.
 
 
 Index: syslogd.c
 ===================================================================
 RCS file: /cvs/FreeBSD-CVS/src/usr.sbin/syslogd/syslogd.c,v
 retrieving revision 1.154
 diff -u -r1.154 syslogd.c
 --- syslogd.c	11 Dec 2007 06:10:10 -0000	1.154
 +++ syslogd.c	26 Jan 2008 20:52:39 -0000
 @@ -512,9 +512,9 @@
  	STAILQ_FOREACH_SAFE(fx, &funixes, next, fx1) {
  		(void)unlink(fx->name);
  		memset(&sunx, 0, sizeof(sunx));
 -		sunx.sun_family = AF_UNIX;
 +		sunx.sun_family = AF_LOCAL;
  		(void)strlcpy(sunx.sun_path, fx->name, sizeof(sunx.sun_path));
 -		fx->s = socket(AF_UNIX, SOCK_DGRAM, 0);
 +		fx->s = socket(PF_LOCAL, SOCK_DGRAM, 0);
  		if (fx->s < 0 ||
  		    bind(fx->s, (struct sockaddr *)&sunx, SUN_LEN(&sunx)) < 0 ||
  		    chmod(fx->name, fx->mode) < 0) {
 @@ -669,7 +669,7 @@
  	struct sockaddr_in6 *sin6;
  	struct sockaddr_in sin4;
  
 -	if (sa->sa_family != AF_INET6)
 +	if (sa->sa_family != PF_INET6)
  		return;
  	if (sa->sa_len != sizeof(struct sockaddr_in6) ||
  	    sizeof(sin4) > sa->sa_len)
 @@ -2222,7 +2222,7 @@
  		memcpy(&ap.a_addr, res->ai_addr, res->ai_addrlen);
  		memset(&ap.a_mask, 0, sizeof(ap.a_mask));
  		ap.a_mask.ss_family = res->ai_family;
 -		if (res->ai_family == AF_INET) {
 +		if (res->ai_family == PF_INET) {
  			ap.a_mask.ss_len = sizeof(struct sockaddr_in);
  			maskp = &((struct sockaddr_in *)&ap.a_mask)->sin_addr;
  			addrp = &((struct sockaddr_in *)&ap.a_addr)->sin_addr;
 @@ -2248,7 +2248,7 @@
  			addrp->s_addr &= maskp->s_addr;
  		}
  #ifdef INET6
 -		else if (res->ai_family == AF_INET6 && masklen <= 128) {
 +		else if (res->ai_family == PF_INET6 && masklen <= 128) {
  			ap.a_mask.ss_len = sizeof(struct sockaddr_in6);
  			if (masklen < 0)
  				masklen = 128;
 @@ -2616,7 +2616,7 @@
  			logerror("socket");
  			continue;
  		}
 -		if (r->ai_family == AF_INET6) {
 +		if (r->ai_family == PF_INET6) {
  			if (setsockopt(*s, IPPROTO_IPV6, IPV6_V6ONLY,
  				       (char *)&on, sizeof (on)) < 0) {
  				logerror("setsockopt");
 
 
 ----- End forwarded message -----
State-Changed-From-To: feedback->open 
State-Changed-By: linimon 
State-Changed-When: Sun Feb 10 13:57:11 UTC 2008 
State-Changed-Why:  
Feedback received. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=20889 
State-Changed-From-To: open->closed 
State-Changed-By: dwmalone 
State-Changed-When: Wed Feb 20 21:56:01 UTC 2008 
State-Changed-Why:  
I've committed a version that only changes the AF/PF_LOCAL ones. I 
guess that's enough until people figure out if ai_family is a AF 
or a PF! 

David. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=20889 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/20889: commit references a PR
Date: Wed, 20 Feb 2008 21:54:45 +0000 (UTC)

 dwmalone    2008-02-20 21:54:41 UTC
 
   FreeBSD src repository
 
   Modified files:
     usr.sbin/syslogd     syslogd.c 
   Log:
   Two no-op fixes to improve corretness of syslogd code:
   
   1) Use [AP]F_LOCAL rather than [AP]F_UNIX.
   2) When copying a pipe's name, use f->f_un.f_pipe.f_pname, not f->f_un.f_fname.
   
   PR:             20889
   Submitted by:   Damieon Stark
   PR:             116642
   Submitted by:   Jim Pirzyk
   Reviewed by:    md5
   
   Revision  Changes    Path
   1.155     +4 -3      src/usr.sbin/syslogd/syslogd.c
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 
>Unformatted:
