[FreeBSD-6.1Release]bug in netstat?

Blue Susan.Lan at zyxel.com.tw
Thu Jul 13 10:13:28 UTC 2006


Hi, all:

  I have a few questions aout sidewaysintpr() in netstat\if.c. Why needs 
to allocate a list of struct iftot, and it's number is equal to the 
number of interfaces? I have traced the codes and found there's no 
special usage of the struct iftot list. Besides, the list of malloc 
space is never freed. Another problem is in line 667-669

        for (off = firstifnet, ip = iftot;
             off && SLIST_NEXT(ip, chain) != NULL;
             ip = SLIST_NEXT(ip, chain)) {
                ....................
        }

The codes above will not count in the last interface in the ifnet list. 
I think the statement should be:
       
        for (off = firstifnet, ip = iftot;
             off && ip;
             ip = SLIST_NEXT(ip, chain)) {
                ....................
        }
 
Though the iftot list is supposed to be removed in my point of view.

Could anyone give me any reason or hints?

Best regards,

blue


More information about the freebsd-bugs mailing list