From owner-freebsd-bugs@FreeBSD.ORG Mon Oct 21 07:20:01 2013 Return-Path: Delivered-To: freebsd-bugs@smarthost.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 243637E9 for ; Mon, 21 Oct 2013 07:20:01 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 02DDB2FE6 for ; Mon, 21 Oct 2013 07:20:01 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.7/8.14.7) with ESMTP id r9L7K0dL061540 for ; Mon, 21 Oct 2013 07:20:00 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.7/8.14.7/Submit) id r9L7K0Yo061528; Mon, 21 Oct 2013 07:20:00 GMT (envelope-from gnats) Resent-Date: Mon, 21 Oct 2013 07:20:00 GMT Resent-Message-Id: <201310210720.r9L7K0Yo061528@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, "Ronald S. Storey" Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 7F2C669B for ; Mon, 21 Oct 2013 07:12:08 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from oldred.freebsd.org (oldred.freebsd.org [8.8.178.121]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 5DB832FA0 for ; Mon, 21 Oct 2013 07:12:08 +0000 (UTC) Received: from oldred.freebsd.org ([127.0.1.6]) by oldred.freebsd.org (8.14.5/8.14.7) with ESMTP id r9L7C7ej037384 for ; Mon, 21 Oct 2013 07:12:07 GMT (envelope-from nobody@oldred.freebsd.org) Received: (from nobody@localhost) by oldred.freebsd.org (8.14.5/8.14.5/Submit) id r9L7C7Dq037379; Mon, 21 Oct 2013 07:12:07 GMT (envelope-from nobody) Message-Id: <201310210712.r9L7C7Dq037379@oldred.freebsd.org> Date: Mon, 21 Oct 2013 07:12:07 GMT From: "Ronald S. Storey" To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Subject: bin/183148: [patch] add getaddrinfo(1) tool from NetBSD X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2013 07:20:01 -0000 >Number: 183148 >Category: bin >Synopsis: [patch] add getaddrinfo(1) tool from NetBSD >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Mon Oct 21 07:20:00 UTC 2013 >Closed-Date: >Last-Modified: >Originator: Ronald S. Storey >Release: >Organization: Klopfenstein's >Environment: >Description: Add an utility to diagnose getaddrinfo() and nsswitch.conf issues where drill(1) doesn't help. >How-To-Repeat: $ getaddrinfo -c -t stream -s 80 wiki.freebsd.org canonname wfe0.ysv.freebsd.org stream inet6 tcp 2001:1900:2254:206a::50:0 80 stream inet tcp 8.8.178.110 80 >Fix: Before applying the patch $ export CVSROOT=anoncvs@anoncvs.NetBSD.org:/cvsroot $ cvs co src/lib/libutil $ cvs co src/usr.bin/getaddrinfo $ cp src/lib/libutil/sockaddr_snprintf.c /usr/src/lib/libnetbsd/ $ cp -R src/usr.bin/getaddrinfo /usr/src/usr.bin/ $ svn add /usr/src/lib/libnetbsd/sockaddr_snprintf.c /usr/src/usr.bin/ --- getaddrinfo.1.diff begins here --- Index: lib/libnetbsd/Makefile =================================================================== --- lib/libnetbsd/Makefile (revision 256668) +++ lib/libnetbsd/Makefile (working copy) @@ -6,7 +6,7 @@ LIB= netbsd CFLAGS+= -I${.CURDIR} -SRCS+= strsuftoll.c util.c util.h +SRCS+= sockaddr_snprintf.c strsuftoll.c util.c util.h INTERNALLIB= Index: lib/libnetbsd/sockaddr_snprintf.c =================================================================== RCS file: /cvsroot/src/lib/libutil/sockaddr_snprintf.c,v retrieving revision 1.10 diff -u -p -r1.10 sockaddr_snprintf.c --- lib/libutil/sockaddr_snprintf.c 7 Jun 2013 17:23:26 -0000 1.10 +++ lib/libnetbsd/sockaddr_snprintf.c 21 Oct 2013 03:32:40 -0000 @@ -29,9 +29,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -#if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: sockaddr_snprintf.c,v 1.10 2013/06/07 17:23:26 christos Exp $"); -#endif /* LIBC_SCCS and not lint */ +__FBSDID("$FreeBSD$"); #include #include Index: lib/libnetbsd/util.h =================================================================== --- lib/libnetbsd/util.h (revision 256668) +++ lib/libnetbsd/util.h (working copy) @@ -36,6 +36,8 @@ #include char *flags_to_string(u_long flags, const char *def); +int sockaddr_snprintf(char *, size_t, const char *, + const struct sockaddr *); int string_to_flags(char **stringp, u_long *setp, u_long *clrp); #endif /* _UTIL_H_ */ Index: usr.bin/Makefile =================================================================== --- usr.bin/Makefile (revision 256668) +++ usr.bin/Makefile (working copy) @@ -57,6 +57,7 @@ SUBDIR= alias \ ftp \ gcore \ gencat \ + getaddrinfo \ getconf \ getent \ getopt \ Index: usr.bin/getaddrinfo/Makefile =================================================================== RCS file: /cvsroot/src/usr.bin/getaddrinfo/Makefile,v retrieving revision 1.1 diff -u -p -r1.1 Makefile --- usr.bin/getaddrinfo/Makefile 30 Sep 2013 06:19:22 -0000 1.1 +++ usr.bin/getaddrinfo/Makefile 21 Oct 2013 03:37:04 -0000 @@ -1,20 +1,23 @@ # $NetBSD: Makefile,v 1.1 2013/09/30 06:19:22 riastradh Exp $ +# $FreeBSD$ PROG= getaddrinfo +CFLAGS+= -I${.CURDIR}/../../lib/libnetbsd +LIBNETBSDDIR= ${.OBJDIR}/../../lib/libnetbsd +LIBNETBSD= ${LIBNETBSDDIR}/libnetbsd.a +DPADD+= ${LIBNETBSD} +LDADD+= ${LIBNETBSD} + DPADD+= ${LIBUTIL} LDADD+= -lutil -WARNS= 5 - -SYS_SOCKET_H?= ${NETBSDSRCDIR}/sys/sys/socket.h +SYS_SOCKET_H?= ${.CURDIR}/../../sys/sys/socket.h -CPPFLAGS+= -I. +CFLAGS+= -I. DPSRCS+= tables.h CLEANFILES+= tables.h tables.h: tables.awk ${SYS_SOCKET_H} - ${_MKTARGET_CREATE} - ${TOOL_AWK} -f ${.ALLSRC} > ${.TARGET}.tmp \ - && mv -f -- ${.TARGET}.tmp ${.TARGET} + LC_ALL=C awk -f ${.ALLSRC} > ${.TARGET} .include Index: usr.bin/getaddrinfo/getaddrinfo.1 =================================================================== RCS file: /cvsroot/src/usr.bin/getaddrinfo/getaddrinfo.1,v retrieving revision 1.2 diff -u -p -r1.2 getaddrinfo.1 --- usr.bin/getaddrinfo/getaddrinfo.1 30 Sep 2013 08:13:59 -0000 1.2 +++ usr.bin/getaddrinfo/getaddrinfo.1 21 Oct 2013 03:37:04 -0000 @@ -62,7 +62,7 @@ system's .Xr nsswitch.conf 5 configuration, it is not intended to be a general-purpose utility to query the DNS; use the -.Xr dig 1 +.Xr drill 1 utility for that. .Pp The following options are available: @@ -155,7 +155,7 @@ stream inet6 tcp 2001:470:1f05:3d::21 80 stream inet tcp 199.233.217.249 80 .Ed .Sh SEE ALSO -.Xr dig 1 , +.Xr drill 1 , .Xr getent 1 , .Xr getaddrinfo 3 , .Xr getnameinfo 3 , @@ -169,4 +169,6 @@ stream inet tcp 199.233.217.249 80 The .Nm command first appeared in +.Fx 11.0 . +It was ported from .Nx 7.0 . Index: usr.bin/getaddrinfo/getaddrinfo.c =================================================================== RCS file: /cvsroot/src/usr.bin/getaddrinfo/getaddrinfo.c,v retrieving revision 1.1 diff -u -p -r1.1 getaddrinfo.c --- usr.bin/getaddrinfo/getaddrinfo.c 30 Sep 2013 06:19:22 -0000 1.1 +++ usr.bin/getaddrinfo/getaddrinfo.c 21 Oct 2013 03:37:04 -0000 @@ -30,7 +30,9 @@ */ #include -__RCSID("$NetBSD: getaddrinfo.c,v 1.1 2013/09/30 06:19:22 riastradh Exp $"); +__FBSDID("$FreeBSD$"); + +#include #include #include @@ -39,6 +41,7 @@ #include #include #include +#include #include #include #include Index: usr.bin/getaddrinfo/tables.awk =================================================================== RCS file: /cvsroot/src/usr.bin/getaddrinfo/tables.awk,v retrieving revision 1.1 diff -u -p -r1.1 tables.awk --- usr.bin/getaddrinfo/tables.awk 30 Sep 2013 06:19:22 -0000 1.1 +++ usr.bin/getaddrinfo/tables.awk 21 Oct 2013 03:51:59 -0000 @@ -38,11 +38,11 @@ BEGIN { next } -$2 ~ /^AF_[A-Z0-9_]*$/ { +$2 ~ /^AF_[A-Z0-9_]*$/ && $2 !~ /^AF_MAX$/ { afs[n_afs++] = substr($2, 4) } -$2 ~ /^SOCK_[A-Z0-9_]*$/ { +$2 ~ /^SOCK_[A-Z0-9_]*$/ && $2 !~ /^SOCK_MAXADDRLEN$/ { socktypes[n_socktypes++] = substr($2, 6) } --- getaddrinfo.1.diff ends here --- >Release-Note: >Audit-Trail: >Unformatted: