Subject: bin/5160: netstat -r with non-8bit boundary netmask
To: None <gnats-bugs@gnats.netbsd.org>
From: None <msaitoh@spa.is.uec.ac.jp>
List: netbsd-bugs
Date: 03/13/1998 16:16:42
>Number:         5160
>Category:       bin
>Synopsis:       netstat -r with non-8bit boundary netmask
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Mar 13 08:20:00 1998
>Last-Modified:
>Originator:     SAITOH Masanobu
>Organization:
>Release:        NetBSD 1.3B (sorry, I'm very busy ... )
>Environment:
System: NetBSD ifree.spa.is.uec.ac.jp 1.3B NetBSD 1.3B (IFREE) #62: Thu Jan 29 04:55:23 JST 1998 msaitoh@ifree.spa.is.uec.ac.jp:/var/sources/src/sys/arch/i386/compile/IFREE i386


>Description:
	On networks which have non-8bit boundary, "netstat -r" queries
	incorrect address to name server.

	For example, "getnetbyaddr( <<10/9 network address>>, AF_INET)"
	queries not "0.0.0.20.in-addr.arpa" instead of "0.0.0.10.in-addr.arpa".
	Perhaps, this query is sent to the root server.

>How-To-Repeat:
	Set a network to 10.128/9 or 192.168.1.128/25 and try "netstat -r"
	and monitor the query with "ndc trace".
>Fix:
	Apply following patch:

*** /var/spool/ftp/pub/NetBSD/NetBSD-current/src/usr.bin/netstat/route.c	Tue Jan 13 23:52:30 1998
--- route.c	Sat Mar 14 00:58:13 1998
***************
*** 639,646 ****
  				mask = (long)mask >> subnetshift;
  		}
  		net = i & mask;
- 		while ((mask & 1) == 0)
- 			mask >>= 1, net >>= 1;
  		np = getnetbyaddr(net, AF_INET);
  		if (np)
  			cp = np->n_name;
--- 639,644 ----

>Audit-Trail:
>Unformatted: