02 Nov, 2017

1 commit

  • Many source files in the tree are missing licensing information, which
    makes it harder for compliance tools to determine the correct license.

    By default all files without license information are under the default
    license of the kernel, which is GPL version 2.

    Update the files which contain no license information with the 'GPL-2.0'
    SPDX license identifier. The SPDX identifier is a legally binding
    shorthand, which can be used instead of the full boiler plate text.

    This patch is based on work done by Thomas Gleixner and Kate Stewart and
    Philippe Ombredanne.

    How this work was done:

    Patches were generated and checked against linux-4.14-rc6 for a subset of
    the use cases:
    - file had no licensing information it it.
    - file was a */uapi/* one with no licensing information in it,
    - file was a */uapi/* one with existing licensing information,

    Further patches will be generated in subsequent months to fix up cases
    where non-standard license headers were used, and references to license
    had to be inferred by heuristics based on keywords.

    The analysis to determine which SPDX License Identifier to be applied to
    a file was done in a spreadsheet of side by side results from of the
    output of two independent scanners (ScanCode & Windriver) producing SPDX
    tag:value files created by Philippe Ombredanne. Philippe prepared the
    base worksheet, and did an initial spot review of a few 1000 files.

    The 4.13 kernel was the starting point of the analysis with 60,537 files
    assessed. Kate Stewart did a file by file comparison of the scanner
    results in the spreadsheet to determine which SPDX license identifier(s)
    to be applied to the file. She confirmed any determination that was not
    immediately clear with lawyers working with the Linux Foundation.

    Criteria used to select files for SPDX license identifier tagging was:
    - Files considered eligible had to be source code files.
    - Make and config files were included as candidates if they contained >5
    lines of source
    - File already had some variant of a license header in it (even if
    Reviewed-by: Philippe Ombredanne
    Reviewed-by: Thomas Gleixner
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

11 Jan, 2017

1 commit

  • There is not a valid reason to attempt setting the monitor channel
    while in managed mode. Since this code path only deals with this mode,
    remove the code block.

    Johannes: I'll note that the comment indicated it was for backward
    compatibility, but the code wasn't functional since switching the
    monitor channel isn't supported (any more?) when in managed mode, as
    that mode owns the channel configuration. Additionally, since monitor
    can't be done on a managed mode interface, this would only have had
    any effect to start with if a separate monitor interface is present,
    in which case it's better to change the channel through that anyway,
    if even possible.

    Signed-off-by: Jorge Ramirez-Ortiz
    Signed-off-by: Johannes Berg

    Jorge Ramirez-Ortiz
     

30 Sep, 2016

1 commit


15 Sep, 2016

1 commit

  • There's no point in allowing connect keys when one of them
    isn't also configured as the TX key, it would just confuse
    drivers and probably cause them to pick something for TX.
    Disallow this confusing and erroneous configuration.

    As wpa_supplicant will always send NL80211_ATTR_KEYS, even
    when there are no keys inside, allow that and treat it as
    though the attribute isn't present at all.

    Signed-off-by: Johannes Berg

    Johannes Berg
     

14 Sep, 2016

1 commit


04 Mar, 2015

1 commit


11 Sep, 2014

1 commit


25 Apr, 2014

1 commit


10 Apr, 2014

1 commit


20 Mar, 2014

1 commit


04 Jun, 2013

1 commit

  • The current internal SME implementation in cfg80211 is
    very mixed up with the MLME handling, which has been
    causing issues for a long time. There are three things
    that the implementation has to provide:
    * a basic SME implementation for nl80211's connect()
    call (for drivers implementing auth/assoc, which is
    really just mac80211) and wireless extensions
    * MLME events for the userspace SME
    * SME events (connected, disconnected etc.) for all
    different SME implementation possibilities (driver,
    cfg80211 and userspace)

    To achieve these goals it isn't necessary to track the
    software SME's connection status outside of it's state
    (which is the part that caused many issues.) Instead,
    track it only in the SME data (wdev->conn) and in the
    general case only track whether the wdev is connected
    or not (via wdev->current_bss.)

    Also separate the internal implementation to not have
    callbacks from the SME events, but rather call it from
    the API functions that the driver (or rather mac80211)
    calls. This separates the code better.

    Signed-off-by: Johannes Berg

    Johannes Berg
     

25 May, 2013

2 commits

  • By making all the API functions require wdev locking we
    can clean up the API a bit, getting rid of the locking
    version of each function. This also decreases the size
    of cfg80211 by a small amount.

    Signed-off-by: Johannes Berg

    Johannes Berg
     
  • Virtually all code paths in cfg80211 already (need to) hold
    the RTNL. As such, there's little point in having another
    four mutexes for various parts of the code, they just cause
    lock ordering issues (and much of the time, the RTNL and a
    few of the others need thus be held.)

    Simplify all this by getting rid of the extra four mutexes
    and just use the RTNL throughout. Only a few code changes
    were needed to do this and we can get rid of a work struct
    for bonus points.

    Signed-off-by: Johannes Berg

    Johannes Berg
     

24 Mar, 2013

1 commit

  • If a P2P device wdev is removed while it has a scan, then the
    scan completion might crash later as it is already freed by
    that time. To avoid the crash always check the scan completion
    when the P2P device is being removed for some reason. If the
    driver already canceled it, don't want and free it, otherwise
    warn and leak it to avoid later crashes.

    In order to do this, locking needs to be changed away from the
    rdev mutex (which can't always be guaranteed). For now, use
    the sched_scan_mtx instead, I'll rename it to just scan_mtx in
    a later patch.

    Signed-off-by: Johannes Berg

    Johannes Berg
     

30 Nov, 2012

1 commit

  • When a BSS struct is updated, the IEs are currently
    overwritten or freed. This can lead to races if some
    other CPU is accessing the BSS struct and using the
    IEs concurrently.

    Fix this by always allocating the IEs in a new struct
    that holds the data and length and protecting access
    to this new struct with RCU.

    Signed-off-by: Johannes Berg

    Johannes Berg
     

26 Nov, 2012

2 commits

  • Change nl80211 to support specifying a VHT (or HT)
    using the control channel frequency (as before) and
    new attributes for the channel width and first and
    second center frequency. The old channel type is of
    course still supported for HT.

    Also change the cfg80211 channel definition struct
    to support these by adding the relevant fields to
    it (and removing the _type field.)

    This also adds new helper functions:
    - cfg80211_chandef_create to create a channel def
    struct given the control channel and channel type,
    - cfg80211_chandef_identical to check if two channel
    definitions are identical
    - cfg80211_chandef_compatible to check if the given
    channel definitions are compatible, and return the
    wider of the two

    This isn't entirely complete, but that doesn't matter
    until we have a driver using it. In particular, it's
    missing
    - regulatory checks on the usable bandwidth (if that
    even makes sense)
    - regulatory TX power (database can't deal with it)
    - a proper channel compatibility calculation for the
    new channel types

    Signed-off-by: Johannes Berg

    Johannes Berg
     
  • Instead of passing a channel pointer and channel type
    to all functions and driver methods, pass a new channel
    definition struct. Right now, this struct contains just
    the control channel and channel type, but for VHT this
    will change.

    Also, add a small inline cfg80211_get_chandef_type() so
    that drivers don't need to use the _type field of the
    new structure all the time, which will change.

    Signed-off-by: Johannes Berg

    Johannes Berg
     

07 Jun, 2012

1 commit

  • Now that we've removed all uses of the set_channel
    API except for the monitor channel and in libertas,
    clarify this. Split the libertas mesh use into a
    new libertas_set_mesh_channel() operation, just to
    keep backward compatibility, and rename the normal
    set_channel() to set_monitor_channel().

    Also describe the desired set_monitor_channel()
    semantics more clearly.

    Signed-off-by: Johannes Berg
    Signed-off-by: John W. Linville

    Johannes Berg
     

10 May, 2012

1 commit

  • Use the new bool function ether_addr_equal to add
    some clarity and reduce the likelihood for misuse
    of compare_ether_addr for sorting.

    I removed a conversion from scan.c/cmp_bss_core
    that appears to be a sorting function.

    Done via cocci script:

    $ cat compare_ether_addr.cocci
    @@
    expression a,b;
    @@
    - !compare_ether_addr(a, b)
    + ether_addr_equal(a, b)

    @@
    expression a,b;
    @@
    - compare_ether_addr(a, b)
    + !ether_addr_equal(a, b)

    @@
    expression a,b;
    @@
    - !ether_addr_equal(a, b) == 0
    + ether_addr_equal(a, b)

    @@
    expression a,b;
    @@
    - !ether_addr_equal(a, b) != 0
    + !ether_addr_equal(a, b)

    @@
    expression a,b;
    @@
    - ether_addr_equal(a, b) == 0
    + !ether_addr_equal(a, b)

    @@
    expression a,b;
    @@
    - ether_addr_equal(a, b) != 0
    + ether_addr_equal(a, b)

    @@
    expression a,b;
    @@
    - !!ether_addr_equal(a, b)
    + ether_addr_equal(a, b)

    Signed-off-by: Joe Perches
    Signed-off-by: David S. Miller

    Joe Perches
     

13 Mar, 2012

1 commit


01 Nov, 2011

1 commit


09 Aug, 2011

2 commits

  • A lot of code is dedicated to giving drivers the
    ability to use cfg80211's wext handlers without
    completely converting. However, only orinoco is
    currently using this, and it is only partially
    using it.

    We reduce the size of both the source and binary
    by removing those that nobody needs. If a driver
    shows up that needs it during conversion, we can
    add back those that are needed.

    Signed-off-by: Johannes Berg
    Signed-off-by: John W. Linville

    Johannes Berg
     
  • A lot of drivers erroneously use wext constants
    and don't notice since cfg80211.h includes them.
    Make this more split up so drivers needing wext
    compatibility from cfg80211 need to explicitly
    include that from cfg80211-wext.h.

    Signed-off-by: Johannes Berg
    Signed-off-by: John W. Linville

    Johannes Berg
     

28 Aug, 2010

1 commit

  • Some vendor specified mechanisms for 802.1X-style
    functionality use a different protocol than EAP
    (even if EAP is vendor-extensible). Allow setting
    the ethertype for the protocol when a driver has
    support for this. The default if unspecified is
    EAP, of course.

    Note: This is suitable only for station mode, not
    for AP implementation.

    Signed-off-by: Johannes Berg
    Signed-off-by: Juuso Oikarinen
    Signed-off-by: John W. Linville

    Johannes Berg
     

12 May, 2010

1 commit


08 May, 2010

1 commit

  • Currently (all tested with hwsim) you can do stupid
    things like setting up an AP on a certain channel,
    then adding another virtual interface and making
    that associate on another channel -- this will make
    the beaconing to move channel but obviously without
    the necessary IEs data update.

    In order to improve this situation, first make the
    configuration APIs (cfg80211 and nl80211) aware of
    multi-channel operation -- we'll eventually need
    that in the future anyway. There's one userland API
    change and one API addition. The API change is that
    now SET_WIPHY must be called with virtual interface
    index rather than only wiphy index in order to take
    effect for that interface -- luckily all current
    users (hostapd) do that. For monitor interfaces, the
    old setting is preserved, but monitors are always
    slaved to other devices anyway so no guarantees.

    The second userland API change is the introduction
    of a per virtual interface SET_CHANNEL command, that
    hostapd should use going forward to make it easier
    to understand what's going on (it can automatically
    detect a kernel with this command).

    Other than mac80211, no existing cfg80211 drivers
    are affected by this change because they only allow
    a single virtual interface.

    mac80211, however, now needs to be aware that the
    channel settings are per interface now, and needs
    to disallow (for now) real multi-channel operation,
    which is another important part of this patch.

    One of the immediate benefits is that you can now
    start hostapd to operate on a hardware that already
    has a connection on another virtual interface, as
    long as you specify the same channel.

    Note that two things are left unhandled (this is an
    improvement -- not a complete fix):

    * different HT/no-HT modes

    currently you could start an HT AP and then
    connect to a non-HT network on the same channel
    which would configure the hardware for no HT;
    that can be fixed fairly easily

    * CSA

    An AP we're connected to on a virtual interface
    might indicate switching channels, and in that
    case we would follow it, regardless of how many
    other interfaces are operating; this requires
    more effort to fix but is pretty rare after all

    Signed-off-by: Johannes Berg
    Signed-off-by: John W. Linville

    Johannes Berg
     

30 Mar, 2010

1 commit

  • …it slab.h inclusion from percpu.h

    percpu.h is included by sched.h and module.h and thus ends up being
    included when building most .c files. percpu.h includes slab.h which
    in turn includes gfp.h making everything defined by the two files
    universally available and complicating inclusion dependencies.

    percpu.h -> slab.h dependency is about to be removed. Prepare for
    this change by updating users of gfp and slab facilities include those
    headers directly instead of assuming availability. As this conversion
    needs to touch large number of source files, the following script is
    used as the basis of conversion.

    http://userweb.kernel.org/~tj/misc/slabh-sweep.py

    The script does the followings.

    * Scan files for gfp and slab usages and update includes such that
    only the necessary includes are there. ie. if only gfp is used,
    gfp.h, if slab is used, slab.h.

    * When the script inserts a new include, it looks at the include
    blocks and try to put the new include such that its order conforms
    to its surrounding. It's put in the include block which contains
    core kernel includes, in the same order that the rest are ordered -
    alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
    doesn't seem to be any matching order.

    * If the script can't find a place to put a new include (mostly
    because the file doesn't have fitting include block), it prints out
    an error message indicating which .h file needs to be added to the
    file.

    The conversion was done in the following steps.

    1. The initial automatic conversion of all .c files updated slightly
    over 4000 files, deleting around 700 includes and adding ~480 gfp.h
    and ~3000 slab.h inclusions. The script emitted errors for ~400
    files.

    2. Each error was manually checked. Some didn't need the inclusion,
    some needed manual addition while adding it to implementation .h or
    embedding .c file was more appropriate for others. This step added
    inclusions to around 150 files.

    3. The script was run again and the output was compared to the edits
    from #2 to make sure no file was left behind.

    4. Several build tests were done and a couple of problems were fixed.
    e.g. lib/decompress_*.c used malloc/free() wrappers around slab
    APIs requiring slab.h to be added manually.

    5. The script was run on all .h files but without automatically
    editing them as sprinkling gfp.h and slab.h inclusions around .h
    files could easily lead to inclusion dependency hell. Most gfp.h
    inclusion directives were ignored as stuff from gfp.h was usually
    wildly available and often used in preprocessor macros. Each
    slab.h inclusion directive was examined and added manually as
    necessary.

    6. percpu.h was updated not to include slab.h.

    7. Build test were done on the following configurations and failures
    were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
    distributed build env didn't work with gcov compiles) and a few
    more options had to be turned off depending on archs to make things
    build (like ipr on powerpc/64 which failed due to missing writeq).

    * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
    * powerpc and powerpc64 SMP allmodconfig
    * sparc and sparc64 SMP allmodconfig
    * ia64 SMP allmodconfig
    * s390 SMP allmodconfig
    * alpha SMP allmodconfig
    * um on x86_64 SMP allmodconfig

    8. percpu.h modifications were reverted so that it could be applied as
    a separate patch and serve as bisection point.

    Given the fact that I had only a couple of failures from tests on step
    6, I'm fairly confident about the coverage of this conversion patch.
    If there is a breakage, it's likely to be something in one of the arch
    headers which should be easily discoverable easily on most builds of
    the specific arch.

    Signed-off-by: Tejun Heo <tj@kernel.org>
    Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>

    Tejun Heo
     

29 Sep, 2009

2 commits

  • When wpa_supplicant is used to connect to open networks,
    it causes the wdev->wext.keys to point to key memory, but
    that key memory is all empty. Only use privacy when there
    is a default key to be used.

    Signed-off-by: Johannes Berg
    Tested-by: Luis R. Rodriguez
    Tested-by: Kalle Valo
    Signed-off-by: John W. Linville

    Johannes Berg
     
  • Currently, cfg80211's SIOCGIWAP implementation returns
    the BSSID that the user set, even if the connection has
    since been dropped due to other changes. It only should
    return the current BSSID when actually connected.

    Also do a small code cleanup.

    Reported-by: Thomas H. Guenther
    Signed-off-by: Johannes Berg
    Tested-by: Thomas H. Guenther
    Signed-off-by: John W. Linville

    Johannes Berg
     

23 Sep, 2009

1 commit

  • When cfg80211 is instructed to connect, it always
    uses the default WEP key for the privacy setting,
    which clearly is wrong when using wpa_supplicant.
    Don't overwrite the setting, and rely on it being
    false when wpa_supplicant is not running, instead
    set it to true when we have keys.

    Signed-off-by: Johannes Berg
    Signed-off-by: John W. Linville

    Johannes Berg
     

14 Aug, 2009

4 commits

  • "cfg80211: validate channel settings across interfaces"
    contained a locking bug -- in the managed-mode SIWFREQ
    call it would end up running into a lock recursion.

    This fixes it by not checking that particular interface
    for a channel that it needs to stay on, which is as it
    should be as that's the interface we're setting the
    channel for.

    Reported-by: Reinette Chatre
    Reported-by: Kalle Valo
    Signed-off-by: Johannes Berg
    Tested-by: Kalle Valo
    Tested-by: Reinette Chatre
    Signed-off-by: John W. Linville

    Johannes Berg
     
  • With the move of everything related to the SME from
    mac80211 to cfg80211, we lost the ability to send
    reassociation frames. This adds them back, but only
    for wireless extensions. With the userspace SME, it
    shall control assoc vs. reassoc (it already can do
    so with the nl80211 interface).

    I haven't touched the connect() implementation, so
    it is not possible to reassociate with the nl80211
    connect primitive. I think that should be done with
    the NL80211_CMD_ROAM command, but we'll have to see
    how that can be handled in the future, especially
    with fullmac chips.

    This patch addresses only the immediate regression
    we had in mac80211, which previously sent reassoc.

    Signed-off-by: Johannes Berg
    Signed-off-by: John W. Linville

    Johannes Berg
     
  • Currently, there's a problem that affects regulatory
    enforcement and connection stability, in that it is
    possible to switch the channel while connected to a
    network or joined to an IBSS.

    The problem comes from the fact that we only validate
    the channel against the current interface's type, not
    against any other interface. Thus, you have any type
    of interface up, additionally bring up a monitor mode
    interface and switch the channel on the monitor. This
    will obviously also switch the channel on the other
    interface.

    The problem now is that if you do that while sending
    beacons for IBSS mode, you can switch to a disabled
    channel or a channel that doesn't allow beaconing.
    Combined with a managed mode interface connected to
    an AP instead of an IBSS interface, you can easily
    break the connection that way.

    To fix this, this patch validates any channel change
    with all available interfaces, and disallows such
    changes on secondary interfaces if another interface
    is connected to an AP or joined to an IBSS.

    Signed-off-by: Johannes Berg
    Signed-off-by: John W. Linville

    Johannes Berg
     
  • cfg80211 displays correct link info when connected by wext. But if
    the connection is setup by cfg80211, wext cannot display the SSID.
    This patch fixed this issue.

    Cc: Johannes Berg
    Signed-off-by: Zhu Yi
    Signed-off-by: John W. Linville

    Zhu Yi
     

30 Jul, 2009

3 commits


25 Jul, 2009

3 commits

  • In the wext code I tried to not reconnect all the time
    when the user wasn't really sure what they were doing,
    like setting the BSSID back to the same value it was.
    However, this optimisation should only be done while
    associated so that setting the BSSID back to the same
    value that it was actually triggers a new association
    if not currently associated. To achieve, that, put the
    relevant code into the !IDLE case instead.

    Signed-off-by: Johannes Berg
    Tested-by: Kalle Valo
    Tested-by: Marcel Holtmann
    Signed-off-by: John W. Linville

    Johannes Berg
     
  • Pavel reported that you can't set the SSID from "foo" to
    "bar". I tried reproducing, but used different values,
    with different lengths, and thus never saw the obvious
    problem.

    Reported-by: Pavel Roskin
    Signed-off-by: Johannes Berg
    Signed-off-by: John W. Linville

    Johannes Berg
     
  • This variable is only used internally, _while_ connected.
    If we use it, the sequence

    # iwconfig wlan1 essid foo

    # iwconfig wlan1 essid ""

    # iwconfig

    will still display "foo" as the SSID afterwards, which
    is obviously quite bogus. Fix this by only displaying
    the wext SSID, if present.

    Signed-off-by: Johannes Berg
    Signed-off-by: John W. Linville

    Johannes Berg