mirror of
https://git.freebsd.org/src.git
synced 2026-01-16 23:02:24 +00:00
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. MFC after: 1 month Reviewers: tuexen Differential Revision: https://reviews.freebsd.org/D32720
This commit is contained in:
parent
64acb29b7d
commit
a2e7dfca86
1 changed files with 5 additions and 17 deletions
|
|
@ -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, "*");
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue