Index: configure.ac ================================================================== --- configure.ac +++ configure.ac @@ -1761,14 +1761,21 @@ "OFSelectKernelEventObserver.m") ]) ;; esac - AC_CHECK_HEADERS(ifaddrs.h netpacket/packet.h) + AC_CHECK_HEADERS(ifaddrs.h net/if_types.h net/if_dl.h) + AC_CHECK_HEADERS(netpacket/packet.h) AC_CHECK_FUNC(getifaddrs, [ AC_DEFINE(OF_SYSTEM_INFO_HAS_NETWORK_INTERFACES, 1, [Whether OFSystemInfo has network interfaces]) + ]) + AC_CHECK_TYPES([struct sockaddr_dl], [], [], [ + #include + #ifdef HAVE_NET_IF_DL_H + # include + #endif ]) AC_CHECK_TYPES([struct sockaddr_ll], [], [], [ #ifdef HAVE_NETPACKET_PACKET_H # include #endif Index: src/OFSystemInfo.m ================================================================== --- src/OFSystemInfo.m +++ src/OFSystemInfo.m @@ -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) {