]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
BSD: Handle systems without legacy IP support
authorMarek Zarychta <zarychtam@plan-b.pwste.edu.pl>
Tue, 22 Apr 2025 21:13:42 +0000 (23:13 +0200)
committerJouni Malinen <j@w1.fi>
Thu, 19 Jun 2025 09:23:58 +0000 (12:23 +0300)
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 <zarychtam@plan-b.pwste.edu.pl>
src/drivers/driver_bsd.c

index 8e4c0390fd8e07ad02da9eb0ff5789d3546344a6..b5d2e42f1f2fb4f142627f91b4531f1ba0b47059 100644 (file)
@@ -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,