git: 6aeec6a74197 - main - wpa_supplicant: Use PF_LOCAL instead of PF_INET*

From: Cy Schubert <cy_at_FreeBSD.org>
Date: Mon, 28 Apr 2025 17:58:24 UTC
The branch main has been updated by cy:

URL: https://cgit.FreeBSD.org/src/commit/?id=6aeec6a741975143f53feabceb1726d5033aafd6

commit 6aeec6a741975143f53feabceb1726d5033aafd6
Author:     Cy Schubert <cy@FreeBSD.org>
AuthorDate: 2025-04-28 01:16:37 +0000
Commit:     Cy Schubert <cy@FreeBSD.org>
CommitDate: 2025-04-28 17:19:50 +0000

    wpa_supplicant: Use PF_LOCAL instead of PF_INET*
    
    Using a local socket circumvents the issue of needing any Internet
    protocol (PF_INET or PF_INET6) support.
    We only use interface ("i" group) ioctls on this socket so we can get
    away with using PF_LOCAL instead of requring any Internet protocol
    (PF_INET or PF_INET6) support on the system. This simplifies the
    patch from 8c7149c73f8f.
    
    PR:                             286259
    Noted by:                       kevans
    Fixes:                          8c7149c73f8f
    MFC after:                      2 weeks
    Reviewed by:                    kevans, philip,
                                    zarychtam_plan-b.pwste.edu.pl (mzar)
    Differential revision:          https://reviews.freebsd.org/D50050
---
 contrib/wpa/src/drivers/driver_bsd.c | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)

diff --git a/contrib/wpa/src/drivers/driver_bsd.c b/contrib/wpa/src/drivers/driver_bsd.c
index d23d720789f9..3c1ff1b88044 100644
--- a/contrib/wpa/src/drivers/driver_bsd.c
+++ b/contrib/wpa/src/drivers/driver_bsd.c
@@ -1798,21 +1798,11 @@ bsd_global_init(void *ctx)
 	global->ctx = ctx;
 	dl_list_init(&global->ifaces);
 
-	global->sock = socket(PF_INET, SOCK_DGRAM | SOCK_CLOEXEC, 0);
+	global->sock = socket(PF_LOCAL, 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",
+		wpa_printf(MSG_ERROR, "socket[PF_LOCAL,SOCK_DGRAM]: %s",
 			   strerror(errno));
 		goto fail1;
-	    }
 	}
 
 	global->route = socket(PF_ROUTE,