[openbeosnetteam] Re: route show, problem found

> > Here is the problem with the 'route show' command:
> > 
> > Endless loops are encountered in the file route.c in the function 
> > char 
> > *netname(sa).  They occur in the two while() loops (approx. lines
> > 524 and 534).  The value of 'mask' gets shifted to 0, and the exit 
> > conditions of these loops are never met.  This is the case on my 
> > 192.168.0.0 network, I can't vouch for behavior of any other 
> > subnets.  A 
> > 'fix' that worked temporarily is to change the exit conditons of 
> > both 
> > loops to be:
> > while(mask > 0).  This produced correct output for me.  
> > 
> > Can some who is more familiar with this code verify a correct fix 
> > for 
> > this?  I don't fully understand this section of the code at this 
> > point.
> 
> I think it tries to look if there is a subnetmask (192.168.1.x 
> 192.168.2.x, etc.). We should take a look at the FreeBSD tool. Probably 
they have a working function (but only this function, better we do not 
replace the socket communication code).

Well, it's a very similar code, no suprised as our route command is a 
port of BSD one:
http://www.freebsd.org/cgi/cvsweb.cgi/src/sbin/route/route.c?rev=1.71&;
content-type=text/x-cvsweb-markup

In the first loop, we don't cast shifted mask value into a (long) like 
BSD but an (int). I don't how it could screw us, but, anyway...
I guess the issue is not really in these loops but in the values of in 
and mask variable.

> > Finally, can we get rid of (comment out by default) the printf 
> > statements in compat.c?  They relly mess up the formatting of the 
> > output 
> > for route show and other things.. It might be a good idea if we 
> > start 
> > getting some users playing with our stack that they don't by 
> > default see 
> > this type of debugging output.
> 
> Yes, that should be commented out.

Agreed.

- Philippe

--
Fortune Cookie Says:

"This is a job for BOB VIOLENCE and SCUM, the INCREDIBLY STUPID MUTANT
DOG."
                -- Bob Violence

Other related posts: