| Summary: | [patch] syslogd.c still uses depreciated domain AF_UNIX | ||||||
|---|---|---|---|---|---|---|---|
| Product: | Base System | Reporter: | visigoth <visigoth> | ||||
| Component: | bin | Assignee: | dwmalone | ||||
| Status: | Closed FIXED | ||||||
| Severity: | Affects Only Me | ||||||
| Priority: | Normal | ||||||
| Version: | 4.1-STABLE | ||||||
| Hardware: | Any | ||||||
| OS: | Any | ||||||
| Attachments: |
|
||||||
|
Description
visigoth
2000-08-27 19:00:03 UTC
Responsible Changed From-To: gnats-admin->freebsd-bugs Misfiled PR Responsible Changed From-To: freebsd-bugs->dwmalone I've had my hand in syslogd recently, so I'll have a look at it. State Changed From-To: open->feedback 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. ----- 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 Feedback received. 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"
State Changed From-To: open->closed 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. |