From: Marek Zarychta Date: Tue, 22 Apr 2025 21:13:42 +0000 (+0200) Subject: BSD: Handle systems without legacy IP support X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d8299da6b84886e9bedfd67c0ee25617701bba1f;p=thirdparty%2Fhostap.git BSD: Handle systems without legacy IP support Currently, wpa_supplicant fails to operate when legacy IP support is disabled (i.e., the system is built with WITHOUT_INET and the kernel is configured with nooptions INET). Address the issue by enabling wpa_supplicant to run and connect to wireless networks even in the absence of AF_INET, as long as AF_INET6 is available. Signed-off-by: Marek Zarychta --- diff --git a/src/drivers/driver_bsd.c b/src/drivers/driver_bsd.c index 8e4c0390f..b5d2e42f1 100644 --- a/src/drivers/driver_bsd.c +++ b/src/drivers/driver_bsd.c @@ -1684,9 +1684,22 @@ bsd_global_init(void *ctx) global->sock = socket(PF_INET, SOCK_DGRAM | SOCK_CLOEXEC, 0); if (global->sock < 0) { - wpa_printf(MSG_ERROR, "socket[PF_INET,SOCK_DGRAM]: %s", - strerror(errno)); - goto fail1; + if (errno == EAFNOSUPPORT) { + wpa_printf(MSG_DEBUG, + "INET not supported, trying INET6..."); + global->sock = socket(PF_INET6, + SOCK_DGRAM | SOCK_CLOEXEC, 0); + if (global->sock < 0) { + wpa_printf(MSG_ERROR, + "socket[PF_INET6,SOCK_DGRAM]: %s", + strerror(errno)); + goto fail1; + } + } else { + wpa_printf(MSG_ERROR, "socket[PF_INET,SOCK_DGRAM]: %s", + strerror(errno)); + goto fail1; + } } global->route = socket(PF_ROUTE,