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