net-tools/net-tools-1.60-avoid-name-resolution.patch

32 lines
1.2 KiB
Diff
Raw Normal View History

diff -up net-tools-1.60/netstat.c.avoid-name-resolution net-tools-1.60/netstat.c
--- net-tools-1.60/netstat.c.avoid-name-resolution 2009-08-28 10:48:40.000000000 +0200
+++ net-tools-1.60/netstat.c 2009-08-14 12:36:56.000000000 +0200
@@ -961,6 +961,10 @@ static void tcp_do_one(int lnr, const ch
&d, local_addr, &local_port, rem_addr, &rem_port, &state,
&txq, &rxq, &timer_run, &time_len, &retr, &uid, &timeout, &inode, more);
+ if (!flag_all &&
+ ((flag_lst && rem_port) || (!flag_lst && !rem_port)))
+ return;
+
if (strlen(local_addr) > 8) {
#if HAVE_AFINET6
/* Demangle what the kernel gives us */
@@ -1014,7 +1018,7 @@ static void tcp_do_one(int lnr, const ch
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",
get_sname(htons(local_port), "tcp",
flag_not & FLAG_NUM_PORT));
@@ -1075,7 +1079,6 @@ static void tcp_do_one(int lnr, const ch
rxq, txq, local_addr, rem_addr, _(tcp_state[state]));
finish_this_one(uid,inode,timers);
- }
}
static int tcp_info(void)