Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 8 Sep 2013 19:40:33 +0000 (UTC)
From:      Dag-Erling Smørgrav <des@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r255403 - in head: contrib/ldns-host usr.bin/host
Message-ID:  <201309081940.r88JeX4x010945@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: des
Date: Sun Sep  8 19:40:32 2013
New Revision: 255403
URL: http://svnweb.freebsd.org/changeset/base/255403

Log:
  Import Magerya Vitaly's ldns-host, and build it instead of the BIND version
  in the WITH_LDNS_UTILS case.
  
  Approved by:	re (blanket)

Added:
  head/contrib/ldns-host/
     - copied from r255390, vendor/ldns-host/dist/
Modified:
  head/contrib/ldns-host/ldns-host.c
  head/usr.bin/host/Makefile

Modified: head/contrib/ldns-host/ldns-host.c
==============================================================================
--- vendor/ldns-host/dist/ldns-host.c	Sun Sep  8 15:44:34 2013	(r255390)
+++ head/contrib/ldns-host/ldns-host.c	Sun Sep  8 19:40:32 2013	(r255403)
@@ -7,13 +7,16 @@
  * without any warranty.
  */
 
-#include <ldns/ldns.h>
+#include <netinet/in.h>
+
 #include <limits.h>
 #include <netdb.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
 
+#include <ldns/ldns.h>
+
 /* General utilities.
  */
 
@@ -198,11 +201,11 @@ ldns_pkt_filter_answer(ldns_pkt *pkt, ld
         rrtype = ldns_rr_get_type(rr);
         if (type == LDNS_RR_TYPE_ANY ||
             type == rrtype ||
-            type == LDNS_RR_TYPE_AXFR &&
+            (type == LDNS_RR_TYPE_AXFR &&
                 (rrtype == LDNS_RR_TYPE_A ||
-                rrtype == LDNS_RR_TYPE_AAAA ||
-                rrtype == LDNS_RR_TYPE_NS ||
-                rrtype == LDNS_RR_TYPE_PTR))
+		    rrtype == LDNS_RR_TYPE_AAAA ||
+		    rrtype == LDNS_RR_TYPE_NS ||
+		    rrtype == LDNS_RR_TYPE_PTR)))
             ldns_rr_list_set_rr(rrlist, rr, j++);
     }
     ldns_rr_list_set_rr_count(rrlist, j);
@@ -458,8 +461,8 @@ static uint32_t o_ixfr_serial = 0;
 static void
 usage(void) {
     fputs(
-    "Usage: ldns-host [-aCdilrsTvw46] [-c class] [-N ndots] [-R number]\n"
-    "                 [-t type] [-W wait] name [server]\n"
+    "Usage: host [-aCdilrsTvw46] [-c class] [-N ndots] [-R number]\n"
+    "            [-t type] [-W wait] name [server]\n"
     "\t-a same as -v -t ANY\n"
     "\t-C query SOA records from all authoritative name servers\n"
     "\t-c use this query class (IN, CH, HS, etc)\n"
@@ -776,10 +779,10 @@ dosoa(ldns_resolver *res, ldns_rdf *doma
         for (j = 0; j < cnt; j++) {
             ldns_resolver_remove_nameservers(res);
             rr = ldns_rr_list_rr(nsaddrs[i], j);
-            if (ldns_resolver_ip6(res) == LDNS_RESOLV_INET &&
-                ldns_rr_get_type(rr) == LDNS_RR_TYPE_AAAA ||
-                ldns_resolver_ip6(res) == LDNS_RESOLV_INET6 &&
-                ldns_rr_get_type(rr) == LDNS_RR_TYPE_A)
+            if ((ldns_resolver_ip6(res) == LDNS_RESOLV_INET &&
+		    ldns_rr_get_type(rr) == LDNS_RR_TYPE_AAAA) ||
+                (ldns_resolver_ip6(res) == LDNS_RESOLV_INET6 &&
+		    ldns_rr_get_type(rr) == LDNS_RR_TYPE_A))
                 continue;
             if (ldns_resolver_push_nameserver_rr(res, rr) == LDNS_STATUS_OK)
                 /* bind9-host queries for domain, not dname here */

Modified: head/usr.bin/host/Makefile
==============================================================================
--- head/usr.bin/host/Makefile	Sun Sep  8 19:39:18 2013	(r255402)
+++ head/usr.bin/host/Makefile	Sun Sep  8 19:40:32 2013	(r255403)
@@ -1,5 +1,29 @@
 # $FreeBSD$
 
+.include <bsd.own.mk>
+
+.if ${MK_LDNS_UTILS} != "no"
+
+LDNSDIR=	${.CURDIR}/../../contrib/ldns
+LDNSHOSTDIR=	${.CURDIR}/../../contrib/ldns-host
+
+.PATH:		${LDNSHOSTDIR}
+
+PROG=		host
+SRCS=		ldns-host.c
+MAN=		host.1
+
+host.1: ldns-host.1
+	sed -e 's/ldns-//gI' <${.ALLSRC} >${.TARGET} || \
+		(rm -rf ${.TARGET} ; false)
+
+CFLAGS+=	-I${LDNSDIR}
+DPADD+=		${LIBLDNS} ${LIBCRYPTO}
+LDADD+=		-lldns -lcrypto
+USEPRIVATELIB=	ldns
+
+.else
+
 BIND_DIR=	${.CURDIR}/../../contrib/bind9
 LIB_BIND_REL=	../../lib/bind
 LIB_BIND_DIR=	${.CURDIR}/${LIB_BIND_REL}
@@ -20,4 +44,6 @@ WARNS?=		0
 DPADD+=		${BIND_DPADD} ${CRYPTO_DPADD} ${PTHREAD_DPADD}
 LDADD+=		${BIND_LDADD} ${CRYPTO_LDADD} ${PTHREAD_LDADD}
 
+.endif
+
 .include <bsd.prog.mk>



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