From nobody Fri Sep 5 19:03:37 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4cJQjj46nwz66G08; Fri, 05 Sep 2025 19:03:37 +0000 (UTC) (envelope-from git@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 "R12" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4cJQjj3LwMz3PY3; Fri, 05 Sep 2025 19:03:37 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1757099017; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=xScRZs1JUT263FgPo/mqK4ctW+eF1eGwDfaqUu/QSmg=; b=ct1x+KGUslII/aPljBkQVJHVPOTUAYZJ9yhY7aV6H7w8H+3C5EvP+NApgLDEyUCnt5CA75 4QFtE7q51BxXcf6HIqHYLz0U+nKnghL1ivaWwGEGBfR3DeU7N6KmN37QQPb7fEKzpoemRF kq7rvzlvXgyH93h+3I83t9G8jCt3iIavFEjC4tqyYBux3S3VFPDNhFfQhPeP5yQbd7hs4R c+cxMae9HmAI/rnAa6plyObSY9oLIiXgTAOrzjZ9FS2skvvjPRy29iDXUm/QEzBUAODIUw SttOJdoLVD2qGFU/xB6NPP2VDt4vFmmpiDmo1SrXSsMQma7K2Ql+eOXGkvc4+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1757099017; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=xScRZs1JUT263FgPo/mqK4ctW+eF1eGwDfaqUu/QSmg=; b=VCgvXKO8v9C5CvbakDfZKGevEbGxvl1qMMsfND5Ym1KP4JpsMbBMduqJZFxCLsinGPEZxb NpoI6JSKpe1tfGesop0FzS3UL2FxRMd4v0G3JBLl6X7CqOySRqu003HMJGOjqCZ+Fi3Phw 4cFGLAYADIX0IjNCLOyWBMUceOSmJYTWS6JzcAuGaMCxd0tybAsXFE6S2eVB0I3S8OCuD4 21X5XDGB/OLC2140oTmFBzLEBrw+9pEbE6aeWU11KdAgpZp/Uk3wAwDNFSnxUtF2enR7um OSIOL7Kae1VIIkrQvib24p9Cu8gLo9gzlnf+tlSWriv4n6VjhcbSmc2mlnxYPg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1757099017; a=rsa-sha256; cv=none; b=vgvvHckgGmOmYrcCOs+8Eis0FheoX31L3ueNZydsZ1bIFtB/lgH//uIbJ6vpW913ZU7eLR qzNothfGZXRC2cBQ+6KCZxSCyYaMZAE7+/LrBfqv2ka/V3omi2D853eOnNuEOpsINyQBCd Yy12NE3inAInOGvlUkX8CWNhOkBAxHe9hQOpa4S+Y8gnSboPR/rhicyLM4ws6cjybtVfmQ dYGZR2vaGSPqMX0t4HusKmMu+bcasqgNpsI6x3g2gs0a/lIeV8hBBZW29u5wSDpALNZ3vX cPITV112zGga5qxqdpHPXEvD4SO2N6wGc99HQchNVY+1m+MXRmzbA+r05+9Ppg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4cJQjj2qQWz11lN; Fri, 05 Sep 2025 19:03:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 585J3beg036784; Fri, 5 Sep 2025 19:03:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 585J3bRS036781; Fri, 5 Sep 2025 19:03:37 GMT (envelope-from git) Date: Fri, 5 Sep 2025 19:03:37 GMT Message-Id: <202509051903.585J3bRS036781@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Michael Tuexen Subject: git: fd86cd7a7f49 - stable/14 - netstat: report undelivered multi and broadcast UDP packets correctly List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: fd86cd7a7f499358f4402e9963529e3637b508ed Auto-Submitted: auto-generated The branch stable/14 has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=fd86cd7a7f499358f4402e9963529e3637b508ed commit fd86cd7a7f499358f4402e9963529e3637b508ed Author: Michael Tuexen AuthorDate: 2025-08-13 06:57:04 +0000 Commit: Michael Tuexen CommitDate: 2025-09-05 19:02:52 +0000 netstat: report undelivered multi and broadcast UDP packets correctly When reporting undelivered broadcast/multicast datagrams, don't just report the undelivered broadcast ones. Actually report the sum of both. Alternatively, one could also report broadcast and multicast datagrams separately, but that would change the output format of netstat. While there, use the correct type for casting a variable printed with %ju. Reviewed by: cc Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D51881 (cherry picked from commit 2b068d35de84975ea4b04a19413786663a51dc70) --- usr.bin/netstat/inet.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/usr.bin/netstat/inet.c b/usr.bin/netstat/inet.c index 93ce8fd59cb7..363224d5f913 100644 --- a/usr.bin/netstat/inet.c +++ b/usr.bin/netstat/inet.c @@ -905,7 +905,7 @@ void udp_stats(u_long off, const char *name, int af1 __unused, int proto __unused) { struct udpstat udpstat; - uint64_t delivered; + uint64_t delivered, noportbmcast; #ifdef INET6 if (udp_done != 0) @@ -938,8 +938,11 @@ udp_stats(u_long off, const char *name, int af1 __unused, int proto __unused) "{N:/with no checksum}\n"); p1a(udps_noport, "{:dropped-no-socket/%ju} " "{N:/dropped due to no socket}\n"); - p(udps_noportbcast, "{:dropped-broadcast-multicast/%ju} " - "{N:/broadcast\\/multicast datagram%s undelivered}\n"); + noportbmcast = udpstat.udps_noportmcast + udpstat.udps_noportbcast; + if (noportbmcast || sflag <= 1) + xo_emit("\t{:dropped-broadcast-multicast/%ju} " + "{N:/broadcast\\/multicast datagram%s undelivered}\n", + (uintmax_t)noportbmcast, plural(noportbmcast)); p1a(udps_fullsock, "{:dropped-full-socket-buffer/%ju} " "{N:/dropped due to full socket buffers}\n"); p1a(udpps_pcbhashmiss, "{:not-for-hashed-pcb/%ju} " @@ -952,7 +955,7 @@ udp_stats(u_long off, const char *name, int af1 __unused, int proto __unused) udpstat.udps_fullsock; if (delivered || sflag <= 1) xo_emit("\t{:delivered-packets/%ju} {N:/delivered}\n", - delivered); + (uintmax_t)delivered); p(udps_opackets, "{:output-packets/%ju} {N:/datagram%s output}\n"); /* the next statistic is cumulative in udps_noportbcast */ p(udps_filtermcast, "{:multicast-source-filter-matches/%ju} "