@@ -27,10 +27,23 @@ # include #endif #if defined(OF_MACOS) || defined(OF_IOS) || defined(OF_NETBSD) # include #endif + +#ifdef HAVE_IFADDRS_H +# include +#endif +#ifdef HAVE_NET_IF_TYPES_H +# include +#endif +#ifdef HAVE_NET_IF_DL_H +# include +#endif +#ifdef HAVE_NETPACKET_PACKET_H +# include +#endif #ifdef OF_AMIGAOS # define Class IntuitionClass # include # include @@ -83,17 +96,10 @@ #if !defined(PATH_MAX) && defined(MAX_PATH) # define PATH_MAX MAX_PATH #endif -#ifdef HAVE_IFADDRS_H -# include -#endif -#ifdef HAVE_NETPACKET_PACKET_H -# include -#endif - #if defined(OF_MACOS) || defined(OF_IOS) /* * These have been dropped from newer iOS SDKs, however, their replacements are * not available on iOS < 10. This means it's impossible to search for the * paths when using a new SDK while targeting iOS 9 or earlier. To work around @@ -926,10 +932,28 @@ addr = [OFData dataWithItems: sll->sll_addr count: sll->sll_halen]; [interface setObject: addr forKey: key]; continue; } +# endif +# if defined(HAVE_STRUCT_SOCKADDR_DL) && defined(AF_LINK) && \ + defined(IFT_ETHER) && defined(LLADDR) + if (iter->ifa_addr->sa_family == AF_LINK) { + const OFNetworkInterfaceInfoKey key = + OFNetworkInterfaceEthernetAddress; + struct sockaddr_dl *sdl = (struct sockaddr_dl *) + (void *)iter->ifa_addr; + OFData *addr; + + if (sdl->sdl_type != IFT_ETHER) + continue; + + addr = [OFData dataWithItems: LLADDR(sdl) + count: sdl->sdl_alen]; + [interface setObject: addr forKey: key]; + continue; + } # endif addresses = [interface objectForKey: OFNetworkInterfaceAddresses]; if (addresses == nil) {