From nobody Fri Dec 10 16:29:17 2021 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 8215818D6D90; Fri, 10 Dec 2021 16:29:20 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4J9bvf5S95z3F1l; Fri, 10 Dec 2021 16:29:18 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 C1F7C1D36F; Fri, 10 Dec 2021 16:29:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1BAGTH0C077059; Fri, 10 Dec 2021 16:29:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1BAGTHcK077058; Fri, 10 Dec 2021 16:29:17 GMT (envelope-from git) Date: Fri, 10 Dec 2021 16:29:17 GMT Message-Id: <202112101629.1BAGTHcK077058@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mike Karels Subject: git: c7444d9cb3a9 - stable/13 - systat: clean up code assuming network classes 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: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: karels X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: c7444d9cb3a9cf7ea855a49884e7fb74490e8f9c Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1639153759; 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=iekPNJW1isVXrut2ZVCEsnZaPLWElZQB36jVTjAC9Lk=; b=KYq79RpjpIAkNvhwG4LM0ifwOjUHvvWJ7a9z4gp7ic0WptnLlbUaRKX+n5VLi5ARpHZSFo Hu2kIqSGS8u95AI3fN9nYusS8L2cakbCaVQvJXoCGfWHnbtNGnoZSX8TuN9zJZXrfR+RCe RWtyGRut4D80D5otG7ucnEANC8XRMG8mPWVxtZUKvYLsaq0JtG5Ifg7ORyr9X7MyyCY8y6 wK0U+DUoPNh7l1wO+w1i/H0CPwTpGJyqxYIeEeemGherwZ/OO2Zr5AANUqrIaGYlD8WSM7 SoSiuZyoSxrizXkuvB5mmSUQv7CQE2j+3vI1ajDJAQuCOMmRHNVqf9ZPq0wxBg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1639153759; a=rsa-sha256; cv=none; b=JoGJ7UVFhtegIcmU13SzDgS6psVB2SM5FDi70kIx1e1zl+XxmvcTNAPizKa5biNsJN/3i7 ZhqNOYdyP4impleFlNScLhwdd2kSKc3uXIrYNCY/zIE06AFamO/1fnUhqsu63e+jCOUBNb IDh9dZE0BEZoRL/zzn4+FkwwtvNpdbHP2LV0jrSuIOQmuSI19BUzanJ2ErlBfi62utH8ZB CobDuE84PuCLABXP4meKE19lL33+V0DqqtBOLh9ifEax4IsdswYCBgXCfVR9FFl0d+UYyV 018dKu1SxRNwx3c4qjRQ3DKXbYrkvFAiw/ued/TsHl2yDl3nLseYhr81y29rSA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by karels: URL: https://cgit.FreeBSD.org/src/commit/?id=c7444d9cb3a9cf7ea855a49884e7fb74490e8f9c commit c7444d9cb3a9cf7ea855a49884e7fb74490e8f9c Author: Mike Karels AuthorDate: 2021-10-28 23:39:43 +0000 Commit: Mike Karels CommitDate: 2021-12-10 16:27:44 +0000 systat: clean up code assuming network classes Similar to netstat, clean up code that uses inet_lnaof() to check for binding to "host 0" (lowest host on network) as a "network" bind. Such things don't happen, and current networks are seldom if ever found in /etc/networks. (cherry picked from commit a2e7dfca86497e535039a42cfc44cfc48209abf5) --- usr.bin/systat/netstat.c | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/usr.bin/systat/netstat.c b/usr.bin/systat/netstat.c index a334e03beb5a..a9487c4dcc9d 100644 --- a/usr.bin/systat/netstat.c +++ b/usr.bin/systat/netstat.c @@ -206,7 +206,7 @@ again: next = &inpcb; if (!aflag) { if (inpcb.inp_vflag & INP_IPV4) { - if (inet_lnaof(inpcb.inp_laddr) == INADDR_ANY) + if (inpcb.inp_laddr.s_addr == INADDR_ANY) continue; } #ifdef INET6 @@ -303,8 +303,7 @@ fetchnetstat_sysctl(void) if (!aflag) { if (xip->inp_vflag & INP_IPV4) { - if (inet_lnaof(xip->inp_laddr) == - INADDR_ANY) + if (xip->inp_laddr.s_addr == INADDR_ANY) continue; } #ifdef INET6 @@ -584,7 +583,6 @@ inetname(struct sockaddr *sa) char *cp = 0; static char line[NI_MAXHOST]; struct hostent *hp; - struct netent *np; struct in_addr in; #ifdef INET6 @@ -601,19 +599,9 @@ inetname(struct sockaddr *sa) in = ((struct sockaddr_in *)sa)->sin_addr; if (!nflag && in.s_addr != INADDR_ANY) { - int net = inet_netof(in); - int lna = inet_lnaof(in); - - if (lna == INADDR_ANY) { - np = getnetbyaddr(net, AF_INET); - if (np) - cp = np->n_name; - } - if (cp == NULL) { - hp = gethostbyaddr((char *)&in, sizeof (in), AF_INET); - if (hp) - cp = hp->h_name; - } + hp = gethostbyaddr((char *)&in, sizeof (in), AF_INET); + if (hp) + cp = hp->h_name; } if (in.s_addr == INADDR_ANY) strcpy(line, "*");