[openbeosnetteam] Re: route show, problem found

Hi Brennan,
it's cool that you found the bug!

> 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).

> 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.

Waldemar

Other related posts: