mbox series

[0/4] hostapd: add support for AP+STA on the same radio

Message ID 20230329134455.4019868-1-raphael.melotte@mind.be
Headers show
Series hostapd: add support for AP+STA on the same radio | expand

Message

Raphaël Mélotte March 29, 2023, 1:44 p.m. UTC
This series contains patches from the OpenWrt project which add
support for running an AP and an STA on the same radio and still be
able to switch channels. A test for it has also been added.

Note that there is a major difference from the version in OpenWrt: the
CSA count that is passed to hostapd was originally set to the counter
the STA receives minus 1 ("count - 1"), while it has now been changed
to be the same as the counter the STA receives ("count").

When testing the OpenWrt version with hwsim, the following kernel
warning is triggered:
"""
/* the counter should never reach 0 */
WARN_ON_ONCE(!beacon->cntdwn_current_counter);
"""

It is triggered because by sending "count - 1", the AP is ready to
switch channels - and reaches a count of 1 - one beacon interval
sooner than the STA. As a consequence, the AP has to wait and send one
more beacon, reaching a count of 0 (which should not happen, as the
comment in the kernel code states).

By sending the AP the same counter the STA receives, we make sure this
doesn't happen. It has to be noted that what can *still* happen, is
the AP receiving a counter that is "out of date". Indeed, if the
supplicant takes time to give the AP the counter, we could end up in a
situation where the station is ready to switch before the AP is (the
reverse of the issue described above). From a quick test with hwsim
however, this latter case does not seem to cause any problem with the
channel switch (other than it taking more time).

The 3 corresponding patches in OpenWrt are:
package/network/services/hostapd/patches/340-reload_freq_change.patch
package/network/services/hostapd/patches/360-ctrl_iface_reload.patch
package/network/services/hostapd/patches/370-ap_sta_support.patch

Arnout Vandecappelle (Essensium/Mind) (1):
  tests: AP+STA on same radio

Felix Fietkau (3):
  hostapd: ctrl_iface: add UPDATE command
  Add support for AP+STA on a single radio
  hostapd_reload_config: allow update of mode and frequency

 hostapd/ctrl_iface.c               |  67 +++++++++++++++++
 src/ap/beacon.c                    |   5 --
 src/ap/ctrl_iface_ap.c             |   8 +-
 src/ap/hostapd.c                   |  50 +++++++++----
 src/drivers/driver.h               |   2 +
 src/drivers/driver_nl80211_event.c |   6 +-
 tests/hwsim/test_ap_csa.py         | 115 +++++++++++++++++++++++++++++
 wpa_supplicant/Makefile            |   2 +
 wpa_supplicant/bss.c               |  10 +++
 wpa_supplicant/bss.h               |   2 +
 wpa_supplicant/events.c            |  44 ++++++++++-
 wpa_supplicant/main.c              |   8 +-
 wpa_supplicant/wpa_supplicant.c    |  70 ++++++++++++++++++
 wpa_supplicant/wpa_supplicant_i.h  |   7 ++
 14 files changed, 371 insertions(+), 25 deletions(-)

Comments

Jouni Malinen Nov. 5, 2023, 7:55 a.m. UTC | #1
On Wed, Mar 29, 2023 at 03:44:51PM +0200, Raphaël Mélotte wrote:
> This series contains patches from the OpenWrt project which add
> support for running an AP and an STA on the same radio and still be
> able to switch channels. A test for it has also been added.

There was a comment on the second patch proposing a different approach
for handling this, but that did not seem to go much further than that
at least as far as anything on the hostap mailing list is concerned.

Has there been any additional consideration on whether this coordination
could happen within the driver itself or is this type of changes to
hostapd and wpa_supplicant still needed and in use with OpenWrt?


> Arnout Vandecappelle (Essensium/Mind) (1):
>   tests: AP+STA on same radio
> 
> Felix Fietkau (3):
>   hostapd: ctrl_iface: add UPDATE command
>   Add support for AP+STA on a single radio
>   hostapd_reload_config: allow update of mode and frequency

Why does the UPDATE command (from patch 1/4) reload the hostapd
configuration file? Patch 2/4 seems to use UPDATE, but it does not
change anything in the configuration file. Is the UPDATE command really
needed when there is already SET command that can be used to update
running configuration dynamically?

Why does patch 1/4 modify hostapd_ctrl_iface_stop_ap()? The commit
message does not seem to say anything about that change and I'm not sure
the change is really correct. STOP_AP could be issued separately for
each BSS.

Patch 3/4 would change functionality that has been there for almost ten
years.. This patch series does not seem to indicate what the use case is
for configuration file changes since the only use here does not actually
change the configuration file at all. The channel parameters for an
operating AP may have changed dynamically during operation and it feels
undesired to override those with the values that were specified in the
configuration file in many cases. I can understand that there are cases
where the channel should be switched, but the cleaner way for doing that
would be to use the channel switch command and/or SET to override those
parameters explicitly.