1. 19 6月, 2019 1 次提交
  2. 28 4月, 2019 2 次提交
    • J
      genetlink: optionally validate strictly/dumps · ef6243ac
      Johannes Berg 提交于
      Add options to strictly validate messages and dump messages,
      sometimes perhaps validating dump messages non-strictly may
      be required, so add an option for that as well.
      
      Since none of this can really be applied to existing commands,
      set the options everwhere using the following spatch:
      
          @@
          identifier ops;
          expression X;
          @@
          struct genl_ops ops[] = {
          ...,
           {
                  .cmd = X,
          +       .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
                  ...
           },
          ...
          };
      
      For new commands one should just not copy the .validate 'opt-out'
      flags and thus get strict validation.
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      ef6243ac
    • J
      netlink: make validation more configurable for future strictness · 8cb08174
      Johannes Berg 提交于
      We currently have two levels of strict validation:
      
       1) liberal (default)
           - undefined (type >= max) & NLA_UNSPEC attributes accepted
           - attribute length >= expected accepted
           - garbage at end of message accepted
       2) strict (opt-in)
           - NLA_UNSPEC attributes accepted
           - attribute length >= expected accepted
      
      Split out parsing strictness into four different options:
       * TRAILING     - check that there's no trailing data after parsing
                        attributes (in message or nested)
       * MAXTYPE      - reject attrs > max known type
       * UNSPEC       - reject attributes with NLA_UNSPEC policy entries
       * STRICT_ATTRS - strictly validate attribute size
      
      The default for future things should be *everything*.
      The current *_strict() is a combination of TRAILING and MAXTYPE,
      and is renamed to _deprecated_strict().
      The current regular parsing has none of this, and is renamed to
      *_parse_deprecated().
      
      Additionally it allows us to selectively set one of the new flags
      even on old policies. Notably, the UNSPEC flag could be useful in
      this case, since it can be arranged (by filling in the policy) to
      not be an incompatible userspace ABI change, but would then going
      forward prevent forgetting attribute entries. Similar can apply
      to the POLICY flag.
      
      We end up with the following renames:
       * nla_parse           -> nla_parse_deprecated
       * nla_parse_strict    -> nla_parse_deprecated_strict
       * nlmsg_parse         -> nlmsg_parse_deprecated
       * nlmsg_parse_strict  -> nlmsg_parse_deprecated_strict
       * nla_parse_nested    -> nla_parse_nested_deprecated
       * nla_validate_nested -> nla_validate_nested_deprecated
      
      Using spatch, of course:
          @@
          expression TB, MAX, HEAD, LEN, POL, EXT;
          @@
          -nla_parse(TB, MAX, HEAD, LEN, POL, EXT)
          +nla_parse_deprecated(TB, MAX, HEAD, LEN, POL, EXT)
      
          @@
          expression NLH, HDRLEN, TB, MAX, POL, EXT;
          @@
          -nlmsg_parse(NLH, HDRLEN, TB, MAX, POL, EXT)
          +nlmsg_parse_deprecated(NLH, HDRLEN, TB, MAX, POL, EXT)
      
          @@
          expression NLH, HDRLEN, TB, MAX, POL, EXT;
          @@
          -nlmsg_parse_strict(NLH, HDRLEN, TB, MAX, POL, EXT)
          +nlmsg_parse_deprecated_strict(NLH, HDRLEN, TB, MAX, POL, EXT)
      
          @@
          expression TB, MAX, NLA, POL, EXT;
          @@
          -nla_parse_nested(TB, MAX, NLA, POL, EXT)
          +nla_parse_nested_deprecated(TB, MAX, NLA, POL, EXT)
      
          @@
          expression START, MAX, POL, EXT;
          @@
          -nla_validate_nested(START, MAX, POL, EXT)
          +nla_validate_nested_deprecated(START, MAX, POL, EXT)
      
          @@
          expression NLH, HDRLEN, MAX, POL, EXT;
          @@
          -nlmsg_validate(NLH, HDRLEN, MAX, POL, EXT)
          +nlmsg_validate_deprecated(NLH, HDRLEN, MAX, POL, EXT)
      
      For this patch, don't actually add the strict, non-renamed versions
      yet so that it breaks compile if I get it wrong.
      
      Also, while at it, make nla_validate and nla_parse go down to a
      common __nla_validate_parse() function to avoid code duplication.
      
      Ultimately, this allows us to have very strict validation for every
      new caller of nla_parse()/nlmsg_parse() etc as re-introduced in the
      next patch, while existing things will continue to work as is.
      
      In effect then, this adds fully strict validation for any new command.
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      8cb08174
  3. 26 4月, 2019 2 次提交
  4. 08 4月, 2019 1 次提交
  5. 22 3月, 2019 2 次提交
  6. 22 2月, 2019 1 次提交
  7. 08 2月, 2019 1 次提交
  8. 06 2月, 2019 1 次提交
    • J
      mac80211_hwsim: Support boottime in scan results · 341203e7
      Jouni Malinen 提交于
      This makes the age information for cfg80211 scan results more accurate
      and fixes issues with wpa_supplicant dropping "old" scan results (e.g.,
      "wlan0: Own scan request started a scan in 0.000456 seconds") that
      looked like would have been received before a scan started due to the
      inaccuracy of the default timing mechanism for calculating the BSS entry
      age. This makes hwsim test cases significantly more robust to run.
      Signed-off-by: NJouni Malinen <j@w1.fi>
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      341203e7
  9. 19 1月, 2019 1 次提交
  10. 18 12月, 2018 1 次提交
  11. 05 12月, 2018 1 次提交
  12. 09 11月, 2018 5 次提交
  13. 08 10月, 2018 1 次提交
  14. 26 9月, 2018 3 次提交
  15. 05 9月, 2018 1 次提交
  16. 28 8月, 2018 2 次提交
  17. 16 8月, 2018 1 次提交
  18. 09 7月, 2018 1 次提交
  19. 15 6月, 2018 1 次提交
  20. 29 5月, 2018 1 次提交
  21. 22 5月, 2018 1 次提交
  22. 07 5月, 2018 1 次提交
  23. 19 4月, 2018 1 次提交
  24. 12 4月, 2018 1 次提交
  25. 28 3月, 2018 1 次提交
  26. 21 3月, 2018 3 次提交
  27. 02 3月, 2018 2 次提交
    • K
      net: Convert hwsim_net_ops · 2e75bb2f
      Kirill Tkhai 提交于
      These pernet_operations allocate and destroy IDA identifier,
      and these actions are synchronized by IDA subsystem locks.
      Exit method removes mac80211_hwsim_data enteries from the lists,
      and this is synchronized by hwsim_radio_lock with the rest
      parallel pernet_operations. Also it queues destroy_radio()
      work, and these work already may be executed in parallel
      with any pernet_operations (as it's a work :). So, we may
      mark these pernet_operations as async.
      Signed-off-by: NKirill Tkhai <ktkhai@virtuozzo.com>
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      2e75bb2f
    • K
      mac80211_hwsim: Make hwsim_netgroup IDA · 03695549
      Kirill Tkhai 提交于
      hwsim_netgroup counter is declarated as int, and it is incremented
      every time a new net is created. After sizeof(int) net are created,
      it will overflow, and different net namespaces will have the same
      identifier. This patch fixes the problem by introducing IDA instead
      of int counter. IDA guarantees, all the net namespaces have the uniq
      identifier.
      
      Note, that after we do ida_simple_remove() in hwsim_exit_net(),
      and we destroy the ID, later there may be executed destroy_radio()
      from the workqueue. But destroy_radio() does not use the ID, so it's OK.
      
      Out of bounds of this patch, just as a report to wireless subsystem
      maintainer, destroy_radio() increaments hwsim_radios_generation
      without hwsim_radio_lock, so this may need one more patch to fix.
      Signed-off-by: NKirill Tkhai <ktkhai@virtuozzo.com>
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      03695549