From owner-cvs-all Sat Jan 8 1:56:59 2000 Delivered-To: cvs-all@freebsd.org Received: from gndrsh.dnsmgr.net (GndRsh.dnsmgr.net [198.145.92.4]) by hub.freebsd.org (Postfix) with ESMTP id 0B060158AE; Sat, 8 Jan 2000 01:56:51 -0800 (PST) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: (from freebsd@localhost) by gndrsh.dnsmgr.net (8.9.3/8.9.3) id BAA14616; Sat, 8 Jan 2000 01:56:43 -0800 (PST) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <200001080956.BAA14616@gndrsh.dnsmgr.net> Subject: Re: Small patch to netstat/route.c for review In-Reply-To: <200001072014.UAA00390@hak.lan.Awfulhak.org> from Brian Somers at "Jan 7, 2000 08:14:48 pm" To: brian@Awfulhak.org (Brian Somers) Date: Sat, 8 Jan 2000 01:56:42 -0800 (PST) Cc: brian@FreeBSD.org (Brian Somers), cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org, brian@hak.lan.Awfulhak.org X-Mailer: ELM [version 2.4ME+ PL54 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk > > Index: route.c > > =================================================================== > > RCS file: /home/ncvs/src/usr.bin/netstat/route.c,v > > retrieving revision 1.40 > > diff -u -r1.40 route.c > > --- route.c 1999/12/28 02:37:02 1.40 > > +++ route.c 2000/01/07 03:34:22 > > @@ -434,8 +434,11 @@ > > { > > register struct sockaddr_in *sin = (struct sockaddr_in *)sa; > > > > - if (sin->sin_addr.s_addr == INADDR_ANY) > > - cp = "default"; > > + if ((sin->sin_addr.s_addr == INADDR_ANY) && > > + mask && > > + ntohl(((struct sockaddr_in *)mask)->sin_addr.s_addr) > > + ==0L) > > + cp = "default" ; > > else if (flags & RTF_HOST) > > cp = routename(sin->sin_addr.s_addr); > > else if (mask) > > Hmm, I'd tend to ignore the sin_addr value. Surely if the mask is > zero, the route is default. Unless I am miss reading the code, if the mask is nul (it is a pointer) then no netmask has been applied and the route has it's classful netmask, which makes the route a 0/8, quite a long ways from 0/0 or true default. As an example: Internet: Destination Gateway Flags Netif Expire 0 198.145.92.1 UGSc de0 => default 127.0.0.1 UGSc lo0 That first route is 0 without a netmask, and hence 0/8, and hence not the same as the route second route which is explicitly 0/0. -- Rod Grimes - KD7CAX @ CN85sl - (RWG25) rgrimes@gndrsh.dnsmgr.net To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message