• Alvin Šipraga's avatar
    wifi: nl80211: emit CMD_START_AP on multicast group when an AP is started · 77669c15
    Alvin Šipraga authored
    Userspace processes such as network daemons may wish to be informed when
    any AP interface is brought up on the system, for example to initiate a
    (re)configuration of IP settings or to start a DHCP server.
    
    Currently nl80211 does not broadcast any such event on its multicast
    groups, leaving userspace only two options:
    
    1. the process must be the one that actually issued the
       NL80211_CMD_START_AP request, so that it can react on the response to
       that request;
    
    2. the process must react to RTM_NEWLINK events indicating a change in
       carrier state, and may query for further information about the AP and
       react accordingly.
    
    Option (1) is robust, but it does not cover all scenarios. It is easy to
    imagine a situation where this is not the case (e.g. hostapd +
    systemd-networkd).
    
    Option (2) is not robust, because RTM_NEWLINK events may be silently
    discarded by the linkwatch logic (cf. linkwatch_fire_event()).
    Concretely, consider a scenario in which the carrier state flip-flops in
    the following way:
    
     ^ carrier state (high/low = carrier/no carrier)
     |
     |        _______      _______ ...
     |       |       |    |
     | ______| "foo" |____| "bar"             (SSID in "quotes")
     |
     +-------A-------B----C---------> time
    
    If the time interval between (A) and (C) is less than 1 second, then
    linkwatch may emit only a single RTM_NEWLINK event indicating carrier
    gain.
    
    This is problematic because it is possible that the network
    configuration that should be applied is a function of the AP's
    properties such as SSID (cf. SSID= in systemd.network(5)). As
    illustrated in the above diagram, it may be that the AP with SSID "bar"
    ends up being configured as though it had SSID "foo".
    
    Address the above issue by having nl80211 emit an NL80211_CMD_START_AP
    message on the MLME nl80211 multicast group. This allows for arbitrary
    processes to be reliably informed.
    Signed-off-by: default avatarAlvin Šipraga <alsi@bang-olufsen.dk>
    Link: https://lore.kernel.org/r/20230128125844.2407135-1-alvin@pqrs.dkSigned-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
    77669c15
nl80211.c 537 KB