systemd/networkmanager: Support Librem5 WiFi Hotspot
This applies a patch from the Purism tree [1] to ensure that the Librem5 can create a WiFi Hotspot. Adding a hacky patch to NetworkManager is less then ideal, but there currently isn't a better way to get WiFi Hotspot working. pmOS already has a fork of NetworkManager so adding one more patch isn't too much worse. If the NetworkManager fork disapears I think this patch can also just be dropped, but while we are maintaing NetworkManager we may as well support the Librem5. Hopefully Purism develop a cleaner fix for this in the future, as Librem5 development seems to have started up again. 1: https://source.puri.sm/pureos/packages/network-manager/-/blob/pureos/latest/debian/patches/pureos/wifi-Disable-WPA-PSK-SHA256-in-AP-mode.patch Resolves: https://gitlab.postmarketos.org/postmarketOS/pmaports/-/issues/2508 Signed-off-by: Alistair Francis <alistair@alistair23.me> Part-of: https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/6421 [ci:skip-build]: already built successfully in CI
This commit is contained in:
+121
@@ -0,0 +1,121 @@
|
||||
From 5c56eb74781b6aa7b5f4b0dbc50da414137d0074 Mon Sep 17 00:00:00 2001
|
||||
From: Jane Rachinger <jane400@postmarketos.org>
|
||||
Date: Wed, 16 Apr 2025 14:21:09 +0200
|
||||
Subject: [PATCH] hack: wifi: Disable WPA-PSK-SHA256 for brcmfmac in AP mode
|
||||
|
||||
This does the equivalent of purism's patch on librem 5 on pmOS,
|
||||
but doesn't affect other drivers.
|
||||
|
||||
https://source.puri.sm/pureos/packages/network-manager/-/blob/pureos/latest/debian/patches/pureos/wifi-Disable-WPA-PSK-SHA256-in-AP-mode.patch
|
||||
---
|
||||
src/core/devices/wifi/nm-device-wifi.c | 4 ++++
|
||||
src/core/supplicant/nm-supplicant-config.c | 18 +++++++++++++++++-
|
||||
src/core/supplicant/nm-supplicant-config.h | 1 +
|
||||
.../supplicant/tests/test-supplicant-config.c | 1 +
|
||||
4 files changed, 23 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/core/devices/wifi/nm-device-wifi.c b/src/core/devices/wifi/nm-device-wifi.c
|
||||
index 06eee14245..ec1bf8332f 100644
|
||||
--- a/src/core/devices/wifi/nm-device-wifi.c
|
||||
+++ b/src/core/devices/wifi/nm-device-wifi.c
|
||||
@@ -2929,12 +2929,15 @@ build_supplicant_config(NMDeviceWifi *self,
|
||||
NMSettingWirelessSecurityPmf pmf;
|
||||
NMSettingWirelessSecurityFils fils;
|
||||
NMTernary ap_isolation;
|
||||
+ gboolean quirk_is_brcmfmac;
|
||||
|
||||
g_return_val_if_fail(priv->sup_iface, NULL);
|
||||
|
||||
s_wireless = nm_connection_get_setting_wireless(connection);
|
||||
g_return_val_if_fail(s_wireless != NULL, NULL);
|
||||
|
||||
+ quirk_is_brcmfmac = nm_streq(nm_device_get_driver(NM_DEVICE(self)), "brcmfmac");
|
||||
+
|
||||
config = nm_supplicant_config_new(nm_supplicant_interface_get_capabilities(priv->sup_iface));
|
||||
|
||||
/* Warn if AP mode may not be supported */
|
||||
@@ -3011,6 +3014,7 @@ build_supplicant_config(NMDeviceWifi *self,
|
||||
mtu,
|
||||
pmf,
|
||||
fils,
|
||||
+ quirk_is_brcmfmac,
|
||||
error)) {
|
||||
g_prefix_error(error, "802-11-wireless-security: ");
|
||||
goto error;
|
||||
diff --git a/src/core/supplicant/nm-supplicant-config.c b/src/core/supplicant/nm-supplicant-config.c
|
||||
index 951f153653..cb1a8a9eb8 100644
|
||||
--- a/src/core/supplicant/nm-supplicant-config.c
|
||||
+++ b/src/core/supplicant/nm-supplicant-config.c
|
||||
@@ -930,6 +930,7 @@ nm_supplicant_config_add_setting_wireless_security(NMSupplicantConfig
|
||||
guint32 mtu,
|
||||
NMSettingWirelessSecurityPmf pmf,
|
||||
NMSettingWirelessSecurityFils fils,
|
||||
+ gboolean quirk_is_brcmfmac,
|
||||
GError **error)
|
||||
{
|
||||
NMSupplicantConfigPrivate *priv = NM_SUPPLICANT_CONFIG_GET_PRIVATE(self);
|
||||
@@ -938,6 +939,7 @@ nm_supplicant_config_add_setting_wireless_security(NMSupplicantConfig
|
||||
const char *psk;
|
||||
gboolean set_pmf, wps_disabled;
|
||||
gboolean is_ap;
|
||||
+ gboolean quirk_no_ap_wpa_psk_sha256;
|
||||
|
||||
g_return_val_if_fail(NM_IS_SUPPLICANT_CONFIG(self), FALSE);
|
||||
g_return_val_if_fail(setting != NULL, FALSE);
|
||||
@@ -951,6 +953,20 @@ nm_supplicant_config_add_setting_wireless_security(NMSupplicantConfig
|
||||
*/
|
||||
is_ap = nm_streq0(mode, NM_SETTING_WIRELESS_MODE_AP);
|
||||
|
||||
+ /* Some Librem 5 have a sparklan wifi card, which cannot use
|
||||
+ * WPA-PSK-SHA256 in AP mode. This quirk shouldn't be in this
|
||||
+ * highlevel program but rather in the kernel, but this was
|
||||
+ * faster and unbreaks AP for the Librem 5 without affecting
|
||||
+ * other drivers. I sadly wasn't able to find a matching
|
||||
+ * bugzilla entry in the kernel. Without more details I'm scoping
|
||||
+ * this quirk to the whole brcmfmac driver as the commit messages
|
||||
+ * in PureOS indicate this.
|
||||
+ *
|
||||
+ * https://puri.sm/posts/shipping-new-sparklan-wifi-cards-with-librem-5/
|
||||
+ * https://source.puri.sm/pureos/packages/network-manager/-/merge_requests/1
|
||||
+ */
|
||||
+ quirk_no_ap_wpa_psk_sha256 = is_ap && quirk_is_brcmfmac;
|
||||
+
|
||||
/* Check if we actually support FILS */
|
||||
if (!_get_capability(priv, NM_SUPPL_CAP_TYPE_FILS)) {
|
||||
if (fils == NM_SETTING_WIRELESS_SECURITY_FILS_REQUIRED) {
|
||||
@@ -980,7 +996,7 @@ nm_supplicant_config_add_setting_wireless_security(NMSupplicantConfig
|
||||
} else if (nm_streq(key_mgmt, "wpa-psk")) {
|
||||
if (pmf != NM_SETTING_WIRELESS_SECURITY_PMF_REQUIRED)
|
||||
g_string_append(key_mgmt_conf, "WPA-PSK");
|
||||
- if (_get_capability(priv, NM_SUPPL_CAP_TYPE_PMF))
|
||||
+ if (!quirk_no_ap_wpa_psk_sha256 && _get_capability(priv, NM_SUPPL_CAP_TYPE_PMF))
|
||||
g_string_append(key_mgmt_conf, " WPA-PSK-SHA256");
|
||||
if (!is_ap && _get_capability(priv, NM_SUPPL_CAP_TYPE_FT))
|
||||
g_string_append(key_mgmt_conf, " FT-PSK");
|
||||
diff --git a/src/core/supplicant/nm-supplicant-config.h b/src/core/supplicant/nm-supplicant-config.h
|
||||
index c52b756e78..1b441799f3 100644
|
||||
--- a/src/core/supplicant/nm-supplicant-config.h
|
||||
+++ b/src/core/supplicant/nm-supplicant-config.h
|
||||
@@ -57,6 +57,7 @@ gboolean nm_supplicant_config_add_setting_wireless_security(NMSupplicantConfig
|
||||
guint32 mtu,
|
||||
NMSettingWirelessSecurityPmf pmf,
|
||||
NMSettingWirelessSecurityFils fils,
|
||||
+ gboolean quirk_is_brcmfmac,
|
||||
GError **error);
|
||||
|
||||
gboolean nm_supplicant_config_add_no_security(NMSupplicantConfig *self, GError **error);
|
||||
diff --git a/src/core/supplicant/tests/test-supplicant-config.c b/src/core/supplicant/tests/test-supplicant-config.c
|
||||
index 1ca5b26e56..812e4d6e9d 100644
|
||||
--- a/src/core/supplicant/tests/test-supplicant-config.c
|
||||
+++ b/src/core/supplicant/tests/test-supplicant-config.c
|
||||
@@ -120,6 +120,7 @@ build_supplicant_config(NMConnection *connection,
|
||||
mtu,
|
||||
pmf,
|
||||
fils,
|
||||
+ FALSE,
|
||||
&error);
|
||||
} else {
|
||||
success = nm_supplicant_config_add_no_security(config, &error);
|
||||
--
|
||||
2.49.0
|
||||
|
||||
@@ -5,7 +5,7 @@ maintainer="Jane Rachinger <jane400+pmaports@postmarketos.org>"
|
||||
pkgname=networkmanager
|
||||
pkgver=9991.52.0
|
||||
_pkgver=1.52.0
|
||||
pkgrel=1
|
||||
pkgrel=2
|
||||
pkgdesc="Network Management daemon"
|
||||
url="https://wiki.gnome.org/Projects/NetworkManager"
|
||||
arch="all"
|
||||
@@ -79,6 +79,7 @@ subpackages="
|
||||
source="$pkgname-$_pkgver.tar.gz::https://github.com/NetworkManager/NetworkManager/archive/refs/tags/$_pkgver.tar.gz
|
||||
$pkgname.conf
|
||||
$pkgname.rules
|
||||
0001-hack-wifi-Disable-WPA-PSK-SHA256-for-brcmfmac-in-AP-.patch
|
||||
"
|
||||
builddir="$srcdir/NetworkManager-$_pkgver"
|
||||
|
||||
@@ -236,4 +237,5 @@ sha512sums="
|
||||
6669467bad7a4965b92124506d25649bd6c95e90c34213edb3f854df9a163507ac5dd381ff53800254a2db703f23233f8dc5b59a75042532bd573fc8c7022158 networkmanager-1.52.0.tar.gz
|
||||
0f79016bf717dea43830962f524deae8d1cedc274376e40bd912ebe63208c5b1c3b7a5aa14379da19020c587dbd5588df2f0066ca1540070a226983a43e4159b networkmanager.conf
|
||||
9820ed2ead0af689644842de57657bb10330a1eaff0e85b21ae9913f55e399e47d8b41b0a12956f30de80272b4424c6e55f33acbc88e156879003a260bf576f6 networkmanager.rules
|
||||
e321f6f072901c4076543a6d1c4c46cf4a16b24be5fea6167c878bfeb9eced801fae94925ff208132f22a69a34d0f036b30f7b9253dea1757b98b40cbe3a896d 0001-hack-wifi-Disable-WPA-PSK-SHA256-for-brcmfmac-in-AP-.patch
|
||||
"
|
||||
|
||||
Reference in New Issue
Block a user