NetBSD Problem Report #1180
From gnats Sat Jul 1 03:04:01 1995
Received: from pain.lcs.mit.edu (pain.lcs.mit.edu [128.52.46.239]) by sun-lamp.pc.cs.cmu.edu (8.6.11/8.6.10) with ESMTP id DAA12728 for <gnats-bugs@sun-lamp.cs.berkeley.edu>; Sat, 1 Jul 1995 03:04:00 -0400
Message-Id: <199507010705.QAA01662@edge.nwt.fxis.fujixerox.co.jp>
Date: Sat, 01 Jul 1995 16:05:24 +0900
From: taka@fxis.fujixerox.co.jp
Sender: taka@fxis.fujixerox.co.jp
Reply-To: taka@fxis.fujixerox.co.jp
To: gnats-bugs@netbsd.org
Subject: "netstat" displays wrong IP network address
X-Send-Pr-Version: 3.2
>Number: 1180
>Category: bin
>Synopsis: "netstat -i" displays wrong IP network address
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: bin-bug-people
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sat Jul 01 03:05:08 +0000 1995
>Closed-Date: Mon Jul 03 03:15:08 +0000 1995
>Last-Modified:
>Originator: Takahiro Kanbe
>Release: 6/24/1995 -current
>Organization:
Fuji Xerox Information Systems Co., Ltd.
>Environment:
System: NetBSD roadsky.nwt.fxis.fujixerox.co.jp 1.0A NetBSD 1.0A (ROADSKY) #3: Mon Jun 26 00:42:32 JST 1995 taka@roadsky.nwt.fxis.fujixerox.co.jp:/usr/src/sys/arch/i386/compile/ROADSKY i386
>Description:
"Netstat -i" displays wrong IP network address; incorrect
byte order. This may happen on little endian systems.
>How-To-Repeat:
% netstat -i
>Fix:
There are two problems.
1. intpr() in if.c calls netname() twice, and latter calls
extra htonl() for netnames() argument.
2. netname() in route.c expect network order IP address and
netmask. But it's ignore netmasks's byte order.
*** if.c.ORIG Tue Jun 20 19:52:30 1995
--- if.c Thu Jun 29 23:26:54 1995
***************
*** 152,159 ****
ifaddr.in.ia_subnetmask));
#else
printf("%-11.11s ",
! netname(htonl(ifaddr.in.ia_subnet),
! ifaddr.in.ia_subnetmask));
#endif
printf("%-15.15s ",
routename(sin->sin_addr.s_addr));
--- 152,159 ----
ifaddr.in.ia_subnetmask));
#else
printf("%-11.11s ",
! netname(ifaddr.in.ia_subnet,
! ifaddr.in.ia_subnetmask));
#endif
printf("%-15.15s ",
routename(sin->sin_addr.s_addr));
*** route.c.ORIG Wed Mar 29 20:15:43 1995
--- route.c Thu Jun 29 23:42:46 1995
***************
*** 514,520 ****
static char line[MAXHOSTNAMELEN + 1];
struct netent *np = 0;
u_long net;
! register int i;
int subnetshift;
i = ntohl(in);
--- 514,520 ----
static char line[MAXHOSTNAMELEN + 1];
struct netent *np = 0;
u_long net;
! register u_long i;
int subnetshift;
i = ntohl(in);
***************
*** 538,543 ****
--- 538,545 ----
*/
while (i &~ mask)
mask = (long)mask >> subnetshift;
+ } else {
+ mask = ntohl(mask);
}
net = i & mask;
while ((mask & 1) == 0)
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed
State-Changed-By: mycroft
State-Changed-When: Sun Jul 2 23:15:08 EDT 1995
State-Changed-Why:
Fixed.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.