diff mbox series

BSD: handle systems without legacy IP support

Message ID 202504221832.53MIWGd4060308@plan-b.pwste.edu.pl
State New
Headers show
Series BSD: handle systems without legacy IP support | expand

Commit Message

Marek Zarychta April 22, 2025, 4:25 p.m. UTC
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@plan-b.pwste.edu.pl>
---
 src/drivers/driver_bsd.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
diff mbox series

Patch

diff --git a/src/drivers/driver_bsd.c b/src/drivers/driver_bsd.c
index 66155b41c..3ca5ae478 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 || errno == EPROTONOSUPPORT) {
+	    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,