Commit graph

19923 commits

Author SHA1 Message Date
Mark Mentovai
fd63cf1558
hostapd: allow hostapd under ujail to communicate with hostapd_cli
When procd-ujail is available, 1f78538 runs hostapd as user
"network", with only limited additional capabilities (CAP_NET_ADMIN and
CAP_NET_RAW).

hostapd_cli (CONFIG_PACKAGE_hostapd-utils) communicates with hostapd
over a named UNIX-domain socket. hostapd_cli is responsible for creating
this socket at /tmp/wpa_ctrl_$pid_$counter. Since it typically runs as
root, this endpoint is normally created with uid root, gid root, mode
0755. As a result, hostapd running as uid network is able to receive
control messages sent through this interface, but is not able to respond
to them. If debug-level logging is enabled (CONFIG_WPA_MSG_MIN_PRIORITY
<= 2 at build, and log_level <= 2 in /etc/config/wireless wifi-device),
this message will appear from hostapd:

CTRL: sendto failed: Permission denied

As a fix, hostapd_cli should create the socket node in the filesystem
with uid network, gid network, mode 0770. This borrows the presently
Android-only strategy already in hostapd intended to solve the same
problem on Android.

If procd-ujail is not available and hostapd falls back to running as
root, it will still be able to read from and write to the socket even if
the node in the filesystem has been restricted to the network user and
group. This matches the logic in
package/network/services/hostapd/files/wpad.init, which sets the uid and
gid of /var/run/hostapd to network regardless of whether procd-ujail is
available.

As it appears that the "network" user and group are statically allocated
uid 101 and gid 101, respectively, per
package/base-files/files/etc/passwd and USERID in
package/network/services/hostapd/Makefile, this patch also uses a
constant 101 for the uid and gid.
2025-02-11 11:39:33 +01:00
Felix Fietkau
b971bbb6f4
hostapd: initial prototype of an ubus binding
Supports listing, removing and banning clients, and hooking into
probe/assoc/auth requests via object subscribe.
2025-02-11 11:39:33 +01:00
David Bauer
cce2ed0f0f
hostapd: add OpenWrt specific statistic counters
This adds a new struct for storing statistics not (yet) tracked by
hostapd regarding RRM and WNM activity.

These statistics can be read using the get_status hostapd interface ubus
method.
2025-02-11 11:39:33 +01:00
Felix Fietkau
1d6e53a569
hostapd: implement fallback for incomplete survey data 2025-02-11 11:39:33 +01:00
David Bauer
f9d49d7408
hostapd: config: support random BSS color
Configure the HE BSS color to a random value in case the config defines
a BSS color which exceeds the max BSS color (63).

Signed-off-by: David Bauer <mail@david-bauer.net>
2025-02-11 11:39:33 +01:00
Felix Fietkau
d6138a763b
Fix issues with disabling obss scan when using fixed_freq on mesh 2025-02-11 11:39:33 +01:00
Sven Eckelmann
f0491d0512
set mcast_rate in mesh mode
The wpa_supplicant code for IBSS allows to set the mcast rate. It is
recommended to increase this value from 1 or 6 Mbit/s to something higher
when using a mesh protocol on top which uses the multicast packet loss as
indicator for the link quality.

This setting was unfortunately not applied for mesh mode. But it would be
beneficial when wpa_supplicant would behave similar to IBSS mode and set
this argument during mesh join like authsae already does. At least it is
helpful for companies/projects which are currently switching to 802.11s
(without mesh_fwding and with mesh_ttl set to 1) as replacement for IBSS
because newer drivers seem to support 802.11s but not IBSS anymore.

Signed-off-by: Sven Eckelmann <sven.eckelmann@openmesh.com>
Tested-by: Simon Wunderlich <simon.wunderlich@openmesh.com>
2025-02-11 11:39:33 +01:00
Antonio Quartulli
f8778360f8
wpa_supplicant: add new config params to be used with the ibss join command
Signed-hostap: Antonio Quartulli <ordex@autistici.org>
2025-02-11 11:39:33 +01:00
Felix Fietkau
8580056c28
hostapd: add configurable debug message minimum priority to cut down on bloat generated by excessive debug messages 2025-02-11 11:39:33 +01:00
Felix Fietkau
710e402cd3
hostapd: only advertise a single encryption type via WPS if multiple are supported
Fixes windows 7 interop issues
2025-02-11 11:39:33 +01:00
Denton Gentry
10bbad15ac
hostapd: make cli treat UNKNOWN COMMAND as failing
Avoid infinite loop at 100% CPU when running hostapd_cli
if CONFIG_CTRL_IFACE_MIB is not defined.

  _newselect(4, [3], NULL, NULL, ...)
  recvfrom(3, "UNKNOWN COMMAND\n", 4095, 0, NULL, NULL) = 16
  sendto(3, "STA-NEXT UNKNOWN COMMAND", 24, 0, NULL, 0) = 24
2025-02-11 11:39:33 +01:00
Felix Fietkau
dd29de8196
nl80211_del_beacon_bss.patch 2025-02-11 11:39:33 +01:00
Felix Fietkau
6d0258017a
wpa_supplicant: fix calling channel switch via wpa_cli on mesh interfaces 2025-02-11 11:39:33 +01:00
Felix Fietkau
1fbdd1c913
nl80211_fix_set_freq.patch 2025-02-11 11:39:33 +01:00
Felix Fietkau
9845c4d778
hostapd: make rfkill support optional 2025-02-11 11:39:33 +01:00
Felix Fietkau
65696cd9d7
rescan_immediately.patch 2025-02-11 11:39:33 +01:00
Daniel Golle
9f19475170
Allow HT40 also on 2.4GHz if noscan option is set, which also skips secondary channel scan just like noscan works in AP mode. 2025-02-11 11:39:33 +01:00
Felix Fietkau
498f318216
Add noscan, no_ht_coex config options 2025-02-11 11:39:33 +01:00
Felix Fietkau
fbd403ac84
Remove some unnecessary control interface functionality 2025-02-11 11:39:33 +01:00
Felix Fietkau
61164db8f3
hostapd: always include p2p options in wpa_cli 2025-02-11 11:39:33 +01:00
Felix Fietkau
da9d6738e1
hostapd: support wps in hostapd_cli even when built from the mini variant 2025-02-11 11:39:33 +01:00
Jo-Philipp Wich
efb493a087
hostapd: support optional argument for the -v switch of hostapd and wpa_supplicant to query build features, e.g. hostapd -veap to test whether 802.11i support is compiled in 2025-02-11 11:39:32 +01:00
Leon M. George
f25d79b410
hostapd: declare struct wpa_bss early
wps_supplicant.h assumes that 'struct wpa_bss' is forward declared if
CONFIG_WPS is not defined.  With the later inclusion of
600-ubus_support, the issue manifests in warnings like these:

wps_supplicant.h:113:15: warning: 'struct wpa_bss' declared inside parameter list will not be visible outside of this definition or declaration
        struct wpa_bss *bss)
               ^~~~~~~
This patch forward declares 'struct wpa_bss' regardless.
2025-02-11 11:39:32 +01:00
Eneas U de Queiroz
daadbcc258
Move definition of WLAN_SUPP_RATES_MAX to defs.h
Patch 460-wpa_supplicant-add-new-config-params-to-be-used-with.patch
("wpa_supplicant: add new config params to be used with the ibss join
command") adds the definition of unsigned char
rates[WLAN_SUPP_RATES_MAX] to driver.h, which needs to have
WLAN_SUPP_RATES_MAX defined.  So it includes sta_info.h to get the
definition.

Commit c74739250a ("AP MLD: Use a helper function to check if a STA is a
non-AP MLD") makes sta_info.h include driver.h before
it defines WLAN_SUPP_RATES_MAX, causing an error:

src/drivers/driver.h:969:29: error: 'WLAN_SUPP_RATES_MAX' undeclared here (not in a function)

Move the definition of WLAN_SUPP_RATES_MAX to defs.h to ensure it gets
defined before other headers are included.  The inclusion of sta_info.h
in driver.h can be reverted as well.

Signed-off-by: Eneas U de Queiroz <cotequeiroz@gmail.com>
2025-02-11 11:39:32 +01:00
David Bauer
7840cec664
ctrl: make WNM_AP functions dependant on CONFIG_AP
This fixes linking errors found when compiling wpa_supplicant with
CONFIG_WNM_AP enabled but CONFIG_AP disabled.

Signed-off-by: David Bauer <mail@david-bauer.net>
2025-02-11 11:39:32 +01:00
Felix Fietkau
642f727edc
hostapd: build with LTO enabled (using jobserver for parallel build) 2025-02-11 11:39:32 +01:00
Felix Fietkau
433ed95af3
Add option to build a multicall binary
This allows building both hostapd and wpa_supplicant as a single binary
(wpad).
2025-02-11 11:39:32 +01:00
sinavir
500ceaeb52
openwrt-patch: fix_owe_ssid_update 2025-02-11 11:39:32 +01:00
P Praneesh
182f84d634
hostapd: update cfs0 and cfs1 for 160MHz
As per standard Draft P802.11ax_D8.0,( Table 26-9—Setting
of the VHT Channel Width and VHT NSS at an HE STA
transmitting the OM Control subfield ), center frequency of
160MHz should be published in HT information subset 2 of
HT information when EXT NSS BW field is enabled.

If the supported number of NSS in 160MHz is at least max NSS
support, then center_freq_seg0 indicates the center frequency of 80MHz and
center_freq_seg1 indicates the center frequency of 160MHz.

If the supported number of NSS in 160MHz is less than max NSS
support, then center_freq_seg0 indicates the center frequency of 80MHz and
center_freq_seg1 is 0. The center frequency of 160MHz is published in HT
operation information element instead.

Signed-off-by: P Praneesh <ppranees@codeaurora.org>
2025-02-11 11:39:32 +01:00
Glenn Strauss
c82091cbaa
dpp_pkex: EC point mul w/ value < prime
crypto_ec_point_mul() with mbedtls requires point
be multiplied by a multiplicand with value < prime

Signed-off-by: Glenn Strauss <gstrauss@gluelogic.com>
2025-02-11 11:39:32 +01:00
Glenn Strauss
687ef821ce
add NULL checks (encountered during tests/hwsim)
sae_derive_commit_element_ecc NULL pwe_ecc check
dpp_gen_keypair() NULL curve check

Signed-off-by: Glenn Strauss <gstrauss@gluelogic.com>
2025-02-11 11:39:32 +01:00
Glenn Strauss
41cdd916ba
tests/Makefile make run-tests with CONFIG_TLS=...
add test-crypto_module.c to run crypto_module_tests()

adjust some tests/hwsim/*.py for mbed TLS (work in progress)

option to build and run-tests with CONFIG_TLS=internal # (default)
$ cd tests; make clean
$ make run-tests

option to build and run-tests with CONFIG_TLS=gnutls
$ cd tests; make clean CONFIG_TLS=gnutls
$ make run-tests CONFIG_TLS=gnutls

option to build and run-tests with CONFIG_TLS=mbedtls
$ cd tests; make clean CONFIG_TLS=mbedtls
$ make run-tests CONFIG_TLS=mbedtls

option to build and run-tests with CONFIG_TLS=openssl
$ cd tests; make clean CONFIG_TLS=openssl
$ make run-tests CONFIG_TLS=openssl

option to build and run-tests with CONFIG_TLS=wolfssl
$ cd tests; make clean CONFIG_TLS=wolfssl
$ make run-tests CONFIG_TLS=wolfssl

RFE: Makefile logic for crypto objects should be centralized
     instead of being duplicated in hostapd/Makefile,
     wpa_supplicant/Makefile, src/crypto/Makefile,
     tests/Makefile, ...

Signed-off-by: Glenn Strauss <gstrauss@gluelogic.com>
2025-02-11 11:39:32 +01:00
David Bauer
09d6720d6d
hostapd: fix OWE association with mbedtls
The code for hostapd-mbedtls did not work when used for OWE association.

When handling association requests, the buffer offsets and length
assumptions were incorrect, leading to never calculating the y point,
thus denying association.

Also when crafting the association response, the buffer contained the
trailing key-type.

Fix up both issues to adhere to the specification and make
hostapd-mbedtls work with the OWE security type.
2025-02-11 11:39:32 +01:00
Glenn Strauss
da1c0bb385
mbedtls: annotate with TEST_FAIL() for hwsim tests
Signed-off-by: Glenn Strauss <gstrauss@gluelogic.com>
2025-02-11 11:39:32 +01:00
Glenn Strauss
557108f5f0
mbedtls: fips186_2_prf()
Signed-off-by: Glenn Strauss <gstrauss@gluelogic.com>
2025-02-11 11:39:32 +01:00
Glenn Strauss
ea571b808c
mbedtls: TLS/crypto option (initial port)
Signed-off-by: Glenn Strauss <gstrauss@gluelogic.com>
2025-02-11 11:39:32 +01:00
Felix Fietkau
772b9986a1
AP: add missing null pointer check in hostapd_free_hapd_data
When called from wpa_supplicant, iface->interfaces can be NULL

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2025-02-11 11:39:32 +01:00
David Bauer
f2302cddf2
nl80211: add extra-ies only if allowed by driver
Upgrading wpa_supplicant from 2.9 to 2.10 breaks broadcom-wl
based adapters. The reason for it is hostapd tries to install additional
IEs for scanning while the driver does not support this.

The kernel indicates the maximum number of bytes for additional scan IEs
using the NL80211_ATTR_MAX_SCAN_IE_LEN attribute. Save this value and
only add additional scan IEs in case the driver can accommodate these
additional IEs.

Reported-by: Étienne Morice <neon.emorice@mail.com>
Tested-by: Étienne Morice <neon.emorice@mail.com>
Signed-off-by: David Bauer <mail@david-bauer.net>
2025-02-11 11:39:32 +01:00
Stijn Tintel
0c5dcf5fe4
Revert "Do prune_association only after the STA is authorized"
Commit e978072baa ("Do prune_association only after the STA is
authorized") causes issues when an STA roams from one interface to
another interface on the same PHY. The mt7915 driver is not able to
handle this properly. While the commits fixes a DoS, there are other
devices and drivers with the same limitation, so revert to the orginal
behavior for now, until we have a better solution in place.

Ref: https://github.com/openwrt/openwrt/issues/13156
Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
2025-02-11 11:39:32 +01:00
Felix Fietkau
125fb92ea5
fix adding back stations after a missed deauth/disassoc 2025-02-11 11:39:32 +01:00
Markus Theil
72573cdb95
mesh: use deterministic channel on channel switch
This patch uses a deterministic channel on DFS channel switch
in mesh networks. Otherwise, when switching to a usable but not
available channel, no CSA can be sent and a random channel is choosen
without notification of other nodes. It is then quite likely, that
the mesh network gets disconnected.

Fix this by using a deterministic number, based on the sha256 hash
of the mesh ID, in order to use at least a different number in each
mesh network.

Signed-off-by: Markus Theil <markus.theil@tu-ilmenau.de>
2025-02-11 11:39:32 +01:00
Peter Oh
945aea6ff0
mesh: Allow DFS channels to be selected if dfs is enabled
Note: DFS is assumed to be usable if a country code has been set

Signed-off-by: Benjamin Berg <benjamin@sipsolutions.net>
Signed-off-by: Peter Oh <peter.oh@bowerswilkins.com>
2025-02-11 11:39:32 +01:00
sinavir
ba99627140
openwrt: add aditional source files 2025-02-11 11:39:32 +01:00
Jouni Malinen
5ace39b0a4 tests: D-Bus interface for NAN USD
Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
2024-09-15 12:33:50 +03:00
Lo,Chin-Ran
85cd98976d dbus: Methods for NAN USD
USD had a control interface commands and events defined for it. Extend
this by providing similar USD methods through the dbus control
interface.

Signed-off-by: Lo,Chin-Ran <chin-ran.lo@nxp.com>
2024-09-15 12:33:46 +03:00
Lo,Chin-Ran
dcf58aec8d dbus: Signals for NAN USD
USD had a control interface events defined for it. Extend this by
providing similar USD signals through the dbus control interface.

Signed-off-by: Lo,Chin-Ran <chin-ran.lo@nxp.com>
2024-09-15 11:59:54 +03:00
Jouni Malinen
d2408e3032 dbus: Dict helpers for fetching integers of any type
Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
2024-09-15 11:59:54 +03:00
Jouni Malinen
fd1a149d91 NAN: Fix UpdatePublish offload to driver
This was supposed to call wpa_drv_nan_update_publish() instead of
wpa_drv_nan_cancel_publish().

Fixes: 633e969311 ("NAN: Option to offload NAN DE for USD into the driver")
Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
2024-09-14 14:12:46 +03:00
Jouni Malinen
b3bd49f3c0 NAN: Handle A3 copying internally to simplify control interface
There is no need to copy the A3 value for follow-up frames through the
control interface events and commands since it can be handled internally
in the service with sufficient accuracy. More parallel operations with
multiple peers might need per-peer information, but that can be extended
in the future, if that level of complexity is really needed in practice.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
2024-09-14 13:06:03 +03:00
Jouni Malinen
650d1ab600 Revert "tests: Copy A3 into NAN SDF Follow-up"
This reverts commit 81322fa43d ("tests: Copy A3 into NAN SDF
Follow-up") to allow simplification of the control interface by removing
the external A3 copying.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
2024-09-14 13:06:03 +03:00