From 3ffa3182a7d51aaaf1255b749b76ef0d5029a9df Mon Sep 17 00:00:00 2001 From: tuexen Date: Fri, 15 Jul 2016 23:13:57 +0000 Subject: [PATCH] Ensure that the -a, -W, -L options for SCTP behave similar as for TCP. MFC after: 3 days --- usr.bin/netstat/sctp.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/usr.bin/netstat/sctp.c b/usr.bin/netstat/sctp.c index 25bf33f78589..c31bf0db30d3 100644 --- a/usr.bin/netstat/sctp.c +++ b/usr.bin/netstat/sctp.c @@ -447,7 +447,8 @@ sctp_process_inpcb(struct xsctp_inpcb *xinpcb, first = 0; } xladdr = (struct xsctp_laddr *)(buf + *offset); - if (Lflag && !is_listening) { + if ((!aflag && is_listening) || + (Lflag && !is_listening)) { sctp_skip_xinpcb_ifneed(buf, buflen, offset); return; } @@ -513,8 +514,10 @@ retry: xo_open_instance("local-address"); if (xladdr_total == 0) { - xo_emit("{:protocol/%-6.6s/%s} {:type/%-5.5s/%s} ", - pname, tname); + if (!Lflag) { + xo_emit("{:protocol/%-6.6s/%s} " + "{:type/%-5.5s/%s} ", pname, tname); + } } else { xo_emit("\n"); xo_emit(Lflag ? "{P:/%-21.21s} " : "{P:/%-12.12s} ",