bin/128167: [patch] [libc] add support for SCTP to getaddrinfo(3)

Bruce Cran bruce at cran.org.uk
Fri Oct 17 00:20:02 UTC 2008


>Number:         128167
>Category:       bin
>Synopsis:       [patch] [libc] add support for SCTP to getaddrinfo(3)
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Oct 17 00:20:01 UTC 2008
>Closed-Date:
>Last-Modified:
>Originator:     Bruce Cran
>Release:        8.0-CURRENT
>Organization:
>Environment:
FreeBSD gluon.draftnet 8.0-CURRENT FreeBSD 8.0-CURRENT #2: Sun Oct 12 12:45:10 BST 2008 brucec at gluon.draftnet:/usr/obj/usr/src/sys/BOX i386
>Description:
The attached patch allows getaddrinfo(3) to be used with SCTP.
>How-To-Repeat:

>Fix:


Patch attached with submission follows:

--- getaddrinfo.c	2007-09-05 19:08:14.000000000 +0100
+++ getaddrinfo.c.new	2008-10-17 01:01:42.000000000 +0100
@@ -170,13 +170,19 @@
 #ifdef INET6
 	{ PF_INET6, SOCK_DGRAM, IPPROTO_UDP, "udp", 0x07 },
 	{ PF_INET6, SOCK_STREAM, IPPROTO_TCP, "tcp", 0x07 },
+	{ PF_INET6, SOCK_STREAM, IPPROTO_SCTP, "sctp", 0x07 },
+	{ PF_INET6, SOCK_SEQPACKET, IPPROTO_SCTP, "sctp", 0x07 },
 	{ PF_INET6, SOCK_RAW, ANY, NULL, 0x05 },
 #endif
 	{ PF_INET, SOCK_DGRAM, IPPROTO_UDP, "udp", 0x07 },
 	{ PF_INET, SOCK_STREAM, IPPROTO_TCP, "tcp", 0x07 },
+	{ PF_INET, SOCK_STREAM, IPPROTO_SCTP, "sctp", 0x07 },
+	{ PF_INET, SOCK_SEQPACKET, IPPROTO_SCTP, "sctp", 0x07 },
 	{ PF_INET, SOCK_RAW, ANY, NULL, 0x05 },
 	{ PF_UNSPEC, SOCK_DGRAM, IPPROTO_UDP, "udp", 0x07 },
 	{ PF_UNSPEC, SOCK_STREAM, IPPROTO_TCP, "tcp", 0x07 },
+	{ PF_UNSPEC, SOCK_STREAM, IPPROTO_SCTP, "sctp", 0x07 },
+	{ PF_UNSPEC, SOCK_SEQPACKET, IPPROTO_SCTP, "sctp", 0x07 },
 	{ PF_UNSPEC, SOCK_RAW, ANY, NULL, 0x05 },
 	{ -1, 0, 0, NULL, 0 },
 };
@@ -417,10 +423,12 @@
 				if (ex->e_protocol == ANY)
 					continue;
 				if (pai->ai_socktype == ex->e_socktype &&
-				    pai->ai_protocol != ex->e_protocol) {
-					ERR(EAI_BADHINTS);
-				}
+					pai->ai_protocol == ex->e_protocol)
+					break;
 			}
+
+			if (ex->e_af < 0)
+				ERR(EAI_BADHINTS);
 		}
 	}
 


>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list