From owner-svn-ports-head@FreeBSD.ORG Mon Jul 28 18:00:42 2014 Return-Path: Delivered-To: svn-ports-head@freebsd.org 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 ESMTPS id 54E497C1; Mon, 28 Jul 2014 18:00:42 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 26D9B2B4A; Mon, 28 Jul 2014 18:00:42 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6SI0gf4099009; Mon, 28 Jul 2014 18:00:42 GMT (envelope-from adamw@svn.freebsd.org) Received: (from adamw@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6SI0eFF099001; Mon, 28 Jul 2014 18:00:40 GMT (envelope-from adamw@svn.freebsd.org) Message-Id: <201407281800.s6SI0eFF099001@svn.freebsd.org> From: Adam Weinberger Date: Mon, 28 Jul 2014 18:00:40 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r363210 - in head/dns: djbdns/files doc doc/files nsping/files X-SVN-Group: ports-head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the ports tree for head List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jul 2014 18:00:42 -0000 Author: adamw Date: Mon Jul 28 18:00:40 2014 New Revision: 363210 URL: http://svnweb.freebsd.org/changeset/ports/363210 QAT: https://qat.redports.org/buildarchive/r363210/ Log: Rename dns/ patch-xy patches to reflect the files they modify. Added: head/dns/djbdns/files/patch-dnscache-conf.c - copied unchanged from r363209, head/dns/djbdns/files/patch-aa head/dns/djbdns/files/patch-hier.c - copied unchanged from r363209, head/dns/djbdns/files/patch-ab head/dns/doc/files/patch-doc - copied unchanged from r363209, head/dns/doc/files/patch-aa head/dns/nsping/files/patch-Makefile - copied unchanged from r363209, head/dns/nsping/files/patch-aa head/dns/nsping/files/patch-nsping.c - copied unchanged from r363209, head/dns/nsping/files/patch-ab Deleted: head/dns/djbdns/files/patch-aa head/dns/djbdns/files/patch-ab head/dns/doc/files/patch-aa head/dns/nsping/files/patch-aa head/dns/nsping/files/patch-ab Modified: head/dns/doc/Makefile Copied: head/dns/djbdns/files/patch-dnscache-conf.c (from r363209, head/dns/djbdns/files/patch-aa) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/dns/djbdns/files/patch-dnscache-conf.c Mon Jul 28 18:00:40 2014 (r363210, copy of r363209, head/dns/djbdns/files/patch-aa) @@ -0,0 +1,20 @@ +--- dnscache-conf.orig Sat Sep 23 17:39:21 2000 ++++ dnscache-conf.c Sat Sep 23 17:42:43 2000 +@@ -89,13 +89,13 @@ + if (chdir(auto_home) == -1) + strerr_die4sys(111,FATAL,"unable to switch to ",auto_home,": "); + +- fdrootservers = open_read("/etc/dnsroots.local"); ++ fdrootservers = open_read("etc/dnsroots.local"); + if (fdrootservers == -1) { + if (errno != error_noent) +- strerr_die2sys(111,FATAL,"unable to open /etc/dnsroots.local: "); +- fdrootservers = open_read("/etc/dnsroots.global"); ++ strerr_die4sys(111,FATAL,"unable to open ",auto_home,"/etc/dnsroots.local: "); ++ fdrootservers = open_read("etc/dnsroots.global"); + if (fdrootservers == -1) +- strerr_die2sys(111,FATAL,"unable to open /etc/dnsroots.global: "); ++ strerr_die4sys(111,FATAL,"unable to open ",auto_home,"/etc/dnsroots.global: "); + } + + init(dir,FATAL); Copied: head/dns/djbdns/files/patch-hier.c (from r363209, head/dns/djbdns/files/patch-ab) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/dns/djbdns/files/patch-hier.c Mon Jul 28 18:00:40 2014 (r363210, copy of r363209, head/dns/djbdns/files/patch-ab) @@ -0,0 +1,16 @@ +--- hier.c.orig Wed Apr 14 09:38:45 2004 ++++ hier.c Wed Apr 14 09:39:16 2004 +@@ -2,10 +2,10 @@ + + void hier() + { +- c("/","etc","dnsroots.global",-1,-1,0644); ++ c(auto_home,"etc","dnsroots.global",-1,-1,0644); + +- h(auto_home,-1,-1,02755); +- d(auto_home,"bin",-1,-1,02755); ++ h(auto_home,-1,-1,0755); ++ d(auto_home,"bin",-1,-1,0755); + + c(auto_home,"bin","dnscache-conf",-1,-1,0755); + c(auto_home,"bin","tinydns-conf",-1,-1,0755); Modified: head/dns/doc/Makefile ============================================================================== --- head/dns/doc/Makefile Mon Jul 28 17:55:14 2014 (r363209) +++ head/dns/doc/Makefile Mon Jul 28 18:00:40 2014 (r363210) @@ -13,7 +13,7 @@ COMMENT= Diagnose unhealthy DNS domains RUN_DEPENDS= dig:${PORTSDIR}/dns/bind-tools -USE_BZIP2= yes +USES= tar:bzip2 AUX_DIR= lib/doc AUX_FILES= doc-1.awk doc-3.awk doc-4.awk INFO RFC.XXXX @@ -21,7 +21,7 @@ AUX_FILES= doc-1.awk doc-3.awk doc-4.awk do-build: @${MV} ${WRKSRC}/doc ${WRKSRC}/doc.org @${SED} -e 's|$${PREFIX}|${PREFIX}|g' -e 's|$${AUX_DIR}|${AUX_DIR}|g' ${WRKSRC}/doc.org \ - > ${WRKSRC}/doc + > ${WRKSRC}/doc do-install: @${MKDIR} ${STAGEDIR}${PREFIX}/${AUX_DIR} Copied: head/dns/doc/files/patch-doc (from r363209, head/dns/doc/files/patch-aa) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/dns/doc/files/patch-doc Mon Jul 28 18:00:40 2014 (r363210, copy of r363209, head/dns/doc/files/patch-aa) @@ -0,0 +1,11 @@ +--- doc.orig Wed Jul 25 19:24:50 2001 ++++ doc Tue May 3 12:10:46 2005 +@@ -106,7 +106,7 @@ + ## Note: Make *sure* you keep the trailing slash on the directory + ## name, otherwise doc won't work right. + ## +-#set auxd=/users/brad/bin/doc-2.2.3/ ++set auxd=${PREFIX}/${AUX_DIR}/ + + ######## where are log files written? + ## Copied: head/dns/nsping/files/patch-Makefile (from r363209, head/dns/nsping/files/patch-aa) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/dns/nsping/files/patch-Makefile Mon Jul 28 18:00:40 2014 (r363210, copy of r363209, head/dns/nsping/files/patch-aa) @@ -0,0 +1,17 @@ +--- Makefile.orig Mon Nov 24 04:56:28 1997 ++++ Makefile Fri Nov 12 15:53:26 1999 +@@ -1,4 +1,4 @@ +-CFLAGS= -g ++#CFLAGS= -g + #Solaris + #CFLAGS= -g -Dsys5 + LDFLAGS= +@@ -10,6 +10,8 @@ + OBJS= nsping.o dns-lib.o dns-rr.o + SRCS= nsping.c dns-lib.c dns-rr.c + HEADERS= nsping.h dns-lib.h dns-rr.h ++ ++all: ${TARGET} + + ${TARGET} : ${OBJS} + ${CC} ${CFLAGS} -o ${TARGET} ${OBJS} ${LDFLAGS} ${LIBS} Copied: head/dns/nsping/files/patch-nsping.c (from r363209, head/dns/nsping/files/patch-ab) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/dns/nsping/files/patch-nsping.c Mon Jul 28 18:00:40 2014 (r363210, copy of r363209, head/dns/nsping/files/patch-ab) @@ -0,0 +1,373 @@ +--- nsping.c.orig Wed Jul 20 15:23:29 2005 ++++ nsping.c Wed Feb 16 10:41:04 2005 +@@ -14,6 +14,9 @@ + #include + #include + ++ ++#define MAX_ID 65536 ++ + /* store state on sent queries */ + + struct nsq { +@@ -26,8 +29,17 @@ + * too much stuff through globals. Sorry. + */ + ++#if 0 + u_int32_t Target_Address = INADDR_NONE; ++#endif ++struct in_addr sin_addr; /* XXX = INADDR_NONE; */ ++struct in6_addr sin6_addr; /* XXX = ; IN6ADDR_ANY_INIT */ ++#if 0 + u_int16_t Target_Port = DNS_PORT; ++#endif ++char *Target_Port = NULL; ++char addr_string[255]; ++struct addrinfo *ainfo; + char *Zone = NULL; + char *Hostname = NULL; + +@@ -55,7 +67,7 @@ + struct timeval *tvp; + struct itimerval itv; + u_int32_t address = INADDR_ANY; +- u_int32_t port = getpid() + 1024; ++ char Local_Port[6]; + char *timearg = NULL; + char c; + int i; +@@ -65,6 +77,10 @@ + Queries[i].found = 1; + } + ++ Target_Port = xstrdup(DNS_PORT); ++ /* XXX check for result */ ++ snprintf(Local_Port, sizeof(Local_Port), "%d", getpid() + 1024); ++ + #define OPTS "z:h:t:p:dP:a:c:T:rR" + + while((c = getopt(argc, argv, OPTS)) != EOF) { +@@ -105,15 +121,17 @@ + break; + + case 'p': +- Target_Port = atoi(optarg); ++ Target_Port = xstrdup(optarg); + break; + + case 'P': +- port = atoi(optarg); ++ strncpy(Local_Port, optarg, sizeof(Local_Port)); + break; + + case 'a': +- address = resolve(optarg); ++#if 0 ++ address = resolve(optarg, port); ++#endif + if(address == INADDR_NONE) { + fprintf(stderr, "Unable to resolve local address.\n"); + exit(1); +@@ -135,7 +153,7 @@ + exit(1); + } + +- if((Target_Address = resolve(*argv)) == INADDR_NONE) { ++ if ((ainfo = resolve(*argv, Target_Port)) == 0) { + fprintf(stderr, "Unable to resolve target server address.\n"); + fprintf(stderr, "Fatal error, exiting.\n"); + exit(1); +@@ -147,7 +165,7 @@ + exit(1); + } + +- if((Sockfd = bind_udp_socket(address, port)) < 0) { ++ if((Sockfd = bind_udp_socket(Local_Port)) < 0) { + fprintf(stderr, "Fatal error, exiting.\n"); + exit(1); + } +@@ -167,7 +185,7 @@ + /* start the fun */ + + printf("NSPING %s (%s): %s = \"%s\", Type = \"IN %s\"\n", +- *argv, addr_string(Target_Address), ++ *argv, addr_string, + Hostname ? "Hostname" : "Domain", + Hostname ? Hostname : Zone, + type_int2string(Type)); +@@ -189,10 +207,14 @@ + + int guess_zone() { + char lhn[MAXDNAME]; ++ struct hostent *hp; + char *cp; + + if(gethostname(lhn, MAXDNAME) < 0) + return(0); ++ if((hp = gethostbyname(lhn)) == NULL) ++ return(0); ++ strlcpy(lhn, hp->h_name, sizeof(lhn)); + + cp = strchr(lhn, '.'); + if(!cp || !(*(++cp))) +@@ -261,15 +283,19 @@ + static int Start = 0; + static int Pos = 0; + +- struct sockaddr_in si; ++#if 0 ++ struct sockaddr_storage si; ++#endif + int l; + int id; + u_char *qp; + + signal(SIGALRM, probe); + +- if(!Start) +- Start = getpid(); ++ if(!Start) { ++ Start = getpid() % MAX_ID; ++ dprintf("Start = %d\n", Start); ++ } + + /* we're overwriting state from a query we never got a response + * to, so at least note that we missed it. +@@ -278,18 +304,16 @@ + if(!Queries[Pos].found) + Missed++; + +- memset(&si, 0, sizeof(si)); +- si.sin_addr.s_addr = Target_Address; +- si.sin_port = htons(Target_Port); +- si.sin_family = AF_INET; +- + /* get the DNS request */ + +- l = dns_packet(&qp, Start + Sent); ++ dprintf("sending with id = %d\n", (Start + Sent) % MAX_ID); ++ l = dns_packet(&qp, (Start + Sent) % MAX_ID); + + do { + if(sendto(Sockfd, qp, l, 0, +- (struct sockaddr *)&si, sizeof(si)) < 0) { ++ (struct sockaddr *)ainfo->ai_addr, ++ ainfo->ai_addrlen) < 0) { ++ + if(errno != EINTR) { + perror("sendto"); + return; +@@ -299,7 +323,7 @@ + + /* if it was sent successfully, update state */ + +- Queries[Pos].id = Start + Sent; ++ Queries[Pos].id = (Start + Sent) % MAX_ID; + gettimeofday(&Queries[Pos].sent, NULL); + Queries[Pos].found = 0; + +@@ -361,7 +385,10 @@ + + void handle_incoming() { + u_char buffer[1024]; ++#if 0 + struct sockaddr_in si; ++#endif ++ struct sockaddr_storage si; + int sil = sizeof(si); + int l; + +@@ -378,6 +405,7 @@ + + /* descriminate real responses from spurious crud */ + ++#if 0 + if(si.sin_addr.s_addr != Target_Address) { + dprintf("Received packet from unexpected address %s.\n", + inet_ntoa(si.sin_addr)); +@@ -389,6 +417,7 @@ + ntohs(si.sin_port)); + continue; + } ++#endif + + if(l < sizeof(HEADER)) { + dprintf("Short packet.\n"); +@@ -420,7 +449,7 @@ + double triptime; + + if(!Start) +- Start = getpid(); ++ Start = getpid() % MAX_ID; + + gettimeofday(&tv, NULL); + +@@ -437,8 +466,9 @@ + Queries[i].found = 1; + + /* figure out which query this was, using the DNS query ID */ +- ++ dprintf("received with id = %d\n", ntohs(hp->id)); + delta = ntohs(hp->id) - Start; ++ dprintf("delta = %d - %d = %d\n", ntohs(hp->id), Start, delta); + + /* figure out how long it took */ + +@@ -494,7 +524,7 @@ + hp->rcode == NOERROR ? "+" : "-", + delta, + l, +- addr_string(Target_Address), ++ addr_string, + triptime, + delta ? Ave : 0.0); + +@@ -512,6 +542,9 @@ + "Ave/Max/Min: %8.3f / %8.3f / %8.3f\n", + Sent, Count, Missed ? Missed : Sent - Count, Lagged, Ave, Max, Min); + ++#if 0 ++ freeaddrinfo(); ++#endif + exit(0); + } + +@@ -555,18 +588,6 @@ + + /* -------------------------------------------------------------------------- */ + +-/* binary address -> dotted quad string */ +- +-char *addr_string(u_int32_t address) { +- static char as[20]; +- u_char *cp = (u_char *) &address; +- +- sprintf(as, "%d.%d.%d.%d", cp[0], cp[1], cp[2], cp[3]); +- return(as); +-} +- +-/* -------------------------------------------------------------------------- */ +- + /* map integer type codes to names, v/vrsa. Add new types here if you must. */ + + struct type2str { +@@ -625,22 +646,40 @@ + + /* return a bound UDP socket */ + +-int bind_udp_socket(u_int32_t address, u_int16_t port) { +- struct sockaddr_in si; ++int bind_udp_socket(char *port) { + int sockfd; +- +- sockfd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); +- if(sockfd < 0) { ++ char str[255]; ++ ++ struct sockaddr_storage sss; ++ struct in6_addr anyaddr = IN6ADDR_ANY_INIT; ++ socklen_t addrlen; ++ ++ sockfd = socket(ainfo->ai_family, ainfo->ai_socktype, ++ ainfo->ai_protocol); ++ if (sockfd < 0) { + perror("socket"); + return(-1); + } + +- memset(&si, 0, sizeof(si)); +- si.sin_addr.s_addr = address; +- si.sin_port = htons(port); +- si.sin_family = AF_INET; ++ memset(&sss, 0, sizeof(sss)); ++ switch (ainfo->ai_family) { ++ case AF_INET: ++ (((struct sockaddr_in *)(&sss))->sin_addr).s_addr = INADDR_ANY; ++ ((struct sockaddr_in *)(&sss))->sin_port = htons(atoi(port)); ++ ((struct sockaddr_in *)(&sss))->sin_family = AF_INET; ++ addrlen = sizeof(struct sockaddr_in); ++ break; ++ ++ case AF_INET6: ++ ((struct sockaddr_in6 *)(&sss))->sin6_addr = anyaddr; ++ ((struct sockaddr_in6 *)(&sss))->sin6_port = htons(atoi(port)); ++ ((struct sockaddr_in6 *)(&sss))->sin6_family = AF_INET6; ++ addrlen = sizeof(struct sockaddr_in6); ++ break; ++ } + +- if(bind(sockfd, (struct sockaddr *)&si, sizeof(si)) < 0) { ++ if(bind(sockfd, (struct sockaddr *)&sss, addrlen) < 0) ++ { + perror("bind"); + return(-1); + } +@@ -652,19 +691,45 @@ + + /* wrap hostname resolution */ + +-u_int32_t resolve(char *name) { +- u_long addr; +- +- addr = inet_addr(name); +- if(addr == INADDR_NONE) { +- struct hostent *hp = gethostbyname(name); +- if(!hp) +- return(INADDR_NONE); +- +- memcpy(&addr, hp->h_addr, 4); ++struct addrinfo* resolve(char *name, char *port) { ++ struct addrinfo hints, *res, *res0; ++ int error; ++ const char *cause = NULL; ++ ++ memset(&hints, 0, sizeof(hints)); ++ hints.ai_family = PF_UNSPEC; ++ hints.ai_socktype = SOCK_DGRAM; ++ error = getaddrinfo(name, port, &hints, &res0); ++ if (error) { ++ errx(1, "%s", gai_strerror(error)); ++ return(NULL); ++ } ++ ++ res = res0; ++ switch (res->ai_family) { ++ case AF_INET: ++#if 0 ++ sin_addr = (struct ++#endif ++ inet_ntop(res->ai_family, ++ &(((struct sockaddr_in *)(res->ai_addr))->sin_addr), ++ addr_string, sizeof(addr_string)); ++ printf("%s\n", addr_string); ++ break; ++ case AF_INET6: ++#if 0 ++ sin6_addr = ++#endif ++ inet_ntop(res->ai_family, ++ &(((struct sockaddr_in6 *)(res->ai_addr))->sin6_addr), ++ addr_string, sizeof(addr_string)); ++ break; ++ default: ++ return(NULL); ++ break; + } + +- return(addr); ++ return(res); + } + + +@@ -679,9 +744,7 @@ + /* -------------------------------------------------------------------------- */ + + void usage() { +- fprintf(stderr, "nsping [ -z | -h ] -p -t \n" +- "\t\t-a -P \n" +- "\t\t-T <-r | -R, recurse?>\n"); ++ fprintf(stderr, "Usage: nsping [-dR] [-c count] [-z zone | -h hostname] [-t timeout] [-p dport] [-P sport] [-a saddr] [-T querytype]\n"); + return; + } +