a4812e
From 9ea43c6c97d3653cb58c1934f8770b951917bf9a Mon Sep 17 00:00:00 2001
a4812e
From: rpm-build <rpm-build>
a4812e
Date: Mon, 20 Oct 2014 13:26:38 +0200
a4812e
Subject: [PATCH 7/8] Introduce -nn option
a4812e
a4812e
This changes the semantics on -n option so only namelookups are skipped. Port
a4812e
numbers *are* translated to their string representations. Option -nn then has
a4812e
the same semantics as -n had originally.
a4812e
---
a4812e
 addrtoname.c | 4 ++--
a4812e
 tcpdump.1.in | 6 +++++-
a4812e
 2 files changed, 7 insertions(+), 3 deletions(-)
a4812e
a4812e
diff --git a/addrtoname.c b/addrtoname.c
a4812e
index 949acb7..9dd78d8 100644
a4812e
--- a/addrtoname.c
a4812e
+++ b/addrtoname.c
a4812e
@@ -810,7 +810,7 @@ init_servarray(netdissect_options *ndo)
a4812e
 
a4812e
 		while (table->name)
a4812e
 			table = table->nxt;
a4812e
-		if (ndo->ndo_nflag) {
a4812e
+		if (ndo->ndo_nflag > 1) {
a4812e
 			(void)snprintf(buf, sizeof(buf), "%d", port);
a4812e
 			table->name = strdup(buf);
a4812e
 		} else
a4812e
@@ -1233,7 +1233,7 @@ init_addrtoname(netdissect_options *ndo, uint32_t localnet, uint32_t mask)
a4812e
 		f_localnet = localnet;
a4812e
 		f_netmask = mask;
a4812e
 	}
a4812e
-	if (ndo->ndo_nflag)
a4812e
+	if (ndo->ndo_nflag > 1)
a4812e
 		/*
a4812e
 		 * Simplest way to suppress names.
a4812e
 		 */
a4812e
diff --git a/tcpdump.1.in b/tcpdump.1.in
a4812e
index ca5cff2..c711a24 100644
a4812e
--- a/tcpdump.1.in
a4812e
+++ b/tcpdump.1.in
a4812e
@@ -547,7 +547,11 @@ Use \fIsecret\fP as a shared secret for validating the digests found in
a4812e
 TCP segments with the TCP-MD5 option (RFC 2385), if present.
a4812e
 .TP
a4812e
 .B \-n
a4812e
-Don't convert addresses (i.e., host addresses, port numbers, etc.) to names.
a4812e
+Don't convert host addresses to names.  This can be used to avoid
a4812e
+DNS lookups.
a4812e
+.TP
a4812e
+.B \-nn
a4812e
+Don't convert protocol and port numbers etc. to names either.
a4812e
 .TP
a4812e
 .B \-N
a4812e
 Don't print domain name qualification of host names.
a4812e
-- 
a4812e
2.9.3
a4812e