From nobody Tue Nov 26 14:57:05 2024 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 4XyQds6wQ6z5fZ6Y; Tue, 26 Nov 2024 14:57:05 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XyQds600nz4YjJ; Tue, 26 Nov 2024 14:57:05 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1732633025; 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=2qNfEolPu7S6+/IQW4Kvx87A5yUsyjLFb9InWHZ7urQ=; b=NJTnEX98xhRkr5fGYDqL4162ThncMz4cILPaunt5RWnZhQLjgLAWZKoO45y61zWuubnSlE hlmadIjfA7APIlGnQbHWS3DPMwmJCcFKsmGXYKaHk1REoMeKxYmGb7clLP4BE2VDxvS0PL 6djq/q2kug++mfovGwDpfGL3Dly/Q+RpRRvBOqkz8/l9Cio4hIWen0ceU87oQ2G07yOUyV gOKVQJvNtMnb1PFU60tgOypYzR4XseQx1AsqfrG+9X/ltXKv8pbmKb9xT2tGpb4ybqSz0e RPLDCa8U0RPgOpZ/VA8jXJxwcvgqB/z1xxKan7pBGlvYeWEO6sHzxqXRlotbkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1732633025; 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=2qNfEolPu7S6+/IQW4Kvx87A5yUsyjLFb9InWHZ7urQ=; b=gfi4tvqABrz3pwtGptScN8dA+llFLpw/zY/jDu5MyPrMg3rS1py9Ff5VtpZg6amtIeGtib xyYCgpvQlBBuT5YU7YpcrM6mGtGIzigRXi0Jz5AWn7ewFjSHAI6P8jyUlGu6EW5OtTgjiM +015BmRGUmnqx9XIcLYeGfRL2tJQlIOtU3pXYf3MjdzcUWjdmU8GA2t5rZUX25+SwDJ9xu 9nb1xqMhtgGoyqung3HMmMS34OoyWDrq6DtlfMktVt21xvcjuR8MphqXxV9Op0G5qLztbX Tdv20fQd3vDudKLpxFZ9HAhq7z9CqSblFein8/xb0rjCkq87VHMiw1ATJfFnCw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1732633025; a=rsa-sha256; cv=none; b=Tf1RCYxbzonYkEKfIewEuHAQxnwxw9ztZGU9b1OAqeiCfP2Lcx2pts43uUoXWS/m51k4QG GA0N4E8iE7/ZYPfbZpeHCFwxOwNYrERG9YsPhtLtMVBt3BUuP81jjNiH77WHr25bk0Tr0e DmAZ7W85+KiN37Xcr2JsfMvQngPi2P9vIydcDVgXbYba3OwU3TZM5iBgyWZQubmmUrFl/f QbOM330PZbTm9chKhQy0oxbEO2P0r5cZzfe8B0j2yghmmTBp/NXI1CQuOzTNonjvOENEG6 lqFc6hH4PRKqT/uZCUwqMuKyoDMcc0j01DQb8g3lu1nDIQT+SFezYEwcUzvSjQ== 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 4XyQds5YBhzV3W; Tue, 26 Nov 2024 14:57:05 +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 4AQEv595001737; Tue, 26 Nov 2024 14:57:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4AQEv5OQ001734; Tue, 26 Nov 2024 14:57:05 GMT (envelope-from git) Date: Tue, 26 Nov 2024 14:57:05 GMT Message-Id: <202411261457.4AQEv5OQ001734@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Allan Jude Subject: git: 9206c7996198 - main - usr.bin/netstat: -n should not print symbolic names 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: allanjude X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9206c79961986c2114a9a2cfccf009ac010ad259 Auto-Submitted: auto-generated The branch main has been updated by allanjude: URL: https://cgit.FreeBSD.org/src/commit/?id=9206c79961986c2114a9a2cfccf009ac010ad259 commit 9206c79961986c2114a9a2cfccf009ac010ad259 Author: Allan Jude AuthorDate: 2024-11-26 14:54:04 +0000 Commit: Allan Jude CommitDate: 2024-11-26 14:56:21 +0000 usr.bin/netstat: -n should not print symbolic names In numeric mode, the default route is printed as "default" rather than 0.0.0.0/0 or ::/0 From the man page: "-n: Show network addresses and ports as numbers. Normally netstat attempts to resolve addresses and ports, and display them symbolically. If the -n option is specified, the address is printed numerically, according to the address family. For more information regarding the Internet IPv4 ``dot format'', refer to inet(3). Unspecified, or `wildcard'', addresses and ports appear as `*''." Reported By: rgrimes Reviewed by: emaste, ngie, eadler, seanc Relnotes: yes Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D10320 --- usr.bin/netstat/route.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/usr.bin/netstat/route.c b/usr.bin/netstat/route.c index 74797e2addb8..c54b1e61aa11 100644 --- a/usr.bin/netstat/route.c +++ b/usr.bin/netstat/route.c @@ -578,7 +578,7 @@ netname4(in_addr_t in, in_addr_t mask) struct netent *np = 0; in_addr_t i; - if (in == INADDR_ANY && mask == 0) { + if (!numeric_addr && in == INADDR_ANY && mask == 0) { strlcpy(line, "default", sizeof(line)); return (line); } @@ -673,7 +673,8 @@ netname6(struct sockaddr_in6 *sa6, struct sockaddr_in6 *mask) else masklen = 128; - if (masklen == 0 && IN6_IS_ADDR_UNSPECIFIED(&sa6->sin6_addr)) + if (!numeric_addr && masklen == 0 && + IN6_IS_ADDR_UNSPECIFIED(&sa6->sin6_addr)) return("default"); getnameinfo((struct sockaddr *)sa6, sa6->sin6_len, nline, sizeof(nline),