New interfaces.c hangs on OS X

James Peach jpeach at apple.com
Tue Oct 16 15:50:01 GMT 2007


On Oct 16, 2007, at 8:30 AM, Gerald (Jerry) Carter wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Jeremy,
>
> The new interfaces.c code hangs during configure on OS X at
>
> 	checking for iface AIX...
>
> The problem is this block of code starting at line 394:
>
> while (i > 0 && total < max_interfaces) {
>  ....
>  if (ifaces[total].flags & IFF_BROADCAST) {
>    if (ioctl(fd, SIOCGIFBRDADDR, &ifr[i]) != 0) {
>      continue;
>    }
>    memcpy(&ifaces[total].bcast, &ifr[i].ifr_broadaddr,
>           sizeof(struct sockaddr_in));

This code is wrong for *BSD. The structures in the array are not fixed  
size. You need to use the _SIZEOF_ADDR_IFREQ macro to figure out the  
size of each element. I have a pending patch that corrects this code.

Once you do this, it will work, but the preferred API on OS X is  
getifaddrs(3) anyway.

--
James Peach | jpeach at apple.com





More information about the samba-technical mailing list