Date: Sat, 8 Jan 2000 01:56:42 -0800 (PST) From: "Rodney W. Grimes" <freebsd@gndrsh.dnsmgr.net> To: brian@Awfulhak.org (Brian Somers) Cc: brian@FreeBSD.org (Brian Somers), cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org, brian@hak.lan.Awfulhak.org Subject: Re: Small patch to netstat/route.c for review Message-ID: <200001080956.BAA14616@gndrsh.dnsmgr.net> In-Reply-To: <200001072014.UAA00390@hak.lan.Awfulhak.org> from Brian Somers at "Jan 7, 2000 08:14:48 pm"
next in thread | previous in thread | raw e-mail | index | archive | help
> > 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200001080956.BAA14616>