summaryrefslogtreecommitdiff
blob: aceebf48b1ca952e64dbfb6186248c8724dc62cb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
From fcfb7fa902fcfc23e9fe78bb57748c110b972029 Mon Sep 17 00:00:00 2001
From: Mike Frysinger <vapier@gentoo.org>
Date: Mon, 14 Apr 2008 00:39:50 -0400
Subject: [PATCH] Mads Martin Joergensen writes:
 According to the manual the option "--numeric-ports" should not
 affect host resolution, but it does. All connected hosts are displayed
 with numeric values instead of their FQDN.

http://bugs.gentoo.org/76756
---
 netstat.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/netstat.c b/netstat.c
index 8057d78..843c06b 100644
--- a/netstat.c
+++ b/netstat.c
@@ -772,8 +772,8 @@ static void tcp_do_one(int lnr, const char *line)
 	txq = 0L;
     }
     safe_strncpy(local_addr, ap->sprint((struct sockaddr *) &localaddr, 
-					flag_not), sizeof(local_addr));
-    safe_strncpy(rem_addr, ap->sprint((struct sockaddr *) &remaddr, flag_not),
+					flag_not & FLAG_NUM_HOST), sizeof(local_addr));
+    safe_strncpy(rem_addr, ap->sprint((struct sockaddr *) &remaddr, flag_not & FLAG_NUM_HOST),
 		 sizeof(rem_addr));
     if (flag_all || (flag_lst && !rem_port) || (!flag_lst && rem_port)) {
 	snprintf(buffer, sizeof(buffer), "%s",
@@ -931,7 +931,7 @@ static void udp_do_one(int lnr, const char *line)
     if (flag_all || (notnull(remaddr) && !flag_lst) || (!notnull(remaddr) && flag_lst))
     {
         safe_strncpy(local_addr, ap->sprint((struct sockaddr *) &localaddr, 
-					    flag_not), sizeof(local_addr));
+					    flag_not & FLAG_NUM_HOST), sizeof(local_addr));
 	snprintf(buffer, sizeof(buffer), "%s",
 		 get_sname(htons(local_port), "udp",
 			   flag_not & FLAG_NUM_PORT));
@@ -944,7 +944,7 @@ static void udp_do_one(int lnr, const char *line)
 	snprintf(buffer, sizeof(buffer), "%s",
 		 get_sname(htons(rem_port), "udp", flag_not & FLAG_NUM_PORT));
         safe_strncpy(rem_addr, ap->sprint((struct sockaddr *) &remaddr, 
-					  flag_not), sizeof(rem_addr));
+					  flag_not & FLAG_NUM_HOST), sizeof(rem_addr));
 	if ((strlen(rem_addr) + strlen(buffer)) > 22)
 	    rem_addr[22 - strlen(buffer)] = '\0';
 	strcat(rem_addr, ":");
@@ -1058,7 +1058,7 @@ static void raw_do_one(int lnr, const char *line)
 		 get_sname(htons(local_port), "raw",
 			   flag_not & FLAG_NUM_PORT));
         safe_strncpy(local_addr, ap->sprint((struct sockaddr *) &localaddr, 
-					    flag_not), sizeof(local_addr));
+					    flag_not & FLAG_NUM_HOST), sizeof(local_addr));
 	if ((strlen(local_addr) + strlen(buffer)) > 22)
 	    local_addr[22 - strlen(buffer)] = '\0';
 	strcat(local_addr, ":");
@@ -1068,7 +1068,7 @@ static void raw_do_one(int lnr, const char *line)
 	snprintf(buffer, sizeof(buffer), "%s",
 		 get_sname(htons(rem_port), "raw", flag_not & FLAG_NUM_PORT));
         safe_strncpy(rem_addr, ap->sprint((struct sockaddr *) &remaddr, 
-					  flag_not), sizeof(rem_addr));
+					  flag_not & FLAG_NUM_HOST), sizeof(rem_addr));
 	if ((strlen(rem_addr) + strlen(buffer)) > 22)
 	    rem_addr[22 - strlen(buffer)] = '\0';
 	strcat(rem_addr, ":");
-- 
1.5.5