]> git.ipfire.org Git - thirdparty/systemd.git/commit
network: wifi: check SSID when AP interfaces go up
authorAlvin Šipraga <alsi@bang-olufsen.dk>
Wed, 7 Dec 2022 15:43:06 +0000 (16:43 +0100)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 15 Dec 2022 18:38:10 +0000 (03:38 +0900)
commit986b2514cc68368181ad8b5e2000346fc8394c9a
tree654a1982f970c2c935ffbc7dd3b81a67141742f8
parent7eb51b8e3e62b7921f29a34a102c102b0966342b
network: wifi: check SSID when AP interfaces go up

When an AP goes up, the kernel may emit a netlink event indicating that
the interface has gained carrier. In that event, we should check if the
SSID has changed before attempting to reconfigure. Not doing so means
that the link->ssid member is not updated, leading to a potential
mismatch if some of the .network configurations match on SSID=.

There are however scenarios where the above heuristic is not enough.
Specifically, if the interface carrier state flip-flops within a short
enough interval, the internal throttling of netlink events inside the
kernel may suppress intermediate linkdown+linkup events (cf. Linux
net/core/link_watch.c). So there is no linkup event to react on.

To improve on the latter scenario, it is proposed to make newer kernels
emit an NL80211_CMD_START_AP multicast event when an AP goes up. This
event will not be dropped by link_watch. systemd-networkd can then react
to such events as well, and optionally reconfigure the link if the SSID
has changed. This will only work with newer kernels though.
src/network/networkd-link.c
src/network/networkd-wifi.c
src/network/networkd-wifi.h