summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason King <jason.brian.king@gmail.com>2021-06-21 10:18:33 -0500
committerJason King <jason.brian.king@gmail.com>2021-06-21 13:14:21 -0500
commitcdfd7f6baf7b308aedaeb7a7f4a89a4dccd9313e (patch)
tree0a74cee908920fc8f5c4a15f5ad137807f5b97d9
parentb5358705b92a175b02aad08cd1c6b83dc69e2ae6 (diff)
downloadillumos-joyent-cdfd7f6baf7b308aedaeb7a7f4a89a4dccd9313e.tar.gz
13867 netstat shows duplicated data for UDP source and dest addresses
Reviewed by: C Fraire <cfraire@me.com> Reviewed by: Vitaliy Gusev <gusev.vitaliy@icloud.com> Approved by: Dan McDonald <danmcd@joyent.com>
-rw-r--r--usr/src/cmd/cmd-inet/usr.bin/netstat/netstat.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/usr/src/cmd/cmd-inet/usr.bin/netstat/netstat.c b/usr/src/cmd/cmd-inet/usr.bin/netstat/netstat.c
index 49f5ead480..90c32092aa 100644
--- a/usr/src/cmd/cmd-inet/usr.bin/netstat/netstat.c
+++ b/usr/src/cmd/cmd-inet/usr.bin/netstat/netstat.c
@@ -25,6 +25,7 @@
* MROUTING Revision 3.5
* Copyright 2018, Joyent, Inc.
* Copyright 2020 OmniOS Community Edition (OmniOSce) Association.
+ * Copyright 2021 Racktop Systems, Inc.
*/
/*
@@ -6025,6 +6026,7 @@ udp_report_item_v4(const mib2_udpEntry_t *ude, boolean_t first,
{
char *leadin;
char lname[MAXHOSTNAMELEN + MAXHOSTNAMELEN + 1];
+ char fname[MAXHOSTNAMELEN + MAXHOSTNAMELEN + 1];
/* hostname + portname */
proc_fdinfo_t *ph;
@@ -6052,7 +6054,7 @@ udp_report_item_v4(const mib2_udpEntry_t *ude, boolean_t first,
lname, sizeof (lname)),
ude->udpEntryInfo.ue_state == MIB2_UDP_connected ?
pr_ap(ude->udpEntryInfo.ue_RemoteAddress,
- ude->udpEntryInfo.ue_RemotePort, "udp", lname, sizeof (lname)) :
+ ude->udpEntryInfo.ue_RemotePort, "udp", fname, sizeof (fname)) :
"") == -1) {
fatal(1, "Out of memory");
}
@@ -6094,6 +6096,7 @@ udp_report_item_v6(const mib2_udp6Entry_t *ude6, boolean_t first,
{
char *leadin;
char lname[MAXHOSTNAMELEN + MAXHOSTNAMELEN + 1];
+ char fname[MAXHOSTNAMELEN + MAXHOSTNAMELEN + 1];
/* hostname + portname */
char ifname[LIFNAMSIZ + 1];
const char *ifnamep;
@@ -6126,7 +6129,7 @@ udp_report_item_v6(const mib2_udp6Entry_t *ude6, boolean_t first,
ude6->udp6LocalPort, "udp", lname, sizeof (lname)),
ude6->udp6EntryInfo.ue_state == MIB2_UDP_connected ?
pr_ap6(&ude6->udp6EntryInfo.ue_RemoteAddress,
- ude6->udp6EntryInfo.ue_RemotePort, "udp", lname, sizeof (lname)) :
+ ude6->udp6EntryInfo.ue_RemotePort, "udp", fname, sizeof (fname)) :
"") == -1) {
fatal(1, "Out of memory");
}