summaryrefslogtreecommitdiff
path: root/dns
diff options
context:
space:
mode:
authorPeter Pentchev <roam@FreeBSD.org>2005-07-04 11:18:30 +0000
committerPeter Pentchev <roam@FreeBSD.org>2005-07-04 11:18:30 +0000
commit825121abdeb3e7fb4d0d1f16de95c6a7e2cd109b (patch)
treea26aa81ef69758f8858b023fd511c484f605994d /dns
parentUpdate to version 0.13.8 (diff)
Fix the generation of DNS packet id's when nsping's pid is over 64K.
While I'm here, fix a compiler warning. PR: 76702 Submitted by: Vladimir Kotal <vlada@devnull.cz>
Notes
Notes: svn path=/head/; revision=138454
Diffstat (limited to 'dns')
-rw-r--r--dns/nsping/Makefile1
-rw-r--r--dns/nsping/files/patch-ab70
-rw-r--r--dns/nsping/files/patch-dns-rr.c11
3 files changed, 78 insertions, 4 deletions
diff --git a/dns/nsping/Makefile b/dns/nsping/Makefile
index 5e938399537e..52a9cc91c3aa 100644
--- a/dns/nsping/Makefile
+++ b/dns/nsping/Makefile
@@ -7,6 +7,7 @@
PORTNAME= nsping
PORTVERSION= 0.8
+PORTREVISION= 1
CATEGORIES= dns
MASTER_SITES= ${MASTER_SITE_LOCAL}
MASTER_SITE_SUBDIR= roam
diff --git a/dns/nsping/files/patch-ab b/dns/nsping/files/patch-ab
index 970acc7d39cc..aa9c1ecbf014 100644
--- a/dns/nsping/files/patch-ab
+++ b/dns/nsping/files/patch-ab
@@ -1,6 +1,16 @@
---- nsping.c.orig Fri Nov 12 15:30:42 1999
-+++ nsping.c Fri Nov 12 15:44:06 1999
-@@ -189,10 +189,14 @@
+--- nsping.c.orig Wed Nov 26 09:11:39 1997
++++ nsping.c Tue Jan 25 15:04:41 2005
+@@ -14,6 +14,9 @@
+ #include <stdarg.h>
+ #include <assert.h>
+
++
++#define MAX_ID 65536
++
+ /* store state on sent queries */
+
+ struct nsq {
+@@ -189,10 +192,14 @@
int guess_zone() {
char lhn[MAXDNAME];
@@ -15,7 +25,59 @@
cp = strchr(lhn, '.');
if(!cp || !(*(++cp)))
-@@ -679,9 +683,7 @@
+@@ -268,8 +275,10 @@
+
+ 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.
+@@ -285,7 +294,8 @@
+
+ /* 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,
+@@ -299,7 +309,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;
+
+@@ -420,7 +430,7 @@
+ double triptime;
+
+ if(!Start)
+- Start = getpid();
++ Start = getpid() % MAX_ID;
+
+ gettimeofday(&tv, NULL);
+
+@@ -437,8 +447,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 */
+
+@@ -679,9 +690,7 @@
/* -------------------------------------------------------------------------- */
void usage() {
diff --git a/dns/nsping/files/patch-dns-rr.c b/dns/nsping/files/patch-dns-rr.c
new file mode 100644
index 000000000000..2963a6523639
--- /dev/null
+++ b/dns/nsping/files/patch-dns-rr.c
@@ -0,0 +1,11 @@
+--- dns-rr.c.orig Mon Jul 4 12:02:22 2005
++++ dns-rr.c Mon Jul 4 12:02:39 2005
+@@ -23,7 +23,7 @@
+
+ len = dns_string(name, dp, MAXDNAME);
+ if(len < 0)
+- return(NULL);
++ return(0);
+
+ dp += len;
+