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