(Waiting for Jeff to approve the changes in osdNetIntf.c)
After a very quick look I have these comments:
1) I think I see that the data structure for the first network interface is
skipped over (never seen) because of the following sequence of events. On
many, but not all, UNIX-like systems the first interface might be the
loopback interface. That might explain why this hasn't been observed to be a
problem?
O pIfreqList = (struct ifreq *) calloc ( nelem, sizeof(*pifreq) );
O the ioctl copies the struct ifreq data structures to pIfreqList
O pifreq = pIfreqList; //the for loop initializer
O pnextifreq = ifreqNext (pifreq);
O // oops! skipped over the first network interface
O memmove(pIfreqList, pnextifreq, current_ifreqsize);
O use pIfreqList to look at the current struct ifreq
O pifreq = pnextifreq //for loop increment
2) Do we need the same type of changes also in osiLocalAddr?
3) At line 120 this code was added. Similar code is also at line 43. Perhaps
this code could be repackaged into a common function - a wrapper for the osd
ifreq_size() with the goal being that the wrapper is the only caller of OSD
ifreq_size()? Otherwise we could move this code into OSD ifreq_size() but
that would probably be a less fault tolerant approach (mistakes made by a
programmers porting to new os are what we might be concerned about).
if ( current_ifreqsize < sizeof ( *pifreq ) ) {
current_ifreqsize = sizeof ( *pifreq );
}
Jeff