aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCy Schubert <cy@FreeBSD.org>2024-02-27 04:27:50 +0000
committerCy Schubert <cy@FreeBSD.org>2024-03-04 16:44:36 +0000
commit2dc822b9e7c44abf61594cbc31379837bb35973d (patch)
treef54b19e1004c4a32772949c33556285b7d895c6d
parentdc54c23abc95eebbd14d84a74716c7b24ef79b34 (diff)
downloadports-2dc822b9e7c44abf61594cbc31379837bb35973d.tar.gz
ports-2dc822b9e7c44abf61594cbc31379837bb35973d.zip
net/hostapd*: Work around lack of MLME support
hostap MLME uses Linux data structures and definitions not available in FreeBSD. The ability for hostapd to select the frequency (channel) depends Linux MLME, though strictly it's not required. Work around the Linux MLME requirement to configure device frequency. The detailed description is: hostapd will only set the channel (frequency) when Linux MLME is configured. Enabling NEED_AP_MLME will result in numerous build errors due do Linux data structures and definitions not available under FreeBSD. The code to set the frequency from the selected channel is only within the NEED_AP_MLME code path because without MLME, hostapd_get_hw_features() is an inline that always returns -1 whereas with MLME hostapd_get_hw_features() will obtain hardware features from the kernel. Until such time we simply set the frequency as configured. PR: 276375 MFH: 2024Q1
-rw-r--r--net/hostapd-devel/Makefile2
-rw-r--r--net/hostapd-devel/files/patch-src_ap_hostapd.c31
-rw-r--r--net/hostapd/Makefile2
-rw-r--r--net/hostapd/files/patch-src_ap_hostapd.c31
4 files changed, 64 insertions, 2 deletions
diff --git a/net/hostapd-devel/Makefile b/net/hostapd-devel/Makefile
index 95aeb3ceb624..e7a5a3f7d11a 100644
--- a/net/hostapd-devel/Makefile
+++ b/net/hostapd-devel/Makefile
@@ -1,6 +1,6 @@
PORTNAME= hostapd
PORTVERSION= ${COMMIT_DATE}
-PORTREVISION= 1
+PORTREVISION= 2
CATEGORIES= net
PKGNAMESUFFIX= -devel
diff --git a/net/hostapd-devel/files/patch-src_ap_hostapd.c b/net/hostapd-devel/files/patch-src_ap_hostapd.c
new file mode 100644
index 000000000000..5219cb3a0da8
--- /dev/null
+++ b/net/hostapd-devel/files/patch-src_ap_hostapd.c
@@ -0,0 +1,31 @@
+--- src/ap/hostapd.c.orig 2024-02-18 01:24:29.000000000 -0800
++++ src/ap/hostapd.c 2024-02-26 20:25:50.505205000 -0800
+@@ -2029,6 +2029,20 @@
+ iface->wait_channel_update = 0;
+ iface->is_no_ir = false;
+
++#ifdef __FreeBSD
++ /* XXX hostapd_get_hw_features() is an inline that always returns -1
++ * because MLME will not build under FreeBSD due to its use of
++ * Linux definitions. Normally FreeBSD would uncondionally execute the
++ * "Not all drivers support..." block. Instead we #ifdef out the entire
++ * block of code instead of maintaining the fallacy that
++ * hostapd_get_hw_features() returns anything meaninful.
++ *
++ * Ideally WANT_AP_MLME should be taught about FreeBSD data structures
++ * and defintions. Instead we do this to enable channel selection in
++ * hostapd.conf.
++ */
++ iface->freq = iface->conf->channel;
++#else
+ if (hostapd_get_hw_features(iface)) {
+ /* Not all drivers support this yet, so continue without hw
+ * feature data. */
+@@ -2080,6 +2094,7 @@
+ if (iface->conf->ieee80211h)
+ wpa_printf(MSG_DEBUG, "DFS support is enabled");
+ }
++#endif
+ return hostapd_setup_interface_complete(iface, 0);
+
+ fail:
diff --git a/net/hostapd/Makefile b/net/hostapd/Makefile
index 4ff64eacad26..a9a1aebc0a0d 100644
--- a/net/hostapd/Makefile
+++ b/net/hostapd/Makefile
@@ -1,6 +1,6 @@
PORTNAME= hostapd
PORTVERSION= 2.10
-PORTREVISION= 9
+PORTREVISION= 10
CATEGORIES= net
MASTER_SITES= https://w1.fi/releases/
diff --git a/net/hostapd/files/patch-src_ap_hostapd.c b/net/hostapd/files/patch-src_ap_hostapd.c
new file mode 100644
index 000000000000..1eafe68ad485
--- /dev/null
+++ b/net/hostapd/files/patch-src_ap_hostapd.c
@@ -0,0 +1,31 @@
+--- src/ap/hostapd.c.orig 2022-01-16 12:51:29.000000000 -0800
++++ src/ap/hostapd.c 2024-02-26 20:24:39.350068000 -0800
+@@ -1698,6 +1698,20 @@
+ {
+ iface->wait_channel_update = 0;
+
++#ifdef __FreeBSD
++ /* XXX hostapd_get_hw_features() is an inline that always returns -1
++ * because MLME will not build under FreeBSD due to its use of
++ * Linux definitions. Normally FreeBSD would uncondionally execute the
++ * "Not all drivers support..." block. Instead we #ifdef out the entire
++ * block of code instead of maintaining the fallacy that
++ * hostapd_get_hw_features() returns anything meaninful.
++ *
++ * Ideally WANT_AP_MLME should be taught about FreeBSD data structures
++ * and defintions. Instead we do this to enable channel selection in
++ * hostapd.conf.
++ */
++ iface->freq = iface->conf->channel;
++#else
+ if (hostapd_get_hw_features(iface)) {
+ /* Not all drivers support this yet, so continue without hw
+ * feature data. */
+@@ -1744,6 +1758,7 @@
+ if (iface->conf->ieee80211h)
+ wpa_printf(MSG_DEBUG, "DFS support is enabled");
+ }
++#endif
+ return hostapd_setup_interface_complete(iface, 0);
+
+ fail: