Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 29 Aug 2008 15:08:25 GMT
From:      Ashish Shukla <wahjava@gmail.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   ports/126952: Update dns/nss_mdns to v0.10
Message-ID:  <200808291508.m7TF8PDh033965@www.freebsd.org>
Resent-Message-ID: <200808291510.m7TFA5me060997@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         126952
>Category:       ports
>Synopsis:       Update dns/nss_mdns to v0.10
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Fri Aug 29 15:10:05 UTC 2008
>Closed-Date:
>Last-Modified:
>Originator:     Ashish Shukla
>Release:        FreeBSD 7.0-RELEASE-p3
>Organization:
N/A
>Environment:
FreeBSD monte-cristo.france 7.0-RELEASE-p3 FreeBSD 7.0-RELEASE-p3 #2: Wed Aug 20 05:48:08 IST 2008     root@monte-cristo.france:/usr/obj/usr/src/sys/ULE  amd64
>Description:
Updates dns/nss_mdns port to v0.10 and changes MAINTAINER field (as per bms's suggestion). This PR fixes the issue reported in PR ports/123169, so that PR can be closed.
>How-To-Repeat:

>Fix:
diff -urN /usr/ports/dns/nss_mdns/Makefile nss_mdns/Makefile
--- /usr/ports/dns/nss_mdns/Makefile	2008-08-20 06:26:39.000000000 +0530
+++ nss_mdns/Makefile	2008-08-29 19:53:13.000000000 +0530
@@ -6,13 +6,12 @@
 #
 
 PORTNAME=	nss_mdns
-PORTVERSION=	0.9
-PORTREVISION=	6
+PORTVERSION=	0.10
 CATEGORIES=	dns ipv6
 MASTER_SITES=	http://0pointer.de/lennart/projects/nss-mdns/
 DISTNAME=	nss-mdns-${PORTVERSION}
 
-MAINTAINER=	bms@FreeBSD.org
+MAINTAINER=	wahjava@gmail.com
 COMMENT=	NSS module implementing multicast DNS name resolution
 
 USE_AUTOTOOLS=	autoconf:262 automake:19 libtool:15
diff -urN /usr/ports/dns/nss_mdns/distinfo nss_mdns/distinfo
--- /usr/ports/dns/nss_mdns/distinfo	2007-01-20 20:13:58.000000000 +0530
+++ nss_mdns/distinfo	2008-08-29 19:52:15.000000000 +0530
@@ -1,3 +1,3 @@
-MD5 (nss-mdns-0.9.tar.gz) = bc72f5b19cc6ce8cacde448236b30868
-SHA256 (nss-mdns-0.9.tar.gz) = 0bf226bb3a1716e6eb97355e08a7ffcf09aadfb91ba41ccef2ef1ba7a01719a2
-SIZE (nss-mdns-0.9.tar.gz) = 346397
+MD5 (nss-mdns-0.10.tar.gz) = 03938f17646efbb50aa70ba5f99f51d7
+SHA256 (nss-mdns-0.10.tar.gz) = 1e683c2e7c3921814706d62fbbd3e9cbf493a75fa00255e0e715508d8134fa6d
+SIZE (nss-mdns-0.10.tar.gz) = 353130
diff -urN /usr/ports/dns/nss_mdns/files/patch-configure.ac nss_mdns/files/patch-configure.ac
--- /usr/ports/dns/nss_mdns/files/patch-configure.ac	2007-01-20 20:13:58.000000000 +0530
+++ nss_mdns/files/patch-configure.ac	1970-01-01 05:30:00.000000000 +0530
@@ -1,16 +0,0 @@
---- configure.ac.orig	Mon Jan  1 18:36:21 2007
-+++ configure.ac	Sat Jan 20 14:34:44 2007
-@@ -83,6 +83,13 @@
- AC_FUNC_SELECT_ARGTYPES
- AC_CHECK_FUNCS([gethostbyaddr gethostbyname gettimeofday inet_ntoa memset select socket strcspn strdup strerror strncasecmp strcasecmp strspn])
- 
-+# FreeBSD has a slightly different NSS interface
-+case ${host} in
-+     *-freebsd*) freebsd="yes" ;;
-+esac
-+
-+AM_CONDITIONAL([FREEBSD_NSS], [test "x$freebsd" = "xyes"])
-+
- # If using GCC specify some additional parameters
- if test "x$GCC" = "xyes" ; then
-    CFLAGS="$CFLAGS -pipe -W -Wall -pedantic"
diff -urN /usr/ports/dns/nss_mdns/files/patch-src__Makefile.am nss_mdns/files/patch-src__Makefile.am
--- /usr/ports/dns/nss_mdns/files/patch-src__Makefile.am	2007-01-20 20:13:58.000000000 +0530
+++ nss_mdns/files/patch-src__Makefile.am	2008-08-29 20:23:03.000000000 +0530
@@ -1,57 +1,26 @@
---- src/Makefile.am.orig	Mon Jan  1 18:39:28 2007
-+++ src/Makefile.am	Sat Jan 20 14:34:44 2007
-@@ -29,13 +29,22 @@
- # This cool debug trap works on i386/gcc only
- AM_CFLAGS+='-DDEBUG_TRAP=__asm__("int $$3")'
+--- src/Makefile.am.orig	2007-02-08 22:12:23.000000000 +0530
++++ src/Makefile.am	2008-04-30 02:52:50.000000000 +0530
+@@ -34,13 +34,7 @@
+ lib_LTLIBRARIES = 
  
--lib_LTLIBRARIES= \
-+AM_LDFLAGS=-avoid-version -module -export-dynamic
-+
-+if FREEBSD_NSS
-+nss_modules_freebsd= \
-+	nss_mdns.la
-+else
-+nss_modules_glibc= \
+ if FREEBSD_NSS
+-lib_LTLIBRARIES += \
+-	nss_mdns.la \
+-	nss_mdns4.la \
+-	nss_mdns6.la \
+-	nss_mdns_minimal.la \
+-	nss_mdns4_minimal.la \
+-	nss_mdns6_minimal.la
++lib_LTLIBRARIES += nss_mdns.la 
+ else
+ lib_LTLIBRARIES += \
  	libnss_mdns.la \
- 	libnss_mdns4.la \
- 	libnss_mdns6.la \
- 	libnss_mdns_minimal.la \
- 	libnss_mdns4_minimal.la \
- 	libnss_mdns6_minimal.la
-+endif
-+
-+lib_LTLIBRARIES = $(nss_modules_glibc) $(nss_modules_freebsd)
- 
- noinst_PROGRAMS= \
- 	nss-test
-@@ -81,6 +90,30 @@
- libnss_mdns6_minimal_la_SOURCES=$(libnss_mdns_la_SOURCES)
- libnss_mdns6_minimal_la_CFLAGS=$(libnss_mdns_la_CFLAGS) -DNSS_IPV6_ONLY=1 -DMDNS_MINIMAL
+@@ -90,7 +84,7 @@
  libnss_mdns6_minimal_la_LDFLAGS=$(libnss_mdns_la_LDFLAGS)
-+
-+nss_mdns_la_SOURCES=$(libnss_mdns_la_SOURCES) bsdnss.c
-+nss_mdns_la_CFLAGS=$(libnss_mdns_la_CFLAGS)
-+nss_mdns_la_LDFLAGS=$(AM_LDFLAGS) -shrext .so.1
-+
-+nss_mdns_minimal_la_SOURCES=$(nss_mdns_la_SOURCES)
-+nss_mdns_minimal_la_CFLAGS=$(nss_mdns_la_CFLAGS) -DMDNS_MINIMAL
-+nss_mdns_minimal_la_LDFLAGS=$(nss_mdns_la_LDFLAGS)
-+
-+nss_mdns4_la_SOURCES=$(nss_mdns_la_SOURCES)
-+nss_mdns4_la_CFLAGS=$(nss_mdns_la_CFLAGS) -DNSS_IPV4_ONLY=1
-+nss_mdns4_la_LDFLAGS=$(nss_mdns_la_LDFLAGS)
-+
-+nss_mdns4_minimal_la_SOURCES=$(nss_mdns_la_SOURCES)
-+nss_mdns4_minimal_la_CFLAGS=$(nss_mdns_la_CFLAGS) -DNSS_IPV4_ONLY=1 -DMDNS_MINIMAL
-+nss_mdns4_minimal_la_LDFLAGS=$(nss_mdns_la_LDFLAGS)
-+
-+nss_mdns6_la_SOURCES=$(nss_mdns_la_SOURCES)
-+nss_mdns6_la_CFLAGS=$(nss_mdns_la_CFLAGS) -DNSS_IPV6_ONLY=1
-+nss_mdns6_la_LDFLAGS=$(nss_mdns_la_LDFLAGS)
-+
-+nss_mdns6_minimal_la_SOURCES=$(nss_mdns_la_SOURCES)
-+nss_mdns6_minimal_la_CFLAGS=$(nss_mdns_la_CFLAGS) -DNSS_IPV6_ONLY=1 -DMDNS_MINIMAL
-+nss_mdns6_minimal_la_LDFLAGS=$(nss_mdns_la_LDFLAGS)
  
- avahi_test_SOURCES = \
- 	avahi.c avahi.h \
+ # FreeBSD
+-nss_mdns_la_SOURCES=$(sources) bsdnss.c
++nss_mdns_la_SOURCES=$(sources) bsdnss.c nss.c
+ nss_mdns_la_CFLAGS=$(AM_CFLAGS)
+ nss_mdns_la_LDFLAGS=$(AM_LDFLAGS) -shrext .so.1
+ 
diff -urN /usr/ports/dns/nss_mdns/files/patch-src__avahi-test.c nss_mdns/files/patch-src__avahi-test.c
--- /usr/ports/dns/nss_mdns/files/patch-src__avahi-test.c	2007-01-20 20:13:58.000000000 +0530
+++ nss_mdns/files/patch-src__avahi-test.c	1970-01-01 05:30:00.000000000 +0530
@@ -1,10 +0,0 @@
---- src/avahi-test.c.orig	Sat Aug  6 00:51:50 2005
-+++ src/avahi-test.c	Sat Jan 20 14:34:44 2007
-@@ -19,6 +19,7 @@
-   USA.
- ***/
- 
-+#include <sys/socket.h>
- #include <arpa/inet.h>
- #include <stdio.h>
- 
diff -urN /usr/ports/dns/nss_mdns/files/patch-src__bsdnss.c nss_mdns/files/patch-src__bsdnss.c
--- /usr/ports/dns/nss_mdns/files/patch-src__bsdnss.c	2007-04-12 16:13:15.000000000 +0530
+++ nss_mdns/files/patch-src__bsdnss.c	2008-08-29 20:23:03.000000000 +0530
@@ -1,431 +1,36 @@
---- src/bsdnss.c.orig	Tue Apr 10 12:16:00 2007
-+++ src/bsdnss.c	Tue Apr 10 12:21:42 2007
-@@ -0,0 +1,428 @@
-+/* rcs tags go here when pushed upstream */
-+/* Original author: Bruce M. Simpson <bms@FreeBSD.org> */
-+
-+/***
-+    This file is part of nss-mdns.
-+·
-+    nss-mdns is free software; you can redistribute it and/or modify
-+    it under the terms of the GNU Lesser General Public License as published
-+    by the Free Software Foundation; either version 2 of the License,
-+    or (at your option) any later version.
-+·
-+    nss-mdns is distributed in the hope that it will be useful, but1
-+    WITHOUT ANY WARRANTY; without even the implied warranty of
-+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+    General Public License for more details.
-+·
-+    You should have received a copy of the GNU Lesser General Public License
-+    along with nss-mdns; if not, write to the Free Software
-+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-+    USA.
-+***/
-+
-+#include <sys/param.h>
-+#include <sys/types.h>
-+#include <sys/time.h>
-+#include <sys/uio.h>
-+#include <sys/socket.h>
-+#include <sys/ktrace.h>
-+
-+#include <stdarg.h>
-+#include <stdlib.h>
-+#include <stdio.h>
-+#include <string.h>
-+
-+#include <errno.h>
-+#include <pwd.h>
-+#include <grp.h>
-+#include <nss.h>
-+
-+#include <netinet/in.h>
-+#include <netdb.h>
-+
-+#include "config.h"
-+
-+#ifdef MDNS_MINIMAL
-+/*
-+ * FreeBSD support prefers Avahi.
-+ */
-+#endif
-+
-+#if defined(NSS_IPV4_ONLY) || defined(NSS_IPV6_ONLY)
-+/*
-+ * FreeBSD's libc is always built with IPv4 support.
-+ * There is no way of telling at compile time with a define if libc
-+ * was built with -DINET6 or not; a configure test would be required.
-+ * Therefore, distinguishing between the two makes no sense.
-+ */
-+#define NO_BUILD_BSD_NSS
-+#endif
-+
-+#ifndef NO_BUILD_BSD_NSS
-+/*
-+ * To turn on utrace() records, compile with -DDEBUG_UTRACE.
-+ */
-+#ifdef DEBUG_UTRACE
-+#define _NSS_UTRACE(msg)						\
-+	do {								\
-+		static const char __msg[] = msg ;			\
-+		(void)utrace(__msg, sizeof(__msg));			\
-+	} while (0)
-+#else
-+#define _NSS_UTRACE(msg)
-+#endif
-+
-+ns_mtab *nss_module_register(const char *source, unsigned int *mtabsize,
-+			     nss_module_unregister_fn *unreg);
-+
-+extern enum nss_status _nss_mdns_gethostbyname_r (const char *name, struct hostent * result,
-+			   char *buffer, size_t buflen, int *errnop,
-+			   int *h_errnop);
-+
-+extern enum nss_status _nss_mdns_gethostbyname2_r (const char *name, int af, struct hostent * result,
-+			    char *buffer, size_t buflen, int *errnop,
-+			    int *h_errnop);
-+extern enum nss_status _nss_mdns_gethostbyaddr_r (struct in_addr * addr, int len, int type,
-+			   struct hostent * result, char *buffer,
-+			   size_t buflen, int *errnop, int *h_errnop);
-+
-+typedef enum nss_status 	(*_bsd_nsstub_fn_t)(const char *, struct hostent *, char *, size_t, int *, int *);
-+
-+/* XXX: FreeBSD 5.x is not supported. */
-+static NSS_METHOD_PROTOTYPE(__nss_bsdcompat_getaddrinfo);
-+static NSS_METHOD_PROTOTYPE(__nss_bsdcompat_gethostbyaddr_r);
-+static NSS_METHOD_PROTOTYPE(__nss_bsdcompat_gethostbyname2_r);
-+static NSS_METHOD_PROTOTYPE(__nss_bsdcompat_ghbyaddr);
-+static NSS_METHOD_PROTOTYPE(__nss_bsdcompat_ghbyname);
-+
-+static ns_mtab methods[] = {
-+    /* database, name, method, mdata */
-+    { NSDB_HOSTS, "getaddrinfo", __nss_bsdcompat_getaddrinfo, NULL },
-+    { NSDB_HOSTS, "gethostbyaddr_r", __nss_bsdcompat_gethostbyaddr_r, NULL },
-+    { NSDB_HOSTS, "gethostbyname2_r", __nss_bsdcompat_gethostbyname2_r, NULL },
-+    { NSDB_HOSTS, "ghbyaddr", __nss_bsdcompat_ghbyaddr, NULL },
-+    { NSDB_HOSTS, "ghbyname", __nss_bsdcompat_ghbyname, NULL },
-+};
-+
-+ns_mtab *
-+nss_module_register(const char *source, unsigned int *mtabsize,
-+    nss_module_unregister_fn *unreg)
-+{
-+
-+	*mtabsize = sizeof(methods)/sizeof(methods[0]);
-+	*unreg = NULL;
-+	return (methods);
-+}
-+
-+/*
-+ * Calling convention:
-+ * ap: const char *name (optional), struct addrinfo *pai (hints, optional)
-+ * retval: struct addrinfo **
-+ *
-+ * TODO: Map all returned hostents, not just the first match.
-+ *
-+ * name must always be specified by libc; pai is allocated
-+ * by libc and must always be specified.
-+ *
-+ * We can malloc() addrinfo instances and hang them off ai->next;
-+ * canonnames may also be malloc()'d.
-+ * libc is responsible for mapping our ns error return to gai_strerror().
-+ *
-+ * libc calls us only to look up qualified hostnames. We don't need to
-+ * worry about port numbers; libc will call getservbyname() and explore
-+ * the appropriate maps configured in nsswitch.conf(5).
-+ *
-+ * _errno and _h_errno are unused by getaddrinfo(), as it is
-+ * [mostly] OS independent interface implemented by Win32.
-+ */
-+static int
-+__nss_bsdcompat_getaddrinfo(void *retval, void *mdata __unused, va_list ap)
-+{
-+	struct addrinfo		 sentinel;
-+	struct addrinfo		*ai;
-+	char			*buffer;
-+	void 			*cbufp;	/* buffer handed to libc */
-+	char			*hap;
-+	struct hostent		*hp;
-+	void 			*mbufp;	/* buffer handed to mdns */
-+	const char 		*name;
-+	const struct addrinfo	*pai;
-+	struct sockaddr		*psa;	/* actually *sockaddr_storage */
-+	struct addrinfo		**resultp;
-+	int			 _errno;
-+	int			 _h_errno;
-+	size_t			 mbuflen = 1024;
-+	enum nss_status		 status;
-+
-+	_NSS_UTRACE("__nss_bsdcompat_getaddrinfo: called");
-+
-+	_h_errno = _errno = 0;
-+	status = NSS_STATUS_UNAVAIL;
-+
-+	name = va_arg(ap, const char *);
-+	pai = va_arg(ap, struct addrinfo *);
-+	resultp = (struct addrinfo **)retval;
-+
-+	/* XXX: Will be used to hang off multiple matches later. */
-+	memset(&sentinel, 0, sizeof(sentinel));
-+
-+	if (name == NULL || pai == NULL) {
-+		*resultp = sentinel.ai_next;
-+		return (NS_UNAVAIL);
-+	}
-+
-+	mbufp = malloc((sizeof(struct hostent) + mbuflen));
-+	if (mbufp == NULL) {
-+		*resultp = sentinel.ai_next;
-+		return (NS_UNAVAIL);
-+	}
-+	hp = (struct hostent *)mbufp;
-+	buffer = (char *)(hp + 1);
-+
-+	cbufp = malloc(sizeof(struct addrinfo) +
-+	    sizeof(struct sockaddr_storage));
-+	if (cbufp == NULL) {
-+		free(mbufp);
-+		*resultp = sentinel.ai_next;
-+		return (NS_UNAVAIL);
-+	}
-+	ai = (struct addrinfo *)cbufp;
-+	psa = (struct sockaddr *)(ai + 1);
-+
-+	/*
-+	 * 1. Call the nss_mdns internal gethostbyname function.
-+	 * 2. Map hostent to addrinfo.
-+	 * 3. Hand-off buffer to libc.
-+	 */
-+	status = _nss_mdns_gethostbyname_r(name, hp, buffer, mbuflen,
-+					   &_errno, &_h_errno);
-+	status = __nss_compat_result(status, _errno);
-+
-+	if (status == NS_SUCCESS) {
-+		memset(ai, 0, sizeof(struct addrinfo));
-+		ai->ai_flags = pai->ai_flags;
-+		ai->ai_socktype = pai->ai_socktype;
-+		ai->ai_protocol = pai->ai_protocol;
-+		ai->ai_family = hp->h_addrtype;
-+		memset(psa, 0, sizeof(struct sockaddr_storage));
-+		psa->sa_len = ai->ai_addrlen;
-+		psa->sa_family = ai->ai_family;
-+		ai->ai_addr = psa;
-+		hap = hp->h_addr_list[0];
-+		switch (ai->ai_family) {
-+		case AF_INET:
-+			ai->ai_addrlen = sizeof(struct sockaddr_in);
-+			memcpy(&((struct sockaddr_in *)psa)->sin_addr, hap,
-+			    ai->ai_addrlen);
-+			break;
-+		case AF_INET6:
-+			ai->ai_addrlen = sizeof(struct sockaddr_in6);
-+			memcpy(&((struct sockaddr_in6 *)psa)->sin6_addr, hap,
-+			    ai->ai_addrlen);
-+			break;
-+		default:
-+			ai->ai_addrlen = sizeof(struct sockaddr_storage);
-+			memcpy(psa->sa_data, hap, ai->ai_addrlen);
-+		}
-+		sentinel.ai_next = ai;
-+		free(mbufp);
-+	}
-+
-+	if (sentinel.ai_next == NULL) {
-+		free(cbufp);
-+		free(mbufp);
-+	}
-+
-+	*resultp = sentinel.ai_next;
-+	return (status);
-+}
-+
-+/*
-+ * Calling convention:
-+ * ap: const u_char *uaddr, socklen_t len, int af, struct hostent *hp,
-+ *     char *buf, size_t buflen, int ret_errno, int *h_errnop
-+ * retval: should be set to NULL or hp passed in
-+ */
-+static int
-+__nss_bsdcompat_gethostbyaddr_r(void *retval, void *mdata __unused, va_list ap)
-+{
-+	void		*addr;
-+	char		*buf;
-+	int		*h_errnop;
-+	struct hostent	*hp;
-+	struct hostent	**resultp;
-+	int		 af;
-+	size_t		 buflen;
-+	int		 len;
-+	int		 ret_errno;
-+	enum nss_status	 status;
-+
-+	addr = va_arg(ap, void *);
-+	len = va_arg(ap, socklen_t);
-+	af = va_arg(ap, int);
-+	hp = va_arg(ap, struct hostent *);
-+	buf = va_arg(ap, char *);
-+	buflen = va_arg(ap, size_t);
-+	ret_errno = va_arg(ap, int);
-+	h_errnop = va_arg(ap, int *);
-+	resultp = (struct hostent **)retval;
-+
-+	*resultp = NULL;
-+	status = _nss_mdns_gethostbyaddr_r(addr, len, af, hp, buf, buflen,
-+	    &ret_errno, h_errnop);
-+
-+	status = __nss_compat_result(status, *h_errnop);
-+	if (status == NS_SUCCESS)
-+		*resultp = hp;
-+	return (status);
-+}
-+
-+/*
-+ * Calling convention:
-+ * ap: const char *name, int af, struct hostent *hp, char *buf,
-+ *     size_t buflen, int ret_errno, int *h_errnop
-+ * retval is a struct hostent **result passed in by the libc client,
-+ * which is responsible for allocating storage.
-+ */
-+static int
-+__nss_bsdcompat_gethostbyname2_r(void *retval, void *mdata __unused,
-+    va_list ap)
-+{
-+	char		*buf;
-+	const char 	*name;
-+	int		*h_errnop;
-+	struct hostent	*hp;
-+	struct hostent	**resultp;
-+	int		 af;
-+	size_t		 buflen;
-+	int		 ret_errno;
-+	enum nss_status	 status;
-+
-+	name = va_arg(ap, char *);
-+	af = va_arg(ap, int);
-+	hp = va_arg(ap, struct hostent *);
-+	buf = va_arg(ap, char *);
-+	buflen = va_arg(ap, size_t);
-+	ret_errno = va_arg(ap, int);
-+	h_errnop = va_arg(ap, int *);
-+	resultp = (struct hostent **)retval;
-+
-+	*resultp = NULL;
-+	if (hp == NULL)
-+		return (NS_UNAVAIL);
-+
-+	status = _nss_mdns_gethostbyname2_r(name, af, hp, buf, buflen,
-+	    &ret_errno, h_errnop);
-+
-+	status = __nss_compat_result(status, *h_errnop);
-+	if (status == NS_SUCCESS)
-+		*resultp = hp;
-+	return (status);
-+}
-+
-+/*
-+ * Used by getipnodebyaddr(3).
-+ *
-+ * Calling convention:
-+ * ap: struct in[6]_addr *src, size_t len, int af, int *errp
-+ * retval: pointer to a pointer to an uninitialized struct hostent,
-+ * in which should be returned a single pointer to on-heap storage.
-+ *
-+ * This function is responsible for allocating on-heap storage.
-+ * The caller is responsible for calling freehostent() on the returned
-+ * storage.
-+ */
-+static int
-+__nss_bsdcompat_ghbyaddr(void *retval, void *mdata __unused, va_list ap)
-+{
-+	char		*buffer;
-+	void 		*bufp;
-+	int		*errp;
-+	struct hostent	*hp;
-+	struct hostent	**resultp;
-+	void		*src;
-+	int		 af;
-+	size_t		 buflen = 1024;
-+	size_t		 len;
-+	int		 h_errnop;
-+	enum nss_status	 status;
-+
-+	src = va_arg(ap, void *);
-+	len = va_arg(ap, size_t);
-+	af = va_arg(ap, int);
-+	errp = va_arg(ap, int *);
-+	resultp = (struct hostent **)retval;
-+
-+	_NSS_UTRACE("__nss_bsdcompat_ghbyaddr: called");
-+
-+	bufp = malloc((sizeof(struct hostent) + buflen));
-+	if (bufp == NULL) {
-+		*resultp = NULL;
-+		return (NS_UNAVAIL);
-+	}
-+	hp = (struct hostent *)bufp;
-+	buffer = (char *)(hp + 1);
-+
-+	status = _nss_mdns_gethostbyaddr_r(src, len, af, hp, buffer,
-+	    buflen, errp, &h_errnop);
-+
-+	status = __nss_compat_result(status, *errp);
-+	if (status != NS_SUCCESS) {
-+		free(bufp);
-+		hp = NULL;
-+	}
-+	*resultp = hp;
-+	return (status);
-+}
-+
-+/*
-+ * Used by getipnodebyname(3).
-+ *
-+ * Calling convention:
-+ * ap: const char *name, int af, int *errp
-+ * retval: pointer to a pointer to an uninitialized struct hostent.
-+ *
-+ * This function is responsible for allocating on-heap storage.
-+ * The caller is responsible for calling freehostent() on the returned
-+ * storage.
-+ */
-+static int
-+__nss_bsdcompat_ghbyname(void *retval, void *mdata __unused, va_list ap)
-+{
-+	char		*buffer;
-+	void 		*bufp;
-+	int		*errp;
-+	struct hostent	*hp;
-+	struct hostent	**resultp;
-+	char		*name;
-+	int		 af;
-+	size_t		 buflen = 1024;
-+	int		 h_errnop;
-+	enum nss_status	 status;
-+
-+	name = va_arg(ap, char *);
-+	af = va_arg(ap, int);
-+	errp = va_arg(ap, int *);
-+	resultp = (struct hostent **)retval;
-+
-+	bufp = malloc((sizeof(struct hostent) + buflen));
-+	if (bufp == NULL) {
-+		*resultp = NULL;
-+		return (NS_UNAVAIL);
-+	}
-+	hp = (struct hostent *)bufp;
-+	buffer = (char *)(hp + 1);
-+
-+	status = _nss_mdns_gethostbyname_r(name, hp, buffer, buflen, errp,
-+	    &h_errnop);
-+
-+	status = __nss_compat_result(status, *errp);
-+	if (status != NS_SUCCESS) {
-+		free(bufp);
-+		hp = NULL;
-+	}
-+	*resultp = hp;
-+	return (status);
-+}
-+
-+#endif /* !NO_BUILD_BSD_NSS */
+--- src/bsdnss.c.orig	2008-04-30 02:40:37.000000000 +0530
++++ src/bsdnss.c	2008-04-30 02:43:11.000000000 +0530
+@@ -56,7 +56,7 @@
+ #if defined(NSS_IPV4_ONLY) || defined(NSS_IPV6_ONLY)
+ /*
+  * FreeBSD's libc is always built with IPv4 support.
+- * There is no way of telling at compile time with a define if libc
++ * Therxe is no way of telling at compile time with a define if libc
+  * was built with -DINET6 or not; a configure test would be required.
+  * Therefore, distinguishing between the two makes no sense.
+  */
+@@ -219,22 +219,8 @@
+ 	 * 2. Map hostent to addrinfo.
+ 	 * 3. Hand-off buffer to libc.
+ 	 */
+-	switch (pai->ai_family) {
+-	case AF_UNSPEC:
+-		status = _nss_mdns_gethostbyname_r(name, hp, buffer, mbuflen,
+-						   &_errno, &_h_errno);
+-		break;
+-	case AF_INET:
+-		status = _nss_mdns4_gethostbyname_r(name, hp, buffer, mbuflen,
+-						    &_errno, &_h_errno);
+-		break;
+-	case AF_INET6:
+-		status = _nss_mdns6_gethostbyname_r(name, hp, buffer, mbuflen,
+-						    &_errno, &_h_errno);
+-		break;
+-	default:
+-		break;
+-	}
++	status = _nss_mdns_gethostbyname2_r(name, pai->ai_family, hp, buffer,
++					    mbuflen, &_errno, &_h_errno);
+ 	status = __nss_compat_result(status, _errno);
+ 
+ 	if (status == NS_SUCCESS) {
diff -urN /usr/ports/dns/nss_mdns/files/patch-src__query.c nss_mdns/files/patch-src__query.c
--- /usr/ports/dns/nss_mdns/files/patch-src__query.c	2007-01-20 20:13:58.000000000 +0530
+++ nss_mdns/files/patch-src__query.c	1970-01-01 05:30:00.000000000 +0530
@@ -1,147 +0,0 @@
---- src/query.c.orig	Sun Nov 20 00:56:17 2005
-+++ src/query.c	Sat Jan 20 14:34:44 2007
-@@ -87,13 +87,36 @@
-     if (bind(fd, (struct sockaddr*) &sa, sizeof(sa)) < 0)
-         goto fail;
-     
-+#ifdef IP_PKTINFO
-     yes = 1;
--    if (setsockopt(fd, IPPROTO_IP, IP_RECVTTL, &yes, sizeof(yes)) < 0)
--        goto fail;
--
-     if (setsockopt(fd, IPPROTO_IP, IP_PKTINFO, &yes, sizeof(yes)) < 0)
-         goto fail;
-+#else
-+    
-+#ifdef IP_RECVINTERFACE
-+    yes = 1;
-+    if (setsockopt (fd, IPPROTO_IP, IP_RECVINTERFACE, &yes, sizeof(yes)) < 0)
-+      goto fail;
-+#elif defined(IP_RECVIF)
-+    yes = 1;
-+    if (setsockopt (fd, IPPROTO_IP, IP_RECVIF, &yes, sizeof(yes)) < 0)
-+        goto fail;
-+#endif
-+    
-+#ifdef IP_RECVDSTADDR
-+    yes = 1;
-+    if (setsockopt (fd, IPPROTO_IP, IP_RECVDSTADDR, &yes, sizeof(yes)) < 0)
-+        goto fail;
-+#endif
-+    
-+#endif /* IP_PKTINFO */
-     
-+#ifdef IP_RECVTTL
-+    yes = 1;
-+    if (setsockopt(fd, IPPROTO_IP, IP_RECVTTL, &yes, sizeof(yes)) < 0)
-+        goto fail;
-+#endif
-+
-     if (set_cloexec(fd) < 0)
-         goto fail;
-     
-@@ -113,9 +136,15 @@
-     struct sockaddr_in sa;
-     struct msghdr msg;
-     struct iovec io;
-+#ifdef IP_PKTINFO
-     struct cmsghdr *cmsg;
-+    uint8_t cmsg_data[CMSG_SPACE(sizeof(struct in_pktinfo))];
-     struct in_pktinfo *pkti;
--    uint8_t cmsg_data[CMSG_LEN(sizeof(struct in_pktinfo))];
-+#elif defined(IP_SENDSRCADDR)
-+    struct cmsghdr *cmsg;
-+    uint8_t cmsg_data[CMSG_SPACE(sizeof(struct in_addr))];
-+    struct in_addr *addr;
-+#endif
-     int i, n;
-     struct ifreq ifreq[32];
-     struct ifconf ifconf;
-@@ -131,24 +160,43 @@
-     io.iov_base = p->data;
-     io.iov_len = p->size;
- 
--    memset(cmsg_data, 0, sizeof(cmsg_data));
--    cmsg = (struct cmsghdr*) cmsg_data;
--    cmsg->cmsg_len = sizeof(cmsg_data);
--    cmsg->cmsg_level = IPPROTO_IP;
--    cmsg->cmsg_type = IP_PKTINFO;
--
--    pkti = (struct in_pktinfo*) CMSG_DATA(cmsg);
--    pkti->ipi_ifindex = 0;
--    
-     memset(&msg, 0, sizeof(msg));
-     msg.msg_name = &sa;
-     msg.msg_namelen = sizeof(sa);
-     msg.msg_iov = &io;
-     msg.msg_iovlen = 1;
-+    msg.msg_flags = 0;
-+
-+#ifdef IP_PKTINFO
-+    memset(cmsg_data, 0, sizeof(cmsg_data));
-     msg.msg_control = cmsg_data;
-     msg.msg_controllen = sizeof(cmsg_data);
--    msg.msg_flags = 0;
-+	
-+    cmsg = CMSG_FIRSTHDR(&msg);
-+    cmsg->cmsg_len = CMSG_LEN(sizeof(struct in_pktinfo));
-+    cmsg->cmsg_level = IPPROTO_IP;
-+    cmsg->cmsg_type = IP_PKTINFO;
-+
-+    pkti = (struct in_pktinfo*) CMSG_DATA(cmsg);
- 
-+    msg.msg_controllen = cmsg->cmsg_len;
-+#elif defined(IP_SENDSRCADDR)
-+    memset(cmsg_data, 0, sizeof(cmsg_data));
-+    msg.msg_control = cmsg_data;
-+    msg.msg_controllen = sizeof(cmsg_data);
-+        
-+    cmsg = CMSG_FIRSTHDR(&msg);
-+    cmsg->cmsg_len = CMSG_LEN(sizeof(struct in_addr));
-+    cmsg->cmsg_level = IPPROTO_IP;
-+    cmsg->cmsg_type = IP_SENDSRCADDR;
-+	
-+    addr = (struct in_addr *)CMSG_DATA(cmsg);
-+
-+    msg.msg_controllen = cmsg->cmsg_len;
-+#elif defined(__GNUC__)
-+#warning "FIXME: We need some code to set the outgoing interface/local address here if IP_PKTINFO/IP_SENDSRCADDR is not available"
-+#endif
-+   
-     ifconf.ifc_req = ifreq;
-     ifconf.ifc_len = sizeof(ifreq);
-     
-@@ -183,6 +231,7 @@
-         if (ioctl(fd, SIOCGIFINDEX, &ifreq[i]) < 0) 
-             continue; /* See above why we ignore this error */
- 
-+#ifdef IP_PKTINFO
-         /* Only send the the packet once per interface. We assume that
-          * multiple addresses assigned to the same interface follow
-          * immediately one after the other.*/
-@@ -190,6 +239,11 @@
-             continue;
- 
-         last_index = pkti->ipi_ifindex = ifreq[i].ifr_ifindex;
-+#elif defined(IP_SENDSRCADDR)
-+	addr->s_addr = ifsa->sin_addr.s_addr;
-+#elif defined(__GNUC__)
-+#warning "FIXME: We need some code to set the outgoing interface/local address here if IP_PKTINFO/IP_SENDSRCADDR is not available"
-+#endif
-         
-         for (;;) {
-             
-@@ -241,7 +295,12 @@
-             *ret_ttl = 0;
-             
-             for (cmsg = CMSG_FIRSTHDR(&msg); cmsg != NULL; cmsg = CMSG_NXTHDR(&msg,cmsg)) {
--                if (cmsg->cmsg_level == SOL_IP && cmsg->cmsg_type == IP_TTL) {
-+#ifdef SOL_IP
-+                if (cmsg->cmsg_level == SOL_IP && cmsg->cmsg_type == IP_TTL)
-+#else
-+                if (cmsg->cmsg_level == IPPROTO_IP && cmsg->cmsg_type == IP_TTL)
-+#endif
-+		{
-                     *ret_ttl = (uint8_t) (*(uint32_t*) CMSG_DATA(cmsg));
-                     break;
-                 }


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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200808291508.m7TF8PDh033965>