[prev in list] [next in list] [prev in thread] [next in thread] 

List:       tcpdump-workers
Subject:    Re: [tcpdump-workers] [Fwd: bug repourt:libpacp:fad-gifc.c:pcap_findalldevs]
From:       Guy Harris <guy () alum ! mit ! edu>
Date:       2005-06-29 6:45:48
Message-ID: 42C2439C.107 () alum ! mit ! edu
[Download RAW message or body]

Guy Harris wrote:

> This means that, unless I've missed something, the *only* ways to ensure 
> you have the entire list are either to loop, increasing the size of the 
> buffer, until the difference between the buffer size and the number of 
> bytes of interface information returned is less than the maximum size of 
> an interface entry (at least on some BSDs, that's the maximum of "sizeof 
> (struct ifreq") and the sum of the size of the "ifr_name" field of that 
> structure and the largest possible value returned by the SA_LEN() macro, 
> or to loop until the number of bytes returned doesn't change.

"Loop until the number of bytes returned doesn't change" works only if 
the buffer increased in size by more than the largest possible entry.

Given that, we have to know that size anyway, so I've just assumed that 
the maximum address size is 255 bytes, and checked in a change to loop 
until at least enough room for a maximum size entry is left.
-
This is the tcpdump-workers list.
Visit https://lists.sandelman.ca/ to unsubscribe.
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic