1. 09 11月, 2018 1 次提交
    • J
      cfg80211: add peer measurement with FTM initiator API · 9bb7e0f2
      Johannes Berg 提交于
      Add a new "peer measurement" API, that can be used to measure
      certain things related to a peer. Right now, only implement
      FTM (flight time measurement) over it, but the idea is that
      it'll be extensible to also support measuring the necessary
      things to calculate e.g. angle-of-arrival for WiGig.
      
      The API is structured to have a generic list of peers and
      channels to measure with/on, and then for each of those a
      set of measurements (again, only FTM right now) to perform.
      
      Results are sent to the requesting socket, including a final
      complete message.
      
      Closing the controlling netlink socket will abort a running
      measurement.
      
      v3:
       - add a bit to report "final" for partial results
       - remove list keeping etc. and just unicast out the results
         to the requester (big code reduction ...)
       - also send complete message unicast, and as a result
         remove the multicast group
       - separate out struct cfg80211_pmsr_ftm_request_peer
         from struct cfg80211_pmsr_request_peer
       - document timeout == 0 if no timeout
       - disallow setting timeout nl80211 attribute to 0,
         must not include attribute for no timeout
       - make MAC address randomization optional
       - change num bursts exponent default to 0 (1 burst, rather
         rather than the old default of 15==don't care)
      
      v4:
       - clarify NL80211_ATTR_TIMEOUT documentation
      
      v5:
       - remove unnecessary nl80211 multicast/family changes
       - remove partial results bit/flag, final is sufficient
       - add max_bursts_exponent, max_ftms_per_burst to capability
       - rename "frames per burst" -> "FTMs per burst"
      
      v6:
       - rename cfg80211_pmsr_free_wdev() to cfg80211_pmsr_wdev_down()
         and call it in leave, so the device can't go down with any
         pending measurements
      
      v7:
       - wording fixes (Lior)
       - fix ftm.max_bursts_exponent to allow having the limit of 0 (Lior)
      
      v8:
       - copyright statements
       - minor coding style fixes
       - fix error path leak
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      9bb7e0f2
  2. 12 10月, 2018 1 次提交
    • A
      nl80211: Add per peer statistics to compute FCS error rate · 0d4e14a3
      Ankita Bajaj 提交于
      Add support for drivers to report the total number of MPDUs received
      and the number of MPDUs received with an FCS error from a specific
      peer. These counters will be incremented only when the TA of the
      frame matches the MAC address of the peer irrespective of FCS
      error.
      
      It should be noted that the TA field in the frame might be corrupted
      when there is an FCS error and TA matching logic would fail in such
      cases. Hence, FCS error counter might not be fully accurate, but it can
      provide help in detecting bad RX links in significant number of cases.
      This FCS error counter without full accuracy can be used, e.g., to
      trigger a kick-out of a connected client with a bad link in AP mode to
      force such a client to roam to another AP.
      Signed-off-by: NAnkita Bajaj <bankita@codeaurora.org>
      Signed-off-by: NJouni Malinen <jouni@codeaurora.org>
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      0d4e14a3
  3. 11 10月, 2018 2 次提交
  4. 02 10月, 2018 8 次提交
  5. 27 9月, 2018 1 次提交
  6. 26 9月, 2018 1 次提交
  7. 05 9月, 2018 1 次提交
  8. 30 8月, 2018 1 次提交
  9. 29 8月, 2018 1 次提交
    • B
      cfg80211: clarify frames covered by average ACK signal report · 9c06602b
      Balaji Pothunoori 提交于
      Modify the API to include all ACK frames in average ACK
      signal strength reporting, not just ACKs for data frames.
      Make exposing the data conditional on implementing the
      extended feature flag.
      
      This is how it was really implemented in mac80211, update
      the code there to use the new defines and clean up some of
      the setting code.
      
      Keep nl80211.h source compatibility by keeping the old names.
      Signed-off-by: NBalaji Pothunoori <bpothuno@codeaurora.org>
      [rewrite commit log, change compatibility to be old=new
       instead of the other way around, update kernel-doc,
       roll in mac80211 changes, make mac80211 depend on valid
       bit instead of HW flag]
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      9c06602b
  10. 28 8月, 2018 3 次提交
  11. 09 7月, 2018 1 次提交
  12. 06 7月, 2018 1 次提交
    • D
      nl80211/mac80211: allow non-linear skb in rx_control_port · a948f713
      Denis Kenzior 提交于
      The current implementation of cfg80211_rx_control_port assumed that the
      caller could provide a contiguous region of memory for the control port
      frame to be sent up to userspace.  Unfortunately, many drivers produce
      non-linear skbs, especially for data frames.  This resulted in userspace
      getting notified of control port frames with correct metadata (from
      address, port, etc) yet garbage / nonsense contents, resulting in bad
      handshakes, disconnections, etc.
      
      mac80211 linearizes skbs containing management frames.  But it didn't
      seem worthwhile to do this for control port frames.  Thus the signature
      of cfg80211_rx_control_port was changed to take the skb directly.
      nl80211 then takes care of obtaining control port frame data directly
      from the (linear | non-linear) skb.
      
      The caller is still responsible for freeing the skb,
      cfg80211_rx_control_port does not take ownership of it.
      
      Fixes: 6a671a50 ("nl80211: Add CMD_CONTROL_PORT_FRAME API")
      Signed-off-by: NDenis Kenzior <denkenz@gmail.com>
      [fix some kernel-doc formatting, add fixes tag]
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      a948f713
  13. 29 6月, 2018 3 次提交
    • O
      cfg80211: use BIT_ULL for NL80211_STA_INFO_* attribute types · 397c657a
      Omer Efrat 提交于
      The BIT macro uses unsigned long which some architectures handle as 32 bit
      and therefore might cause macro's shift to overflow when used on a value
      equals or larger than 32 (NL80211_STA_INFO_RX_DURATION and afterwards).
      
      Since 'filled' member in station_info changed to u64, BIT_ULL macro
      should be used with all NL80211_STA_INFO_* attribute types instead of BIT
      to prevent future possible bugs when one will use BIT macro for higher
      attributes by mistake.
      
      This commit cleans up all usages of BIT macro with the above field
      in cfg80211 by changing it to BIT_ULL instead. In addition, there are
      some places which don't use BIT nor BIT_ULL macros so align those as well.
      Signed-off-by: NOmer Efrat <omer.efrat@tandemg.com>
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      397c657a
    • J
      nl80211: check nla_parse_nested() return values · 95bca62f
      Johannes Berg 提交于
      At the very least we should check the return value if
      nla_parse_nested() is called with a non-NULL policy.
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      95bca62f
    • B
      nl80211: relax ht operation checks for mesh · 188f60ab
      Bob Copeland 提交于
      Commit 9757235f, "nl80211: correct checks for
      NL80211_MESHCONF_HT_OPMODE value") relaxed the range for the HT
      operation field in meshconf, while also adding checks requiring
      the non-greenfield and non-ht-sta bits to be set in certain
      circumstances.  The latter bit is actually reserved for mesh BSSes
      according to Table 9-168 in 802.11-2016, so in fact it should not
      be set.
      
      wpa_supplicant sets these bits because the mesh and AP code share
      the same implementation, but authsae does not.  As a result, some
      meshconf updates from authsae which set only the NONHT_MIXED
      protection bits were being rejected.
      
      In order to avoid breaking userspace by changing the rules again,
      simply accept the values with or without the bits set, and mask
      off the reserved bit to match the spec.
      
      While in here, update the 802.11-2012 reference to 802.11-2016.
      
      Fixes: 9757235f ("nl80211: correct checks for NL80211_MESHCONF_HT_OPMODE value")
      Cc: Masashi Honma <masashi.honma@gmail.com>
      Signed-off-by: NBob Copeland <bobcopeland@fb.com>
      Reviewed-by: NMasashi Honma <masashi.honma@gmail.com>
      Reviewed-by: NMasashi Honma <masashi.honma@gmail.com>
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      188f60ab
  14. 15 6月, 2018 4 次提交
  15. 13 6月, 2018 1 次提交
    • K
      treewide: kzalloc() -> kcalloc() · 6396bb22
      Kees Cook 提交于
      The kzalloc() function has a 2-factor argument form, kcalloc(). This
      patch replaces cases of:
      
              kzalloc(a * b, gfp)
      
      with:
              kcalloc(a * b, gfp)
      
      as well as handling cases of:
      
              kzalloc(a * b * c, gfp)
      
      with:
      
              kzalloc(array3_size(a, b, c), gfp)
      
      as it's slightly less ugly than:
      
              kzalloc_array(array_size(a, b), c, gfp)
      
      This does, however, attempt to ignore constant size factors like:
      
              kzalloc(4 * 1024, gfp)
      
      though any constants defined via macros get caught up in the conversion.
      
      Any factors with a sizeof() of "unsigned char", "char", and "u8" were
      dropped, since they're redundant.
      
      The Coccinelle script used for this was:
      
      // Fix redundant parens around sizeof().
      @@
      type TYPE;
      expression THING, E;
      @@
      
      (
        kzalloc(
      -	(sizeof(TYPE)) * E
      +	sizeof(TYPE) * E
        , ...)
      |
        kzalloc(
      -	(sizeof(THING)) * E
      +	sizeof(THING) * E
        , ...)
      )
      
      // Drop single-byte sizes and redundant parens.
      @@
      expression COUNT;
      typedef u8;
      typedef __u8;
      @@
      
      (
        kzalloc(
      -	sizeof(u8) * (COUNT)
      +	COUNT
        , ...)
      |
        kzalloc(
      -	sizeof(__u8) * (COUNT)
      +	COUNT
        , ...)
      |
        kzalloc(
      -	sizeof(char) * (COUNT)
      +	COUNT
        , ...)
      |
        kzalloc(
      -	sizeof(unsigned char) * (COUNT)
      +	COUNT
        , ...)
      |
        kzalloc(
      -	sizeof(u8) * COUNT
      +	COUNT
        , ...)
      |
        kzalloc(
      -	sizeof(__u8) * COUNT
      +	COUNT
        , ...)
      |
        kzalloc(
      -	sizeof(char) * COUNT
      +	COUNT
        , ...)
      |
        kzalloc(
      -	sizeof(unsigned char) * COUNT
      +	COUNT
        , ...)
      )
      
      // 2-factor product with sizeof(type/expression) and identifier or constant.
      @@
      type TYPE;
      expression THING;
      identifier COUNT_ID;
      constant COUNT_CONST;
      @@
      
      (
      - kzalloc
      + kcalloc
        (
      -	sizeof(TYPE) * (COUNT_ID)
      +	COUNT_ID, sizeof(TYPE)
        , ...)
      |
      - kzalloc
      + kcalloc
        (
      -	sizeof(TYPE) * COUNT_ID
      +	COUNT_ID, sizeof(TYPE)
        , ...)
      |
      - kzalloc
      + kcalloc
        (
      -	sizeof(TYPE) * (COUNT_CONST)
      +	COUNT_CONST, sizeof(TYPE)
        , ...)
      |
      - kzalloc
      + kcalloc
        (
      -	sizeof(TYPE) * COUNT_CONST
      +	COUNT_CONST, sizeof(TYPE)
        , ...)
      |
      - kzalloc
      + kcalloc
        (
      -	sizeof(THING) * (COUNT_ID)
      +	COUNT_ID, sizeof(THING)
        , ...)
      |
      - kzalloc
      + kcalloc
        (
      -	sizeof(THING) * COUNT_ID
      +	COUNT_ID, sizeof(THING)
        , ...)
      |
      - kzalloc
      + kcalloc
        (
      -	sizeof(THING) * (COUNT_CONST)
      +	COUNT_CONST, sizeof(THING)
        , ...)
      |
      - kzalloc
      + kcalloc
        (
      -	sizeof(THING) * COUNT_CONST
      +	COUNT_CONST, sizeof(THING)
        , ...)
      )
      
      // 2-factor product, only identifiers.
      @@
      identifier SIZE, COUNT;
      @@
      
      - kzalloc
      + kcalloc
        (
      -	SIZE * COUNT
      +	COUNT, SIZE
        , ...)
      
      // 3-factor product with 1 sizeof(type) or sizeof(expression), with
      // redundant parens removed.
      @@
      expression THING;
      identifier STRIDE, COUNT;
      type TYPE;
      @@
      
      (
        kzalloc(
      -	sizeof(TYPE) * (COUNT) * (STRIDE)
      +	array3_size(COUNT, STRIDE, sizeof(TYPE))
        , ...)
      |
        kzalloc(
      -	sizeof(TYPE) * (COUNT) * STRIDE
      +	array3_size(COUNT, STRIDE, sizeof(TYPE))
        , ...)
      |
        kzalloc(
      -	sizeof(TYPE) * COUNT * (STRIDE)
      +	array3_size(COUNT, STRIDE, sizeof(TYPE))
        , ...)
      |
        kzalloc(
      -	sizeof(TYPE) * COUNT * STRIDE
      +	array3_size(COUNT, STRIDE, sizeof(TYPE))
        , ...)
      |
        kzalloc(
      -	sizeof(THING) * (COUNT) * (STRIDE)
      +	array3_size(COUNT, STRIDE, sizeof(THING))
        , ...)
      |
        kzalloc(
      -	sizeof(THING) * (COUNT) * STRIDE
      +	array3_size(COUNT, STRIDE, sizeof(THING))
        , ...)
      |
        kzalloc(
      -	sizeof(THING) * COUNT * (STRIDE)
      +	array3_size(COUNT, STRIDE, sizeof(THING))
        , ...)
      |
        kzalloc(
      -	sizeof(THING) * COUNT * STRIDE
      +	array3_size(COUNT, STRIDE, sizeof(THING))
        , ...)
      )
      
      // 3-factor product with 2 sizeof(variable), with redundant parens removed.
      @@
      expression THING1, THING2;
      identifier COUNT;
      type TYPE1, TYPE2;
      @@
      
      (
        kzalloc(
      -	sizeof(TYPE1) * sizeof(TYPE2) * COUNT
      +	array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
        , ...)
      |
        kzalloc(
      -	sizeof(TYPE1) * sizeof(THING2) * (COUNT)
      +	array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
        , ...)
      |
        kzalloc(
      -	sizeof(THING1) * sizeof(THING2) * COUNT
      +	array3_size(COUNT, sizeof(THING1), sizeof(THING2))
        , ...)
      |
        kzalloc(
      -	sizeof(THING1) * sizeof(THING2) * (COUNT)
      +	array3_size(COUNT, sizeof(THING1), sizeof(THING2))
        , ...)
      |
        kzalloc(
      -	sizeof(TYPE1) * sizeof(THING2) * COUNT
      +	array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
        , ...)
      |
        kzalloc(
      -	sizeof(TYPE1) * sizeof(THING2) * (COUNT)
      +	array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
        , ...)
      )
      
      // 3-factor product, only identifiers, with redundant parens removed.
      @@
      identifier STRIDE, SIZE, COUNT;
      @@
      
      (
        kzalloc(
      -	(COUNT) * STRIDE * SIZE
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      |
        kzalloc(
      -	COUNT * (STRIDE) * SIZE
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      |
        kzalloc(
      -	COUNT * STRIDE * (SIZE)
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      |
        kzalloc(
      -	(COUNT) * (STRIDE) * SIZE
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      |
        kzalloc(
      -	COUNT * (STRIDE) * (SIZE)
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      |
        kzalloc(
      -	(COUNT) * STRIDE * (SIZE)
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      |
        kzalloc(
      -	(COUNT) * (STRIDE) * (SIZE)
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      |
        kzalloc(
      -	COUNT * STRIDE * SIZE
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      )
      
      // Any remaining multi-factor products, first at least 3-factor products,
      // when they're not all constants...
      @@
      expression E1, E2, E3;
      constant C1, C2, C3;
      @@
      
      (
        kzalloc(C1 * C2 * C3, ...)
      |
        kzalloc(
      -	(E1) * E2 * E3
      +	array3_size(E1, E2, E3)
        , ...)
      |
        kzalloc(
      -	(E1) * (E2) * E3
      +	array3_size(E1, E2, E3)
        , ...)
      |
        kzalloc(
      -	(E1) * (E2) * (E3)
      +	array3_size(E1, E2, E3)
        , ...)
      |
        kzalloc(
      -	E1 * E2 * E3
      +	array3_size(E1, E2, E3)
        , ...)
      )
      
      // And then all remaining 2 factors products when they're not all constants,
      // keeping sizeof() as the second factor argument.
      @@
      expression THING, E1, E2;
      type TYPE;
      constant C1, C2, C3;
      @@
      
      (
        kzalloc(sizeof(THING) * C2, ...)
      |
        kzalloc(sizeof(TYPE) * C2, ...)
      |
        kzalloc(C1 * C2 * C3, ...)
      |
        kzalloc(C1 * C2, ...)
      |
      - kzalloc
      + kcalloc
        (
      -	sizeof(TYPE) * (E2)
      +	E2, sizeof(TYPE)
        , ...)
      |
      - kzalloc
      + kcalloc
        (
      -	sizeof(TYPE) * E2
      +	E2, sizeof(TYPE)
        , ...)
      |
      - kzalloc
      + kcalloc
        (
      -	sizeof(THING) * (E2)
      +	E2, sizeof(THING)
        , ...)
      |
      - kzalloc
      + kcalloc
        (
      -	sizeof(THING) * E2
      +	E2, sizeof(THING)
        , ...)
      |
      - kzalloc
      + kcalloc
        (
      -	(E1) * E2
      +	E1, E2
        , ...)
      |
      - kzalloc
      + kcalloc
        (
      -	(E1) * (E2)
      +	E1, E2
        , ...)
      |
      - kzalloc
      + kcalloc
        (
      -	E1 * E2
      +	E1, E2
        , ...)
      )
      Signed-off-by: NKees Cook <keescook@chromium.org>
      6396bb22
  16. 23 5月, 2018 5 次提交
  17. 22 5月, 2018 1 次提交
    • D
      nl80211: Fix compilation · ba8f566a
      Denis Kenzior 提交于
      Commit 7ea3e110 seems to have
      introduced:
      
      net/wireless/nl80211.c: In function ‘nl80211_get_station’:
      net/wireless/nl80211.c:4802:34: error: incompatible type for argument 1 of ‘cfg80211_sinfo_release_content’
         cfg80211_sinfo_release_content(sinfo);
                                        ^~~~~
      In file included from net/wireless/nl80211.c:24:0:
      ./include/net/cfg80211.h:5721:20: note: expected ‘struct station_info *’ but argument is of type ‘struct station_info’
       static inline void cfg80211_sinfo_release_content(struct station_info *sinfo)
                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      
      Fixes: 7ea3e110 ("cfg80211: release station info tidstats where needed")
      Signed-off-by: NDenis Kenzior <denkenz@gmail.com>
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      ba8f566a
  18. 18 5月, 2018 4 次提交