From owner-svn-src-stable@freebsd.org Thu Oct 1 16:18:50 2020 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8997442CB80; Thu, 1 Oct 2020 16:18:50 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4C2JGL389Vz4LVL; Thu, 1 Oct 2020 16:18:50 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5009313A85; Thu, 1 Oct 2020 16:18:50 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 091GIoNn018449; Thu, 1 Oct 2020 16:18:50 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 091GInN3018444; Thu, 1 Oct 2020 16:18:49 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202010011618.091GInN3018444@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Thu, 1 Oct 2020 16:18:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r366322 - stable/12/usr.bin/netstat X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/usr.bin/netstat X-SVN-Commit-Revision: 366322 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Oct 2020 16:18:50 -0000 Author: tuexen Date: Thu Oct 1 16:18:49 2020 New Revision: 366322 URL: https://svnweb.freebsd.org/changeset/base/366322 Log: MFC r365688: Add a -C option to netstat to display the congestion control for TCP connections. Modified: stable/12/usr.bin/netstat/inet.c stable/12/usr.bin/netstat/main.c stable/12/usr.bin/netstat/netstat.1 stable/12/usr.bin/netstat/netstat.h Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.bin/netstat/inet.c ============================================================================== --- stable/12/usr.bin/netstat/inet.c Thu Oct 1 16:14:00 2020 (r366321) +++ stable/12/usr.bin/netstat/inet.c Thu Oct 1 16:18:49 2020 (r366322) @@ -341,6 +341,9 @@ protopr(u_long off, const char *name, int af1, int pro xo_emit(" {T:/%8.8s} {T:/%5.5s}", "flowid", "ftype"); } + if (Cflag) + xo_emit(" {T:/%-*.*s}", TCP_CA_NAME_MAX, + TCP_CA_NAME_MAX, "CC"); if (Pflag) xo_emit(" {T:/%s}", "Log ID"); xo_emit("\n"); @@ -514,9 +517,15 @@ protopr(u_long off, const char *name, int af1, int pro inp->inp_flowid, inp->inp_flowtype); } - if (istcp && Pflag) - xo_emit(" {:log-id/%s}", tp->xt_logid[0] == '\0' ? - "-" : tp->xt_logid); + if (istcp) { + if (Cflag) + xo_emit(" {:cc/%-*.*s}", TCP_CA_NAME_MAX, + TCP_CA_NAME_MAX, tp->xt_cc); + if (Pflag) + xo_emit(" {:log-id/%s}", + tp->xt_logid[0] == '\0' ? + "-" : tp->xt_logid); + } xo_emit("\n"); xo_close_instance("socket"); } Modified: stable/12/usr.bin/netstat/main.c ============================================================================== --- stable/12/usr.bin/netstat/main.c Thu Oct 1 16:14:00 2020 (r366321) +++ stable/12/usr.bin/netstat/main.c Thu Oct 1 16:18:49 2020 (r366322) @@ -205,6 +205,7 @@ int Aflag; /* show addresses of protocol control bloc int aflag; /* show all sockets (including servers) */ static int Bflag; /* show information about bpf consumers */ int bflag; /* show i/f total bytes in/out */ +int Cflag; /* show congestion control */ int dflag; /* show i/f dropped packets */ int gflag; /* show group (multicast) routing or stats */ int hflag; /* show counters in human readable format */ @@ -248,7 +249,7 @@ main(int argc, char *argv[]) if (argc < 0) exit(EXIT_FAILURE); - while ((ch = getopt(argc, argv, "46AaBbdF:f:ghI:iLlM:mN:nPp:Qq:RrSTsuWw:xz")) + while ((ch = getopt(argc, argv, "46AaBbCdF:f:ghI:iLlM:mN:nPp:Qq:RrSTsuWw:xz")) != -1) switch(ch) { case '4': @@ -277,6 +278,9 @@ main(int argc, char *argv[]) case 'b': bflag = 1; break; + case 'C': + Cflag = 1; + break; case 'd': dflag = 1; break; @@ -721,7 +725,7 @@ kset_dpcpu(u_int cpuid) if (kvm_dpcpu_setcpu(kvmd, cpuid) < 0) xo_errx(-1, "%s: kvm_dpcpu_setcpu(%u): %s", __func__, - cpuid, kvm_geterr(kvmd)); + cpuid, kvm_geterr(kvmd)); return; } Modified: stable/12/usr.bin/netstat/netstat.1 ============================================================================== --- stable/12/usr.bin/netstat/netstat.1 Thu Oct 1 16:14:00 2020 (r366321) +++ stable/12/usr.bin/netstat/netstat.1 Thu Oct 1 16:18:49 2020 (r366322) @@ -28,7 +28,7 @@ .\" @(#)netstat.1 8.8 (Berkeley) 4/18/94 .\" $FreeBSD$ .\" -.Dd March 22, 2018 +.Dd September 13, 2020 .Dt NETSTAT 1 .Os .Sh NAME @@ -39,7 +39,7 @@ .Bl -tag -width "netstat" .It Nm .Op Fl -libxo -.Op Fl 46AaLnPRSTWx +.Op Fl 46AaCLnPRSTWx .Op Fl f Ar protocol_family | Fl p Ar protocol .Op Fl M Ar core .Op Fl N Ar system @@ -111,7 +111,7 @@ depending on the options for the information presented .It Xo .Bk -words .Nm -.Op Fl 46AaLnRSTWx +.Op Fl 46AaCLnRSTWx .Op Fl f Ar protocol_family | Fl p Ar protocol .Op Fl M Ar core .Op Fl N Ar system @@ -172,6 +172,8 @@ associated with a socket; used for debugging. .It Fl a Show the state of all sockets; normally sockets used by server processes are not shown. +.It Fl C +Show the congestion control of TCP sockets. .It Fl L Show the size of the various listen queues. The first count shows the number of unaccepted connections, Modified: stable/12/usr.bin/netstat/netstat.h ============================================================================== --- stable/12/usr.bin/netstat/netstat.h Thu Oct 1 16:14:00 2020 (r366321) +++ stable/12/usr.bin/netstat/netstat.h Thu Oct 1 16:18:49 2020 (r366322) @@ -41,6 +41,7 @@ extern int Aflag; /* show addresses of protocol control block */ extern int aflag; /* show all sockets (including servers) */ extern int bflag; /* show i/f total bytes in/out */ +extern int Cflag; /* show congestion control */ extern int dflag; /* show i/f dropped packets */ extern int gflag; /* show group (multicast) routing or stats */ extern int hflag; /* show counters in human readable format */