Commit Graph

253 Commits

Author SHA1 Message Date
Jose Ignacio Tornos Martinez f24e1f7bf9 wifi: cfg80211: skip indicating signal for per-STA profile BSSs
JIRA: https://issues.redhat.com/browse/RHEL-67113

commit bff93c89ab19886e17f0a86ea59f2e37141f2ab6
Author: Veerendranath Jakkam <quic_vjakkam@quicinc.com>
Date:   Wed Sep 4 08:39:16 2024 +0530

    wifi: cfg80211: skip indicating signal for per-STA profile BSSs
    
    Currently signal of the BSS entry generated from the per-STA profile
    indicated as zero, but userspace may consider it as high signal
    strength since 0 dBm is a valid RSSI value.
    
    To avoid this don't report the signal to userspace when the BSS entry
    created from a per-STA profile.
    
    Signed-off-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com>
    Link: https://patch.msgid.link/20240904030917.3602369-3-quic_vjakkam@quicinc.com
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
2024-11-22 10:58:10 +01:00
Jose Ignacio Tornos Martinez 876a50fa0a wifi: cfg80211: make BSS source types public
JIRA: https://issues.redhat.com/browse/RHEL-67113

commit 0fdcc994a42cf1306bc0e9ca6c9adeec657f5f02
Author: Veerendranath Jakkam <quic_vjakkam@quicinc.com>
Date:   Wed Sep 4 08:39:15 2024 +0530

    wifi: cfg80211: make BSS source types public
    
    Define public enum with BSS source types in core.h. Upcoming patches
    need this to store BSS source type in struct cfg80211_internal_bss.
    
    Signed-off-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com>
    Link: https://patch.msgid.link/20240904030917.3602369-2-quic_vjakkam@quicinc.com
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
2024-11-22 10:58:10 +01:00
Jose Ignacio Tornos Martinez a6dc3ade4f wifi: cfg80211: refactor 6 GHz AP power type parsing
JIRA: https://issues.redhat.com/browse/RHEL-50013

commit 459662e83db6eb33f648213bba2c509f4d6dead9
Author: Johannes Berg <johannes.berg@intel.com>
Date:   Thu May 23 12:09:47 2024 +0200

    wifi: cfg80211: refactor 6 GHz AP power type parsing
    
    Add cfg80211_get_6ghz_power_type() to parse the 6 GHz
    power type from a given set of elements, which is now
    only inside cfg80211_6ghz_power_type_valid().
    
    Reviewed-by: Miriam Rachel Korenblit <miriam.rachel.korenblit@intel.com>
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Link: https://msgid.link/20240523120945.84cdffd94085.I76f434ee12552e8be91273f3b2d776179eaa62f1@changeid
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
2024-10-29 08:18:00 +01:00
Jose Ignacio Tornos Martinez acc22a00ce wifi: mac80211: refactor channel checks
JIRA: https://issues.redhat.com/browse/RHEL-50013

commit ca41bfe367d54a7fa966c11852d50d4191187725
Author: Johannes Berg <johannes.berg@intel.com>
Date:   Thu May 23 12:09:46 2024 +0200

    wifi: mac80211: refactor channel checks
    
    To later introduce an override for VLP APs being allowed despite
    NO-IR flags, which is somewhat similar in construction to being
    allowed to monitor on disabled channels, refactor the code that
    checks channel flags to have not a 'monitor' argument but a set
    of 'permitting' flags that permit the operation without checking
    for 'prohibited' flags.
    
    Reviewed-by: Miriam Rachel Korenblit <miriam.rachel.korenblit@intel.com>
    Reviewed-by: Ilan Peer <ilan.peer@intel.com>
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Link: https://msgid.link/20240523120945.3da28ded4a50.I90cffc633d0510293d511f60097dc75e719b55f0@changeid
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
2024-10-29 08:18:00 +01:00
Jose Ignacio Tornos Martinez ad37c25759 wifi: cfg80211: optionally support monitor on disabled channels
JIRA: https://issues.redhat.com/browse/RHEL-34696

commit a110a3b79177ddd7e7295671df97fb5386406835
Author: Johannes Berg <johannes.berg@intel.com>
Date:   Tue Feb 6 16:54:08 2024 +0200

    wifi: cfg80211: optionally support monitor on disabled channels
    
    If the hardware supports a disabled channel, it may in
    some cases be possible to use monitor mode (without any
    transmit) on it when it's otherwise disabled. Add a new
    channel flag IEEE80211_CHAN_CAN_MONITOR that makes it
    possible for a driver to indicate such a thing.
    
    Make it per channel so drivers could have a choice with
    it, perhaps it's only possible on some channels, perhaps
    some channels are not supported at all, but still there
    and marked disabled.
    
    In _nl80211_parse_chandef() simplify the code and check
    only for an unknown channel, _cfg80211_chandef_usable()
    will later check for IEEE80211_CHAN_DISABLED anyway.
    
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
    Link: https://msgid.link/20240206164849.87fad3a21a09.I9116b2fdc2e2c9fd59a9273a64db7fcb41fc0328@changeid
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
2024-06-17 09:19:31 +02:00
Jose Ignacio Tornos Martinez 79d05d252a wifi: cfg80211: add a kunit test for 6 GHz colocated AP parsing
JIRA: https://issues.redhat.com/browse/RHEL-34696

commit 45d43937a44c806b8649323b8f5d9f42ae838b0e
Author: Benjamin Berg <benjamin.berg@intel.com>
Date:   Mon Jan 29 22:09:19 2024 +0100

    wifi: cfg80211: add a kunit test for 6 GHz colocated AP parsing
    
    Test a few things around parsing of 6 GHz colocated APs to e.g. ensure
    that we are not going to scan for a disabled (affiliated) AP.
    
    Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
    Link: https://msgid.link/20240129220918.079dc50ab43b.Ide898d9f1d4c26d7e774d6fd0ec57766967d6572@changeid
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
2024-06-17 09:19:02 +02:00
Jose Ignacio Tornos Martinez 8115a05a17 wifi: cfg80211: validate MLO connections better
JIRA: https://issues.redhat.com/browse/RHEL-34696

commit ccb964b4ab1663ce92f389b72c052fc47a0ffdb9
Author: Johannes Berg <johannes.berg@intel.com>
Date:   Tue Jan 2 21:35:44 2024 +0200

    wifi: cfg80211: validate MLO connections better
    
    When going into an MLO connection, validate that the link IDs
    match what userspace indicated, and that the AP MLD addresses
    and capabilities are all matching between the links.
    
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Reviewed-by: Gregory Greenman <gregory.greenman@intel.com>
    Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
    Link: https://msgid.link/20240102213313.ff83c034cb9a.I9962db0bfa8c73b37b8d5b59a3fad7f02f2129ae@changeid
    [roll in extra fix from Miri to actually check the return value]
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
2024-06-17 09:18:49 +02:00
Jose Ignacio Tornos Martinez 1ddee3aaf1 wifi: cfg80211: tests: add some scanning related tests
JIRA: https://issues.redhat.com/browse/RHEL-28754

commit 9d027a35a52a4ea9400390ef4414e4e9dcd54193
Author: Benjamin Berg <benjamin.berg@intel.com>
Date:   Wed Dec 20 16:19:52 2023 +0100

    wifi: cfg80211: tests: add some scanning related tests
    
    This adds some scanning related tests, mainly exercising the ML element
    parsing and inheritance.
    
    Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
    Link: https://msgid.link/20231220151952.415232-7-benjamin@sipsolutions.net
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
2024-03-18 17:58:14 +01:00
Jose Ignacio Tornos Martinez 49904f1b0f wifi: cfg80211: add BSS usage reporting
JIRA: https://issues.redhat.com/browse/RHEL-28754

Conflicts:
    - net/wireless/scan.c
      Context diff because d18125b64030 was already backported. 

commit d02a12b8e4bbd188f38321849791af02d494c7fd
Author: Johannes Berg <johannes.berg@intel.com>
Date:   Mon Dec 11 09:05:20 2023 +0200

    wifi: cfg80211: add BSS usage reporting
    
    Sometimes there may be reasons for which a BSS that's
    actually found in scan cannot be used to connect to,
    for example a nonprimary link of an NSTR mobile AP MLD
    cannot be used for normal direct connections to it.
    
    Not indicating these to userspace as we do now of course
    avoids being able to connect to them, but it's better if
    they're shown to userspace and it can make an appropriate
    decision, without e.g. doing an additional ML probe.
    
    Thus add an indication of what a BSS can be used for,
    currently "normal" and "MLD link", including a reason
    bitmap for it being not usable.
    
    The latter can be extended later for certain BSSes if there
    are other reasons they cannot be used.
    
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Reviewed-by: Ilan Peer <ilan.peer@intel.com>
    Reviewed-by: Gregory Greenman <gregory.greenman@intel.com>
    Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
    Link: https://msgid.link/20231211085121.0464f25e0b1d.I9f70ca9f1440565ad9a5207d0f4d00a20cca67e7@changeid
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
2024-03-18 17:57:58 +01:00
Jose Ignacio Tornos Martinez 269fd369a8 wifi: cfg80211: fix CQM for non-range use
JIRA: https://issues.redhat.com/browse/RHEL-19746

Conflicts:
  - net/wireless/nl80211.c
    parallel branches solving conflicts (7d6904bf26b96)

commit 7e7efdda6adb385fbdfd6f819d76bc68c923c394
Author: Johannes Berg <johannes.berg@intel.com>
Date:   Mon Nov 6 23:17:16 2023 +0100

    wifi: cfg80211: fix CQM for non-range use
    
    My prior race fix here broke CQM when ranges aren't used, as
    the reporting worker now requires the cqm_config to be set in
    the wdev, but isn't set when there's no range configured.
    
    Rather than continuing to special-case the range version, set
    the cqm_config always and configure accordingly, also tracking
    if range was used or not to be able to clear the configuration
    appropriately with the same API, which was actually not right
    if both were implemented by a driver for some reason, as is
    the case with mac80211 (though there the implementations are
    equivalent so it doesn't matter.)
    
    Also, the original multiple-RSSI commit lost checking for the
    callback, so might have potentially crashed if a driver had
    neither implementation, and userspace tried to use it despite
    not being advertised as supported.
    
    Cc: stable@vger.kernel.org
    Fixes: 4a4b816950 ("cfg80211: Accept multiple RSSI thresholds for CQM")
    Fixes: 37c20b2effe9 ("wifi: cfg80211: fix cqm_config access race")
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
2024-02-01 15:29:58 +01:00
Jose Ignacio Tornos Martinez c70a5e74e9 wifi: cfg80211: Allow AP/P2PGO to indicate port authorization to peer STA/P2PClient
JIRA: https://issues.redhat.com/browse/RHEL-19746

commit e4e7e3af73694380f0d9a742d13b80598a3393e9
Author: Vinayak Yadawad <vinayak.yadawad@broadcom.com>
Date:   Tue Sep 26 16:02:22 2023 +0530

    wifi: cfg80211: Allow AP/P2PGO to indicate port authorization to peer STA/P2PClient
    
    In 4way handshake offload, cfg80211_port_authorized enables driver
    to indicate successful 4way handshake to cfg80211 layer. Currently
    this path of port authorization is restricted to interface type
    NL80211_IFTYPE_STATION and NL80211_IFTYPE_P2P_CLIENT. This patch
    extends the support for NL80211_IFTYPE_AP and NL80211_IFTYPE_P2P_GO
    interfaces to authorize peer STA/P2P_CLIENT, whenever authentication
    is offloaded on the AP/P2P_GO interface.
    
    Signed-off-by: Vinayak Yadawad <vinayak.yadawad@broadcom.com>
    Link: https://lore.kernel.org/r/dee3b0a2b4f617e932c90bff4504a89389273632.1695721435.git.vinayak.yadawad@broadcom.com
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
2024-02-01 15:29:54 +01:00
Jose Ignacio Tornos Martinez 57ef526c9e wifi: cfg80211: export DFS CAC time and usable state helper functions
JIRA: https://issues.redhat.com/browse/RHEL-19746

commit 30ca8b0c4d6c9fb1d76e5894b1e8bf7c6a12224d
Author: Aditya Kumar Singh <quic_adisi@quicinc.com>
Date:   Tue Sep 12 10:48:55 2023 +0530

    wifi: cfg80211: export DFS CAC time and usable state helper functions
    
    cfg80211 has cfg80211_chandef_dfs_usable() function to know whether
    at least one channel in the chandef is in usable state or not. Also,
    cfg80211_chandef_dfs_cac_time() function is there which tells the CAC
    time required for the given chandef.
    
    Make these two functions visible to drivers by exporting their symbol
    to global list of kernel symbols.
    
    Lower level drivers can make use of these two functions to be aware
    if CAC is required on the given chandef and for how long. For example
    drivers which maintains the CAC state internally can make use of these.
    
    Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
    Reviewed-by: Jeff Johnson <quic_jjohnson@quicinc.com>
    Link: https://lore.kernel.org/r/20230912051857.2284-2-quic_adisi@quicinc.com
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
2024-02-01 15:29:01 +01:00
Jose Ignacio Tornos Martinez 9735b89fb4 wifi: cfg80211: remove wdev mutex
JIRA: https://issues.redhat.com/browse/RHEL-19746

Conflicts:
  - net/wireless/nl80211.c
    this commit was developed in a parallel branch and there were conflicts
    that were resolved when it merged (merge commit 7d6904bf26b96).

commit 076fc8775dafe995e94c106bb732bf2d42dedcea
Author: Johannes Berg <johannes.berg@intel.com>
Date:   Tue Aug 29 12:18:56 2023 +0200

    wifi: cfg80211: remove wdev mutex
    
    Since we're now protecting everything with the wiphy mutex
    (and were really using it for almost everything before),
    there's no longer any real reason to have a separate wdev
    mutex. It may feel better, but really has no value.
    
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
2024-02-01 15:28:54 +01:00
Jose Ignacio Tornos Martinez ee4fefcfb4 wifi: cfg80211: check wiphy mutex is held for wdev mutex
JIRA: https://issues.redhat.com/browse/RHEL-19746

commit 1474bc87fe57deac726cc10203f73daa6c3212f7
Author: Johannes Berg <johannes.berg@intel.com>
Date:   Mon Aug 28 13:59:56 2023 +0200

    wifi: cfg80211: check wiphy mutex is held for wdev mutex
    
    This might seem pretty pointless rather than changing the locking
    immediately, but it seems safer to run for a while with checks and
    the old locking scheme, and then remove the wdev lock later.
    
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
2024-02-01 15:28:52 +01:00
Jose Ignacio Tornos Martinez 63be7c3d15 wifi: cfg80211: add flush functions for wiphy work
JIRA: https://issues.redhat.com/browse/RHEL-19746

commit 56cfb8ce1f7f6c4e5ca571a2ec0880e131cd0311
Author: Johannes Berg <johannes.berg@intel.com>
Date:   Mon Aug 28 13:59:33 2023 +0200

    wifi: cfg80211: add flush functions for wiphy work
    
    There may be sometimes reasons to actually run the work
    if it's pending, add flush functions for both regular and
    delayed wiphy work that will do this.
    
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
2024-02-01 15:28:48 +01:00
Jose Ignacio Tornos Martinez bb272a8153 wifi: cfg80211: check RTNL when iterating devices
JIRA: https://issues.redhat.com/browse/RHEL-19746

commit 7483a2147aebea537e1447489109eeb5e771aff5
Author: Johannes Berg <johannes.berg@intel.com>
Date:   Mon Aug 28 13:59:32 2023 +0200

    wifi: cfg80211: check RTNL when iterating devices
    
    Add a new "for_each_rdev()" macro and check that we
    hold the RTNL when calling it.
    
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
2024-02-01 15:28:48 +01:00
Jose Ignacio Tornos Martinez 4613fd29be wifi: cfg80211: fix cqm_config access race
JIRA: https://issues.redhat.com/browse/RHEL-2907

commit 37c20b2effe987b806c8de6d12978e4ffeff026f
Author: Johannes Berg <johannes.berg@intel.com>
Date:   Wed Aug 16 15:38:04 2023 +0200

    wifi: cfg80211: fix cqm_config access race
    
    Max Schulze reports crashes with brcmfmac. The reason seems
    to be a race between userspace removing the CQM config and
    the driver calling cfg80211_cqm_rssi_notify(), where if the
    data is freed while cfg80211_cqm_rssi_notify() runs it will
    crash since it assumes wdev->cqm_config is set. This can't
    be fixed with a simple non-NULL check since there's nothing
    we can do for locking easily, so use RCU instead to protect
    the pointer, but that requires pulling the updates out into
    an asynchronous worker so they can sleep and call back into
    the driver.
    
    Since we need to change the free anyway, also change it to
    go back to the old settings if changing the settings fails.
    
    Reported-and-tested-by: Max Schulze <max.schulze@online.de>
    Closes: https://lore.kernel.org/r/ac96309a-8d8d-4435-36e6-6d152eb31876@online.de
    Fixes: 4a4b816950 ("cfg80211: Accept multiple RSSI thresholds for CQM")
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
2023-11-27 15:02:36 +01:00
Jose Ignacio Tornos Martinez b1c2cdd59e wifi: cfg80211: Annotate struct cfg80211_cqm_config with __counted_by
JIRA: https://issues.redhat.com/browse/RHEL-2907

commit d4d3aaf25a6600d58774978cea9068974a8ea674
Author: Kees Cook <keescook@chromium.org>
Date:   Thu Aug 17 14:15:24 2023 -0700

    wifi: cfg80211: Annotate struct cfg80211_cqm_config with __counted_by
    
    Prepare for the coming implementation by GCC and Clang of the __counted_by
    attribute. Flexible array members annotated with __counted_by can have
    their accesses bounds-checked at run-time checking via CONFIG_UBSAN_BOUNDS
    (for array indexing) and CONFIG_FORTIFY_SOURCE (for strcpy/memcpy-family
    functions).
    
    As found with Coccinelle[1], add __counted_by for struct cfg80211_cqm_config.
    
    [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
    
    Cc: Johannes Berg <johannes@sipsolutions.net>
    Cc: "David S. Miller" <davem@davemloft.net>
    Cc: Eric Dumazet <edumazet@google.com>
    Cc: Jakub Kicinski <kuba@kernel.org>
    Cc: Paolo Abeni <pabeni@redhat.com>
    Cc: linux-wireless@vger.kernel.org
    Cc: netdev@vger.kernel.org
    Signed-off-by: Kees Cook <keescook@chromium.org>
    Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>
    Reviewed-by: Jeff Johnson <quic_jjohnson@quicinc.com>
    Link: https://lore.kernel.org/r/20230817211531.4193219-2-keescook@chromium.org
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
2023-11-27 15:02:23 +01:00
Jose Ignacio Tornos Martinez ce18652fe9 wifi: cfg80211/nl80211: Add support to indicate STA MLD setup links removal
JIRA: https://issues.redhat.com/browse/RHEL-2907

commit 065563b20a664a6575dc158688dfb0e121c25b38
Author: Veerendranath Jakkam <quic_vjakkam@quicinc.com>
Date:   Fri Mar 17 19:51:53 2023 +0530

    wifi: cfg80211/nl80211: Add support to indicate STA MLD setup links removal
    
    STA MLD setup links may get removed if AP MLD remove the corresponding
    affiliated APs with Multi-Link reconfiguration as described in
    P802.11be_D3.0, section 35.3.6.2.2 Removing affiliated APs. Currently,
    there is no support to notify such operation to cfg80211 and userspace.
    
    Add support for the drivers to indicate STA MLD setup links removal to
    cfg80211 and notify the same to userspace. Upon receiving such
    indication from the driver, clear the MLO links information of the
    removed links in the WDEV.
    
    Signed-off-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com>
    Link: https://lore.kernel.org/r/20230317142153.237900-1-quic_vjakkam@quicinc.com
    [rename function and attribute, fix kernel-doc]
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
2023-11-27 15:01:42 +01:00
Jose Ignacio Tornos Martinez fb979456ec wifi: cfg80211: move scan done work to wiphy work
JIRA: https://issues.redhat.com/browse/RHEL-2907

commit fe0af9fe54d0ff53aa49eef390c8962355b274e2
Author: Johannes Berg <johannes.berg@intel.com>
Date:   Tue Jun 6 14:49:33 2023 +0200

    wifi: cfg80211: move scan done work to wiphy work
    
    Move the scan done work to the new wiphy work to
    simplify the code a bit.
    
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
2023-11-27 15:01:20 +01:00
Jose Ignacio Tornos Martinez 7f0b76645e wifi: cfg80211: move sched scan stop to wiphy work
JIRA: https://issues.redhat.com/browse/RHEL-2907

commit c88d7178229b7b9482ab4cc0b781aef0f20c3dfb
Author: Johannes Berg <johannes.berg@intel.com>
Date:   Tue Jun 6 14:49:32 2023 +0200

    wifi: cfg80211: move sched scan stop to wiphy work
    
    This work can now trivially be converted, it behaves
    identical either way.
    
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
2023-11-27 15:01:20 +01:00
Jose Ignacio Tornos Martinez 2959d9b1cf wifi: cfg80211: add a work abstraction with special semantics
JIRA: https://issues.redhat.com/browse/RHEL-2907

commit a3ee4dc84c4e9d14cb34dad095fd678127aca5b6
Author: Johannes Berg <johannes.berg@intel.com>
Date:   Tue Jun 6 14:49:25 2023 +0200

    wifi: cfg80211: add a work abstraction with special semantics
    
    Add a work abstraction at the cfg80211 level that will always
    hold the wiphy_lock() for any work executed and therefore also
    can be canceled safely (without waiting) while holding that.
    This improves on what we do now as with the new wiphy works we
    don't have to worry about locking while cancelling them safely.
    
    Also, don't let such works run while the device is suspended,
    since they'll likely need to interact with the device. Flush
    them before suspend though.
    
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
2023-11-27 15:01:19 +01:00
Jose Ignacio Tornos Martinez a59e47e071 wifi: cfg80211: remove support for static WEP
Bugzilla: https://bugzilla.redhat.com/2178526

commit 585b6e1304dcc46e65dc1aaca5973b33abd0c48d
Author: Johannes Berg <johannes.berg@intel.com>
Date:   Mon Jan 16 15:24:11 2023 +0100

    wifi: cfg80211: remove support for static WEP
    
    This reverts commit b8676221f0 ("cfg80211: Add support for
    static WEP in the driver") since no driver ever ended up using
    it.
    
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
2023-05-09 08:17:50 +02:00
Jose Ignacio Tornos Martinez 4ff3e117fe cfg80211: Update Transition Disable policy during port authorization
Bugzilla: https://bugzilla.redhat.com/2178526

commit 0ff57171d6d225558c81a69439d5323e35b40549
Author: Vinayak Yadawad <vinayak.yadawad@broadcom.com>
Date:   Wed Sep 7 18:14:48 2022 +0530

    cfg80211: Update Transition Disable policy during port authorization
    
    In case of 4way handshake offload, transition disable policy
    updated by the AP during EAPOL 3/4 is not updated to the upper layer.
    This results in mismatch between transition disable policy
    between the upper layer and the driver. This patch addresses this
    issue by updating transition disable policy as part of port
    authorization indication.
    
    Signed-off-by: Vinayak Yadawad <vinayak.yadawad@broadcom.com>
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
2023-05-09 08:15:18 +02:00
Íñigo Huguet a449340399 wifi: cfg80211: clean up links appropriately
Bugzilla: https://bugzilla.redhat.com/2136122

commit cdf0a0a80c841cfede6926d417a8756ea4c52d26
Author: Johannes Berg <johannes.berg@intel.com>
Date:   Wed Jul 6 09:57:42 2022 +0200

    wifi: cfg80211: clean up links appropriately
    
    This was missing earlier, we need to remove links when
    interfaces are being destroyed, and we also need to
    stop (AP) operations when a link is being destroyed.
    Address these issues to remove many warnings that will
    otherwise appear in mac80211.
    
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
2022-11-28 12:57:32 +01:00
Íñigo Huguet 504405615d wifi: cfg80211: remove BSS pointer from cfg80211_disassoc_request
Bugzilla: https://bugzilla.redhat.com/2136122

commit 8f6e0dfc2245d8ca1a3335a06a1219c56df04bb8
Author: Johannes Berg <johannes.berg@intel.com>
Date:   Mon Jun 27 16:19:18 2022 +0200

    wifi: cfg80211: remove BSS pointer from cfg80211_disassoc_request
    
    The race described by the comment in mac80211 hasn't existed
    since the locking rework to use the same lock and for MLO we
    need to pass the AP MLD address, so just pass the BSSID or
    AP MLD address instead of the BSS struct pointer, and adjust
    all the code accordingly.
    
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
2022-11-28 12:57:29 +01:00
Íñigo Huguet 6f3f458413 wifi: cfg80211: simplify cfg80211_mlme_auth() prototype
Bugzilla: https://bugzilla.redhat.com/2136122

commit 325839da9581ee3e881e9c318cbebbdd680cb101
Author: Johannes Berg <johannes.berg@intel.com>
Date:   Wed Jun 1 22:42:28 2022 +0200

    wifi: cfg80211: simplify cfg80211_mlme_auth() prototype
    
    This function has far too many parameters now, move out
    the BSS lookup and pass the request struct instead.
    
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
2022-11-28 12:57:02 +01:00
Íñigo Huguet a0292c0e69 wifi: cfg80211: mlme: get BSS entry outside cfg80211_mlme_assoc()
Bugzilla: https://bugzilla.redhat.com/2136122

commit 0f7594489a8ab154edb899e84f877def0b48fbd0
Author: Johannes Berg <johannes.berg@intel.com>
Date:   Tue May 31 18:00:00 2022 +0200

    wifi: cfg80211: mlme: get BSS entry outside cfg80211_mlme_assoc()
    
    Today it makes more sense to pass the necessary parameters to
    look up the BSS entry to cfg80211_mlme_assoc(), but with MLO
    we will need to look up multiple, and that gets awkward. Pull
    the lookup code into the callers so we can change it better.
    
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
2022-11-28 12:57:02 +01:00
Íñigo Huguet 7cc314edf6 wifi: cfg80211: do some rework towards MLO link APIs
Bugzilla: https://bugzilla.redhat.com/2136122

Conflicts: removed chunk of unsupported driver rtl8723bs

commit 7b0a0e3c3a88260b6fcb017e49f198463aa62ed1
Author: Johannes Berg <johannes.berg@intel.com>
Date:   Thu Apr 14 16:50:57 2022 +0200

    wifi: cfg80211: do some rework towards MLO link APIs
    
    In order to support multi-link operation with multiple links,
    start adding some APIs. The notable addition here is to have
    the link ID in a new nl80211 attribute, that will be used to
    differentiate the links in many nl80211 operations.
    
    So far, this patch adds the netlink NL80211_ATTR_MLO_LINK_ID
    attribute (as well as the NL80211_ATTR_MLO_LINKS attribute)
    and plugs it through the system in some places, checking the
    validity etc. along with other infrastructure needed for it.
    
    For now, I've decided to include only the over-the-air link
    ID in the API. I know we discussed that we eventually need to
    have to have other ways of identifying a link, but for local
    AP mode and auth/assoc commands as well as set_key etc. we'll
    use the OTA ID.
    
    Also included in this patch is some refactoring of the data
    structures in struct wireless_dev, splitting for the first
    time the data into type dependent pieces, to make reasoning
    about these things easier.
    
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
2022-11-28 12:56:58 +01:00
Íñigo Huguet 18ad876b03 cfg80211: remove cfg80211_get_chan_state()
Bugzilla: https://bugzilla.redhat.com/2136122

commit 34c9a0e71cbb316f360919353273b185c2780cd7
Author: Johannes Berg <johannes.berg@intel.com>
Date:   Tue Apr 12 22:09:59 2022 +0200

    cfg80211: remove cfg80211_get_chan_state()
    
    We haven't used this function for years, since commit c781944b71
    ("cfg80211: Remove unused cfg80211_can_use_iftype_chan()") which
    itself removed a function unused since commit 97dc94f1d9
    ("cfg80211: remove channel_switch combination check"), almost eight
    years ago.
    
    Also remove the now unused enum cfg80211_chan_mode and some struct
    members that were only used for this function.
    
    Link: https://lore.kernel.org/r/20220412220958.1a191dca19d7.Ide4448f02d0e2f1ca2992971421ffc1933a5370a@changeid
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
2022-11-28 12:56:36 +01:00
Íñigo Huguet f3e7c91110 cfg80211: rename offchannel_chain structs to background_chain to avoid confusion with ETSI standard
Bugzilla: https://bugzilla.redhat.com/2059999

commit a95bfb876fa87e2d0fa718ee61a8030ddf162d2b
Author: Lorenzo Bianconi <lorenzo@kernel.org>
Date:   Mon Nov 29 14:11:24 2021 +0100

    cfg80211: rename offchannel_chain structs to background_chain to avoid confusion with ETSI standard
    
    ETSI standard defines "Offchannel CAC" as:
    "Off-Channel CAC is performed by a number of non-continuous checks
    spread over a period in time. This period, which is required to
    determine the presence of radar signals, is defined as the Off-Channel
    CAC Time..
    Minimum Off-Channel CAC Time 6 minutes and Maximum Off-Channel CAC Time
    4 hours..".
    mac80211 implementation refers to a dedicated hw chain used for continuous
    radar monitoring. Rename offchannel_* references to background_* in
    order to avoid confusion with ETSI standard.
    
    Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
    Link: https://lore.kernel.org/r/4204cc1d648d76b44557981713231e030a3bd991.1638190762.git.lorenzo@kernel.org
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
2022-05-31 14:49:55 +02:00
Íñigo Huguet a2027f28a4 cfg80211: move offchan_cac_event to a dedicated work
Bugzilla: https://bugzilla.redhat.com/2059999

commit 1507b153198137dfa9cb4bec7c5dee07089ec3af
Author: Lorenzo Bianconi <lorenzo@kernel.org>
Date:   Wed Oct 27 11:03:42 2021 +0200

    cfg80211: move offchan_cac_event to a dedicated work
    
    In order to make cfg80211_offchan_cac_abort() (renamed from
    cfg80211_offchan_cac_event) callable in other contexts and
    without so much locking restrictions, make it trigger a new
    work instead of operating directly.
    
    Do some other renames while at it to clarify.
    
    Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
    Link: https://lore.kernel.org/r/6145c3d0f30400a568023f67981981d24c7c6133.1635325205.git.lorenzo@kernel.org
    [rewrite commit log]
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
2022-05-31 14:49:34 +02:00
Íñigo Huguet b16086a774 cfg80211: implement APIs for dedicated radar detection HW
Bugzilla: https://bugzilla.redhat.com/2059999

commit bc2dfc02836b1133d1bf4d22aa13d48ac98eabef
Author: Lorenzo Bianconi <lorenzo@kernel.org>
Date:   Sat Oct 23 11:10:50 2021 +0200

    cfg80211: implement APIs for dedicated radar detection HW
    
    If a dedicated (off-channel) radar detection hardware (chain)
    is available in the hardware/driver, allow this to be used by
    calling the NL80211_CMD_RADAR_DETECT command with a new flag
    attribute requesting off-channel radar detection is used.
    
    Offchannel CAC (channel availability check) avoids the CAC
    downtime when switching to a radar channel or when turning on
    the AP.
    
    Drivers advertise support for this using the new feature flag
    NL80211_EXT_FEATURE_RADAR_OFFCHAN.
    
    Tested-by: Evelyn Tsai <evelyn.tsai@mediatek.com>
    Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
    Link: https://lore.kernel.org/r/7468e291ef5d05d692c1738d25b8f778d8ea5c3f.1634979655.git.lorenzo@kernel.org
    Link: https://lore.kernel.org/r/1e60e60fef00e14401adae81c3d49f3e5f307537.1634979655.git.lorenzo@kernel.org
    Link: https://lore.kernel.org/r/85fa50f57fc3adb2934c8d9ca0be30394de6b7e8.1634979655.git.lorenzo@kernel.org
    Link: https://lore.kernel.org/r/4b6c08671ad59aae0ac46fc94c02f31b1610eb72.1634979655.git.lorenzo@kernel.org
    Link: https://lore.kernel.org/r/241849ccaf2c228873c6f8495bf87b19159ba458.1634979655.git.lorenzo@kernel.org
    [remove offchan_mutex, fix cfg80211_stop_offchan_radar_detection(),
     remove gfp_t argument, fix documentation, fix tracing]
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
2022-05-31 14:49:34 +02:00
Íñigo Huguet cf7ff9a0d4 cfg80211: fix management registrations locking
Bugzilla: http://bugzilla.redhat.com/2033354

commit 09b1d5dc6ce1c9151777f6c4e128a59457704c97
Author: Johannes Berg <johannes.berg@intel.com>
Date:   Mon Oct 25 13:31:12 2021 +0200

    cfg80211: fix management registrations locking
    
    The management registrations locking was broken, the list was
    locked for each wdev, but cfg80211_mgmt_registrations_update()
    iterated it without holding all the correct spinlocks, causing
    list corruption.
    
    Rather than trying to fix it with fine-grained locking, just
    move the lock to the wiphy/rdev (still need the list on each
    wdev), we already need to hold the wdev lock to change it, so
    there's no contention on the lock in any case. This trivially
    fixes the bug since we hold one wdev's lock already, and now
    will hold the lock that protects all lists.
    
    Cc: stable@vger.kernel.org
    Reported-by: Jouni Malinen <j@w1.fi>
    Fixes: 6cd536fe62 ("cfg80211: change internal management frame registration API")
    Link: https://lore.kernel.org/r/20211025133111.5cf733eab0f4.I7b0abb0494ab712f74e2efcd24bb31ac33f7eee9@changeid
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
2021-12-22 13:46:09 +01:00
Emmanuel Grumbach 358ae88881 cfg80211: expose the rfkill device to the low level driver
This will allow the low level driver to query the rfkill
state.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Link: https://lore.kernel.org/r/20210616202826.9833-1-emmanuel.grumbach@intel.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2021-06-23 11:29:13 +02:00
Johannes Berg a05829a722 cfg80211: avoid holding the RTNL when calling the driver
Currently, _everything_ in cfg80211 holds the RTNL, and if you
have a slow USB device (or a few) you can get some bad lock
contention on that.

Fix that by re-adding a mutex to each wiphy/rdev as we had at
some point, so we have locking for the wireless_dev lists and
all the other things in there, and also so that drivers still
don't have to worry too much about it (they still won't get
parallel calls for a single device).

Then, we can restrict the RTNL to a few cases where we add or
remove interfaces and really need the added protection. Some
of the global list management still also uses the RTNL, since
we need to have it anyway for netdev management, but we only
hold the RTNL for very short periods of time here.

Link: https://lore.kernel.org/r/20210122161942.81df9f5e047a.I4a8e1a60b18863ea8c5e6d3a0faeafb2d45b2f40@changeid
Tested-by: Marek Szyprowski <m.szyprowski@samsung.com> [marvell driver issues]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2021-01-26 11:55:50 +01:00
Anant Thazhemadam 2d9463083c nl80211: validate key indexes for cfg80211_registered_device
syzbot discovered a bug in which an OOB access was being made because
an unsuitable key_idx value was wrongly considered to be acceptable
while deleting a key in nl80211_del_key().

Since we don't know the cipher at the time of deletion, if
cfg80211_validate_key_settings() were to be called directly in
nl80211_del_key(), even valid keys would be wrongly determined invalid,
and deletion wouldn't occur correctly.
For this reason, a new function - cfg80211_valid_key_idx(), has been
created, to determine if the key_idx value provided is valid or not.
cfg80211_valid_key_idx() is directly called in 2 places -
nl80211_del_key(), and cfg80211_validate_key_settings().

Reported-by: syzbot+49d4cab497c2142ee170@syzkaller.appspotmail.com
Tested-by: syzbot+49d4cab497c2142ee170@syzkaller.appspotmail.com
Suggested-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Anant Thazhemadam <anant.thazhemadam@gmail.com>
Link: https://lore.kernel.org/r/20201204215825.129879-1-anant.thazhemadam@gmail.com
Cc: stable@vger.kernel.org
[also disallow IGTK key IDs if no IGTK cipher is supported]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2020-12-11 13:20:04 +01:00
Johannes Berg 9bdaf3b91e cfg80211: initialize wdev data earlier
There's a race condition in the netdev registration in that
NETDEV_REGISTER actually happens after the netdev is available,
and so if we initialize things only there, we might get called
with an uninitialized wdev through nl80211 - not using a wdev
but using a netdev interface index.

I found this while looking into a syzbot report, but it doesn't
really seem to be related, and unfortunately there's no repro
for it (yet). I can't (yet) explain how it managed to get into
cfg80211_release_pmsr() from nl80211_netlink_notify() without
the wdev having been initialized, as the latter only iterates
the wdevs that are linked into the rdev, which even without the
change here happened after init.

However, looking at this, it seems fairly clear that the init
needs to be done earlier, otherwise we might even re-init on a
netns move, when data might still be pending.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Link: https://lore.kernel.org/r/20201009135821.fdcbba3aad65.Ie9201d91dbcb7da32318812effdc1561aeaf4cdc@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2020-10-30 10:03:59 +01:00
Tova Mussai c8cb5b854b nl80211/cfg80211: support 6 GHz scanning
Support 6 GHz scanning, by
 * a new scan flag to scan for colocated BSSes advertised
   by (and found) APs on 2.4 & 5 GHz
 * doing the necessary reduced neighbor report parsing for
   this, to find them
 * adding the ability to split the scan request in case the
   device by itself cannot support this.

Also add some necessary bits in mac80211 to not break with
these changes.

Signed-off-by: Tova Mussai <tova.mussai@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Link: https://lore.kernel.org/r/20200918113313.232917c93af9.Ida22f0212f9122f47094d81659e879a50434a6a2@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2020-09-28 13:53:04 +02:00
Randy Dunlap b42c8edfdb net: wireless: delete duplicated word + fix grammar
Drop the repeated word "Return" + fix verb.

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: Johannes Berg <johannes.berg@intel.com>
Cc: Kalle Valo <kvalo@codeaurora.org>
Cc: linux-wireless@vger.kernel.org
Link: https://lore.kernel.org/r/20200822231953.465-4-rdunlap@infradead.org
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2020-08-27 11:23:16 +02:00
Johannes Berg 79ea1e12c0 cfg80211: fix management registrations deadlock
Lockdep reports that we may deadlock because we take the RTNL on
the work struct, but flush it under RTNL. Clearly, it's correct.
In practice, this can happen when doing rfkill on an active device.

Fix this by moving the work struct to the wiphy (registered dev)
layer, and iterate over all the wdevs inside there. This then
means we need to track which one of them has work to do, so we
don't update to the driver for all wdevs all the time.

Also fix a locking bug I noticed while working on this - the
registrations list is iterated as if it was an RCU list, but it
isn't handle that way - and we need to lock now for the update
flag anyway, so remove the RCU.

Fixes: 6cd536fe62 ("cfg80211: change internal management frame registration API")
Reported-by: Markus Theil <markus.theil@tu-ilmenau.de>
Reported-and-tested-by: Kenneth R. Crudup <kenny@panix.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Link: https://lore.kernel.org/r/20200604120420.b1dc540a7e26.I55dcca56bb5bdc5d7ad66a36a0b42afd7034d8be@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2020-06-05 09:22:00 +02:00
Gustavo A. R. Silva 396fba0a59 cfg80211: Replace zero-length array with flexible-array
The current codebase makes use of the zero-length array language
extension to the C90 standard, but the preferred mechanism to declare
variable-length types such as these ones is a flexible array member[1][2],
introduced in C99:

struct foo {
        int stuff;
        struct boo array[];
};

By making use of the mechanism above, we will get a compiler warning
in case the flexible array does not occur last in the structure, which
will help us prevent some kind of undefined behavior bugs from being
inadvertently introduced[3] to the codebase from now on.

Also, notice that, dynamic memory allocations won't be affected by
this change:

"Flexible array members have incomplete type, and so the sizeof operator
may not be applied. As a quirk of the original implementation of
zero-length arrays, sizeof evaluates to zero."[1]

sizeof(flexible-array-member) triggers a warning because flexible array
members have incomplete type[1]. There are some instances of code in
which the sizeof operator is being incorrectly/erroneously applied to
zero-length arrays and the result is zero. Such instances may be hiding
some bugs. So, this work (flexible-array member conversions) will also
help to get completely rid of those sorts of issues.

This issue was found with the help of Coccinelle.

[1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html
[2] https://github.com/KSPP/linux/issues/21
[3] commit 7649773293 ("cxgb3/l2t: Fix undefined behaviour")

Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Link: https://lore.kernel.org/r/20200507183909.GA12993@embeddedor
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2020-05-27 10:02:03 +02:00
Johannes Berg 9dba48a6ec cfg80211: support multicast RX registration
For DPP, there's a need to receive multicast action frames,
but many drivers need a special filter configuration for this.

Support announcing from userspace in the management registration
that multicast RX is required, with an extended feature flag if
the driver handles this.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Reviewed-by: Sergey Matyukevich <sergey.matyukevich.os@quantenna.com>
Link: https://lore.kernel.org/r/20200417124013.c46238801048.Ib041d437ce0bff28a0c6d5dc915f68f1d8591002@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2020-04-24 12:33:41 +02:00
Johannes Berg 6cd536fe62 cfg80211: change internal management frame registration API
Almost all drivers below cfg80211 get the API wrong (except for
cfg80211) and are unable to cope with multiple registrations for
the same frame type, which is valid due to the match filter.
This seems to indicate the API is wrong, and we should maintain
the full information in cfg80211 instead of the drivers.

Change the API to no longer inform the driver about individual
registrations and unregistrations, but rather every time about
the entire state of the entire wiphy and single wdev, whenever
it may have changed. This also simplifies the code in cfg80211
as it no longer has to track exactly what was unregistered and
can free things immediately.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Reviewed-by: Sergey Matyukevich <sergey.matyukevich.os@quantenna.com>
Link: https://lore.kernel.org/r/20200417124300.f47f3828afc8.I7f81ef59c2c5a340d7075fb3c6d0e08e8aeffe07@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2020-04-24 12:33:40 +02:00
Ilan Peer ff74c51e8f cfg80211/mac80211: Allow user space to register for station Rx authentication
To support Pre Association Security Negotiation (PASN) while already
associated to one AP, allow user space to register to Rx
authentication frames, so that the user space logic would be able to
receive/handle authentication frames from a different AP as part of
PASN.

Note that it is expected that user space would intelligently register
for Rx authentication frames, i.e., only when PASN is used and
configure a match filter only for PASN authentication algorithm, as
otherwise the MLME functionality of mac80211 would be broken.

Additionally, since some versions of the user space daemons wrongly
register to all types of authentication frames (which might result in
unexpected behavior) allow such registration if the request is for a
specific authentication algorithm number.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/20200131114529.894206-1-luca@coelho.fi
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2020-02-07 12:54:09 +01:00
Johannes Berg 3cfe91c4c3 cfg80211: always shut down on HW rfkill
When the RFKILL subsystem isn't available, then rfkill_blocked()
always returns false. In the case of hardware rfkill this will
be wrong though, as if the hardware reported being killed then
it cannot operate any longer.

Since we only ever call the rfkill_sync work in this case, just
rename it to rfkill_block and always pass "true" for the blocked
parameter, rather than passing rfkill_blocked().

We rely on the underlying driver to still reject any new attempt
to bring up the device by itself.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/20190830112451.21655-2-luca@coelho.fi
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2019-09-11 09:13:26 +02:00
Sergey Matyukevich 0afd425b1b cfg80211: fix duplicated scan entries after channel switch
When associated BSS completes channel switch procedure, its channel
record needs to be updated. The existing mac80211 solution was
extended to cfg80211 in commit 5dc8cdce1d ("mac80211/cfg80211:
update bss channel on channel switch").

However that solution still appears to be incomplete as it may lead
to duplicated scan entries for associated BSS after channel switch.
The root cause of the problem is as follows. Each BSS entry is
included into the following data structures:
- bss list rdev->bss_list
- bss search tree rdev->bss_tree
Updating BSS channel record without rebuilding bss_tree may break
tree search since cmp_bss considers all of the following: channel,
bssid, ssid. When BSS channel is updated, but its location in bss_tree
is not updated, then subsequent search operations may fail to locate
this BSS since they will be traversing bss_tree in wrong direction.
As a result, for scan performed after associated BSS channel switch,
cfg80211_bss_update may add the second entry for the same BSS to both
bss_list and bss_tree, rather then update the existing one.

To summarize, if BSS channel needs to be updated, then bss_tree should
be rebuilt in order to put updated BSS entry into a proper location.

This commit suggests the following straightforward solution:
- if new entry has been already created for BSS after channel switch,
  then use its IEs to update known BSS entry and then remove new
  entry completely
- use rb_erase/rb_insert_bss reinstall updated BSS in bss_tree
- for nontransmit BSS entry, the whole transmit BSS hierarchy
  is updated

Signed-off-by: Sergey Matyukevich <sergey.matyukevich.os@quantenna.com>
Link: https://lore.kernel.org/r/20190726163922.27509-3-sergey.matyukevich.os@quantenna.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2019-07-29 16:23:13 +02:00
Chaitanya Tata a3ce17d149 cfg80211: Handle bss expiry during connection
If the BSS is expired during connection, the connect result will
trigger a kernel warning. Ideally cfg80211 should hold the BSS
before the connection is attempted, but as the BSSID is not known
in case of auth/assoc MLME offload (connect op) it doesn't.

For those drivers without the connect op cfg80211 holds down the
reference so it wil not be removed from list.

Fix this by removing the warning and silently adding the BSS back to
the bss list which is return by the driver (with proper BSSID set) or
in case the BSS is already added use that.

The requirements for drivers are documented in the API's.

Signed-off-by: Chaitanya Tata <chaitanya.tata@bluwireless.co.uk>
[formatting fixes, keep old timestamp]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2019-05-28 09:35:39 +02:00
Johannes Berg b7b14ec1eb Merge remote-tracking branch 'net-next/master' into mac80211-next
Merge net-next to resolve a conflict and to get the mac80211
rhashtable fixes so further patches can be applied on top.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2019-02-22 13:48:13 +01:00
Sara Sharon 7011ba583f cfg80211: Move Multiple BSS info to struct cfg80211_bss to be visible
Previously the transmitted BSS and the non-trasmitted BSS list were
defined in struct cfg80211_internal_bss. Move them to struct cfg80211_bss
since mac80211 needs this info.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2019-02-08 13:51:50 +01:00