[PATCH] BSD: handle systems without legacy IP support

Marek Zarychta zarychtam at plan-b.pwste.edu.pl
Tue Apr 22 14:13:42 PDT 2025


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). This patch addresses 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 <zarychtam at plan-b.pwste.edu.pl>
---
 src/drivers/driver_bsd.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/drivers/driver_bsd.c b/src/drivers/driver_bsd.c
index 66155b41c..b25bcd8ae 100644
--- a/src/drivers/driver_bsd.c
+++ b/src/drivers/driver_bsd.c
@@ -1684,9 +1684,19 @@ bsd_global_init(void *ctx)
 
 	global->sock = socket(PF_INET, SOCK_DGRAM | SOCK_CLOEXEC, 0);
 	if (global->sock < 0) {
+	    if (errno == EAFNOSUPPORT) {
+		  wpa_printf(MSG_INFO, "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,
-- 
2.49.0



More information about the Hostap mailing list