Index: code/unix/unix_net.c =================================================================== --- code/unix/unix_net.c (revision 697) +++ code/unix/unix_net.c (working copy) @@ -353,10 +353,18 @@ // Don't do a forward mapping from the hostname of the machine to the IP. The reason is that we might have obtained an IP address from DHCP and there might not be any name registered for the machine. On Mac OS X, the machine name defaults to 'localhost' and NetInfo has 127.0.0.1 listed for this name. Instead, we want to get a list of all the IP network interfaces on the machine. // This code adapted from OmniNetworking. -#define IFR_NEXT(ifr) \ - ((struct ifreq *) ((char *) (ifr) + sizeof(*(ifr)) + \ - MAX(0, (int) (ifr)->ifr_addr.sa_len - (int) sizeof((ifr)->ifr_addr)))) +#ifdef _SIZEOF_ADDR_IFREQ + // tjw: OSX 10.4 does not have sa_len + #define IFR_NEXT(ifr) \ + ((struct ifreq *) ((char *) ifr + _SIZEOF_ADDR_IFREQ(*ifr))) +#else + // tjw: assume that once upon a time some version did have sa_len + #define IFR_NEXT(ifr) \ + ((struct ifreq *) ((char *) (ifr) + sizeof(*(ifr)) + \ + MAX(0, (int) (ifr)->ifr_addr.sa_len - (int) sizeof((ifr)->ifr_addr)))) +#endif + void NET_GetLocalAddress( void ) { struct ifreq requestBuffer[MAX_IPS], *linkInterface, *inetInterface; struct ifconf ifc; @@ -365,7 +373,7 @@ int interfaceSocket; int family; - //Com_Printf("NET_GetLocalAddress: Querying for network interfaces\n"); + Com_Printf("NET_GetLocalAddress: Querying for network interfaces\n"); // Set this early so we can just return if there is an error numIP = 0; @@ -437,6 +445,7 @@ } linkInterface = IFR_NEXT(linkInterface); } + Com_Printf("NET_GetLocalAddress: DONE querying for network interfaces\n"); close(interfaceSocket); }