Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 13 Sep 2024 23:06:23 GMT
From:      Cy Schubert <cy@FreeBSD.org>
To:        ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org
Subject:   git: 471e97cc0562 - main - net/hostapd: Sync driver_bsd.c with base system
Message-ID:  <202409132306.48DN6Nb2068234@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by cy:

URL: https://cgit.FreeBSD.org/ports/commit/?id=471e97cc05623b26579bf54748175d3202abd712

commit 471e97cc05623b26579bf54748175d3202abd712
Author:     Cy Schubert <cy@FreeBSD.org>
AuthorDate: 2024-09-13 23:04:20 +0000
Commit:     Cy Schubert <cy@FreeBSD.org>
CommitDate: 2024-09-13 23:04:20 +0000

    net/hostapd: Sync driver_bsd.c with base system
    
    Replace driver_bsd.c with the one from src. It utilizes facilities
    and features already in FreeBSD.
---
 net/hostapd/Makefile                              |  1 +
 net/hostapd/files/patch-src_drivers_driver__bsd.c | 93 +++++++++--------------
 2 files changed, 35 insertions(+), 59 deletions(-)

diff --git a/net/hostapd/Makefile b/net/hostapd/Makefile
index 800a69ace4b8..8b6b2cf48a8a 100644
--- a/net/hostapd/Makefile
+++ b/net/hostapd/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	hostapd
 PORTVERSION=	2.11
+PORTREVISION=	1
 CATEGORIES=	net
 MASTER_SITES=	https://w1.fi/releases/
 
diff --git a/net/hostapd/files/patch-src_drivers_driver__bsd.c b/net/hostapd/files/patch-src_drivers_driver__bsd.c
index 014a10354b0c..809575aeb356 100644
--- a/net/hostapd/files/patch-src_drivers_driver__bsd.c
+++ b/net/hostapd/files/patch-src_drivers_driver__bsd.c
@@ -1,5 +1,5 @@
---- src/drivers/driver_bsd.c.orig	2022-01-16 12:51:29.000000000 -0800
-+++ src/drivers/driver_bsd.c	2023-09-10 23:11:43.205866000 -0700
+--- src/drivers/driver_bsd.c.orig	2024-07-20 11:04:37.000000000 -0700
++++ src/drivers/driver_bsd.c	2024-09-13 15:39:20.543245000 -0700
 @@ -14,6 +14,7 @@
  #include "driver.h"
  #include "eloop.h"
@@ -19,10 +19,14 @@
  	struct ifreq ifr;
  
  	os_memset(&ifr, 0, sizeof(ifr));
-@@ -306,7 +308,34 @@
- 		return -1;
- 	}
- 	drv->flags = ifr.ifr_flags;
+@@ -302,10 +304,37 @@
+ 
+ 	if (ioctl(drv->global->sock, SIOCGIFFLAGS, &ifr) < 0) {
+ 		wpa_printf(MSG_ERROR, "ioctl[SIOCGIFFLAGS]: %s",
++			   strerror(errno));
++		return -1;
++	}
++	drv->flags = ifr.ifr_flags;
 +
 +
 +	if (enable) {
@@ -37,23 +41,22 @@
 +
 +	if (ioctl(drv->global->sock, SIOCSIFFLAGS, &ifr) < 0) {
 +		wpa_printf(MSG_ERROR, "ioctl[SIOCSIFFLAGS]: %s",
-+			   strerror(errno));
-+		return -1;
-+	}
+ 			   strerror(errno));
+ 		return -1;
+ 	}
 +
 +	wpa_printf(MSG_DEBUG, "%s: if %s (changed) enable %d IFF_UP %d ",
 +	    __func__, drv->ifname, enable, ((ifr.ifr_flags & IFF_UP) != 0));
 +
-+	drv->flags = ifr.ifr_flags;
- 	return 0;
+ 	drv->flags = ifr.ifr_flags;
++	return 0;
 +
 +nochange:
 +	wpa_printf(MSG_DEBUG, "%s: if %s (no change) enable %d IFF_UP %d ",
 +	    __func__, drv->ifname, enable, ((ifr.ifr_flags & IFF_UP) != 0));
-+	return 0;
+ 	return 0;
  }
  
- static int
 @@ -525,7 +554,7 @@
  			   __func__);
  		return -1;
@@ -85,7 +88,7 @@
  			wpa_printf(MSG_DEBUG, "RTM_IFINFO: Interface '%s' UP",
  				   drv->ifname);
  			wpa_supplicant_event(drv->ctx, EVENT_INTERFACE_ENABLED,
-@@ -1025,7 +1058,8 @@
+@@ -1027,7 +1060,8 @@
  	if (l2_packet_get_own_addr(drv->sock_xmit, params->own_addr))
  		goto bad;
  
@@ -95,7 +98,7 @@
  		goto bad;
  
  	if (bsd_set_mediaopt(drv, IFM_OMASK, IFM_IEEE80211_HOSTAP) < 0) {
-@@ -1050,12 +1084,13 @@
+@@ -1052,12 +1086,13 @@
  {
  	struct bsd_driver_data *drv = priv;
  
@@ -110,7 +113,7 @@
  static int
  bsd_set_sta_authorized(void *priv, const u8 *addr,
  		       unsigned int total_flags, unsigned int flags_or,
-@@ -1197,13 +1232,41 @@
+@@ -1199,13 +1234,41 @@
  }
  
  static int
@@ -153,7 +156,7 @@
  
  	wpa_printf(MSG_DEBUG,
  		"%s: ssid '%.*s' wpa ie len %u pairwise %u group %u key mgmt %u"
-@@ -1220,7 +1283,10 @@
+@@ -1222,7 +1285,10 @@
  		mode = 0 /* STA */;
  		break;
  	case IEEE80211_MODE_IBSS:
@@ -164,7 +167,7 @@
  		break;
  	case IEEE80211_MODE_AP:
  		mode = IFM_IEEE80211_HOSTAP;
-@@ -1249,24 +1315,33 @@
+@@ -1251,22 +1317,31 @@
  		ret = -1;
  	if (wpa_driver_bsd_set_auth_alg(drv, params->auth_alg) < 0)
  		ret = -1;
@@ -177,6 +180,9 @@
 -	    params->key_mgmt_suite == WPA_KEY_MGMT_NONE &&
 -	    params->wpa_ie_len == 0);
 -	wpa_printf(MSG_DEBUG, "%s: set PRIVACY %u", __func__, privacy);
+-
+-	if (set80211param(drv, IEEE80211_IOC_PRIVACY, privacy) < 0)
+-		return -1;
 +	if (params->wpa_ie_len) {
 +		rsn_ie = get_ie(params->wpa_ie, params->wpa_ie_len,
 +		    WLAN_EID_RSN);
@@ -196,7 +202,9 @@
 +		}
 +	}
  
--	if (set80211param(drv, IEEE80211_IOC_PRIVACY, privacy) < 0)
+-	if (params->wpa_ie_len &&
+-	    set80211param(drv, IEEE80211_IOC_WPA,
+-			  params->wpa_ie[0] == WLAN_EID_RSN ? 2 : 1) < 0)
 +	/*
 +	 * NB: interface must be marked UP for association
 +	 * or scanning (ap_scan=2)
@@ -204,15 +212,8 @@
 +	if (bsd_ctrl_iface(drv, 1) < 0)
  		return -1;
  
--	if (params->wpa_ie_len &&
--	    set80211param(drv, IEEE80211_IOC_WPA,
--			  params->wpa_ie[0] == WLAN_EID_RSN ? 2 : 1) < 0)
--		return -1;
--
  	os_memset(&mlme, 0, sizeof(mlme));
- 	mlme.im_op = IEEE80211_MLME_ASSOC;
- 	if (params->ssid != NULL)
-@@ -1309,11 +1384,8 @@
+@@ -1311,11 +1386,8 @@
  	}
  
  	/* NB: interface must be marked UP to do a scan */
@@ -225,33 +226,7 @@
  
  #ifdef IEEE80211_IOC_SCAN_MAX_SSID
  	os_memset(&sr, 0, sizeof(sr));
-@@ -1485,6 +1557,17 @@
- 	if (devcaps.dc_drivercaps & IEEE80211_C_WPA2)
- 		drv->capa.key_mgmt = WPA_DRIVER_CAPA_KEY_MGMT_WPA2 |
- 			WPA_DRIVER_CAPA_KEY_MGMT_WPA2_PSK;
-+#ifdef __FreeBSD__
-+	drv->capa.enc |= WPA_DRIVER_CAPA_ENC_WEP40 |
-+	    WPA_DRIVER_CAPA_ENC_WEP104 |
-+	    WPA_DRIVER_CAPA_ENC_TKIP |
-+	    WPA_DRIVER_CAPA_ENC_CCMP;
-+#else
-+	/*
-+	 * XXX
-+	 * FreeBSD exports hardware cryptocaps.  These have no meaning for wpa
-+	 * since net80211 performs software crypto.
-+	 */
- 
- 	if (devcaps.dc_cryptocaps & IEEE80211_CRYPTO_WEP)
- 		drv->capa.enc |= WPA_DRIVER_CAPA_ENC_WEP40 |
-@@ -1493,6 +1576,7 @@
- 		drv->capa.enc |= WPA_DRIVER_CAPA_ENC_TKIP;
- 	if (devcaps.dc_cryptocaps & IEEE80211_CRYPTO_AES_CCM)
- 		drv->capa.enc |= WPA_DRIVER_CAPA_ENC_CCMP;
-+#endif
- 
- 	if (devcaps.dc_drivercaps & IEEE80211_C_HOSTAP)
- 		drv->capa.flags |= WPA_DRIVER_FLAGS_AP;
-@@ -1545,6 +1629,8 @@
+@@ -1547,6 +1619,8 @@
  		}
  		if (ifmr.ifm_current & IFM_IEEE80211_HOSTAP)
  			return IEEE80211_M_HOSTAP;
@@ -260,7 +235,7 @@
  		if (ifmr.ifm_current & IFM_IEEE80211_MONITOR)
  			return IEEE80211_M_MONITOR;
  #ifdef IEEE80211_M_MBSS
-@@ -1605,7 +1691,7 @@
+@@ -1607,7 +1681,7 @@
  		drv->capa.key_mgmt_iftype[i] = drv->capa.key_mgmt;
  
  	/* Down interface during setup. */
@@ -269,13 +244,13 @@
  		goto fail;
  
  	/* Proven to work, lets go! */
-@@ -1628,6 +1714,9 @@
- 
+@@ -1631,6 +1705,9 @@
  	if (drv->ifindex != 0 && !drv->if_removed) {
  		wpa_driver_bsd_set_wpa(drv, 0);
-+
+ 
 +		/* NB: mark interface down */
 +		bsd_ctrl_iface(drv, 0);
- 
++
  		wpa_driver_bsd_set_wpa_internal(drv, drv->prev_wpa,
  						drv->prev_privacy);
+ 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202409132306.48DN6Nb2068234>