1. 07 7月, 2018 1 次提交
  2. 03 6月, 2018 1 次提交
    • P
      netfilter: nf_tables: add connlimit support · 290180e2
      Pablo Neira Ayuso 提交于
      This features which allows you to limit the maximum number of
      connections per arbitrary key. The connlimit expression is stateful,
      therefore it can be used from meters to dynamically populate a set, this
      provides a mapping to the iptables' connlimit match. This patch also
      comes that allows you define static connlimit policies.
      
      This extension depends on the nf_conncount infrastructure.
      Signed-off-by: NPablo Neira Ayuso <pablo@netfilter.org>
      290180e2
  3. 01 6月, 2018 1 次提交
  4. 29 5月, 2018 1 次提交
  5. 07 5月, 2018 1 次提交
  6. 27 4月, 2018 3 次提交
  7. 24 4月, 2018 1 次提交
  8. 22 4月, 2018 1 次提交
  9. 30 3月, 2018 1 次提交
  10. 09 1月, 2018 5 次提交
  11. 02 11月, 2017 1 次提交
    • G
      License cleanup: add SPDX GPL-2.0 license identifier to files with no license · b2441318
      Greg Kroah-Hartman 提交于
      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 <5
         lines).
      
      All documentation files were explicitly excluded.
      
      The following heuristics were used to determine which SPDX license
      identifiers to apply.
      
       - when both scanners couldn't find any license traces, file was
         considered to have no license information in it, and the top level
         COPYING file license applied.
      
         For non */uapi/* files that summary was:
      
         SPDX license identifier                            # files
         ---------------------------------------------------|-------
         GPL-2.0                                              11139
      
         and resulted in the first patch in this series.
      
         If that file was a */uapi/* path one, it was "GPL-2.0 WITH
         Linux-syscall-note" otherwise it was "GPL-2.0".  Results of that was:
      
         SPDX license identifier                            # files
         ---------------------------------------------------|-------
         GPL-2.0 WITH Linux-syscall-note                        930
      
         and resulted in the second patch in this series.
      
       - if a file had some form of licensing information in it, and was one
         of the */uapi/* ones, it was denoted with the Linux-syscall-note if
         any GPL family license was found in the file or had no licensing in
         it (per prior point).  Results summary:
      
         SPDX license identifier                            # files
         ---------------------------------------------------|------
         GPL-2.0 WITH Linux-syscall-note                       270
         GPL-2.0+ WITH Linux-syscall-note                      169
         ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause)    21
         ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)    17
         LGPL-2.1+ WITH Linux-syscall-note                      15
         GPL-1.0+ WITH Linux-syscall-note                       14
         ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause)    5
         LGPL-2.0+ WITH Linux-syscall-note                       4
         LGPL-2.1 WITH Linux-syscall-note                        3
         ((GPL-2.0 WITH Linux-syscall-note) OR MIT)              3
         ((GPL-2.0 WITH Linux-syscall-note) AND MIT)             1
      
         and that resulted in the third patch in this series.
      
       - when the two scanners agreed on the detected license(s), that became
         the concluded license(s).
      
       - when there was disagreement between the two scanners (one detected a
         license but the other didn't, or they both detected different
         licenses) a manual inspection of the file occurred.
      
       - In most cases a manual inspection of the information in the file
         resulted in a clear resolution of the license that should apply (and
         which scanner probably needed to revisit its heuristics).
      
       - When it was not immediately clear, the license identifier was
         confirmed with lawyers working with the Linux Foundation.
      
       - If there was any question as to the appropriate license identifier,
         the file was flagged for further research and to be revisited later
         in time.
      
      In total, over 70 hours of logged manual review was done on the
      spreadsheet to determine the SPDX license identifiers to apply to the
      source files by Kate, Philippe, Thomas and, in some cases, confirmation
      by lawyers working with the Linux Foundation.
      
      Kate also obtained a third independent scan of the 4.13 code base from
      FOSSology, and compared selected files where the other two scanners
      disagreed against that SPDX file, to see if there was new insights.  The
      Windriver scanner is based on an older version of FOSSology in part, so
      they are related.
      
      Thomas did random spot checks in about 500 files from the spreadsheets
      for the uapi headers and agreed with SPDX license identifier in the
      files he inspected. For the non-uapi files Thomas did random spot checks
      in about 15000 files.
      
      In initial set of patches against 4.14-rc6, 3 files were found to have
      copy/paste license identifier errors, and have been fixed to reflect the
      correct identifier.
      
      Additionally Philippe spent 10 hours this week doing a detailed manual
      inspection and review of the 12,461 patched files from the initial patch
      version early this week with:
       - a full scancode scan run, collecting the matched texts, detected
         license ids and scores
       - reviewing anything where there was a license detected (about 500+
         files) to ensure that the applied SPDX license was correct
       - reviewing anything where there was no detection but the patch license
         was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied
         SPDX license was correct
      
      This produced a worksheet with 20 files needing minor correction.  This
      worksheet was then exported into 3 different .csv files for the
      different types of files to be modified.
      
      These .csv files were then reviewed by Greg.  Thomas wrote a script to
      parse the csv files and add the proper SPDX tag to the file, in the
      format that the file expected.  This script was further refined by Greg
      based on the output to detect more types of files automatically and to
      distinguish between header and source .c files (which need different
      comment types.)  Finally Greg ran the script using the .csv files to
      generate the patches.
      Reviewed-by: NKate Stewart <kstewart@linuxfoundation.org>
      Reviewed-by: NPhilippe Ombredanne <pombredanne@nexb.com>
      Reviewed-by: NThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b2441318
  12. 01 8月, 2017 1 次提交
  13. 20 6月, 2017 1 次提交
  14. 08 2月, 2017 1 次提交
    • P
      netfilter: nf_tables: add bitmap set type · 665153ff
      Pablo Neira Ayuso 提交于
      This patch adds a new bitmap set type. This bitmap uses two bits to
      represent one element. These two bits determine the element state in the
      current and the future generation that fits into the nf_tables commit
      protocol. When dumping elements back to userspace, the two bits are
      expanded into a struct nft_set_ext object.
      
      If no NFTA_SET_DESC_SIZE is specified, the existing automatic set
      backend selection prefers bitmap over hash in case of keys whose size is
      <= 16 bit. If the set size is know, the bitmap set type is selected if
      with 16 bit kets and more than 390 elements in the set, otherwise the
      hash table set implementation is used.
      
      For 8 bit keys, the bitmap consumes 66 bytes. For 16 bit keys, the
      bitmap takes 16388 bytes.
      Signed-off-by: NPablo Neira Ayuso <pablo@netfilter.org>
      665153ff
  15. 03 1月, 2017 2 次提交
    • F
      netfilter: nat: merge udp and udplite helpers · 9700ba80
      Florian Westphal 提交于
      udplite nat was copied from udp nat, they are virtually 100% identical.
      Not really surprising given udplite is just udp with partial csum coverage.
      
      old:
         text    data     bss     dec     hex filename
        11606    1457     210   13273    33d9 nf_nat.ko
          330       0       2     332     14c nf_nat_proto_udp.o
          276       0       2     278     116 nf_nat_proto_udplite.o
      new:
         text    data     bss     dec     hex filename
        11598    1457     210   13265    33d1 nf_nat.ko
          640       0       4     644     284 nf_nat_proto_udp.o
      Signed-off-by: NFlorian Westphal <fw@strlen.de>
      Signed-off-by: NPablo Neira Ayuso <pablo@netfilter.org>
      9700ba80
    • F
      netfilter: merge udp and udplite conntrack helpers · e4781421
      Florian Westphal 提交于
      udplite was copied from udp, they are virtually 100% identical.
      
      This adds udplite tracker to udp instead, removes udplite module,
      and then makes the udplite tracker builtin.
      
      udplite will then simply re-use udp timeout settings.
      It makes little sense to add separate sysctls, nowadays we have
      fine-grained timeout policy support via the CT target.
      
      old:
       text    data     bss     dec     hex filename
       1633     672       0    2305     901 nf_conntrack_proto_udp.o
       1756     672       0    2428     97c nf_conntrack_proto_udplite.o
      69526   17937     268   87731   156b3 nf_conntrack.ko
      
      new:
       text    data     bss     dec     hex filename
       2442    1184       0    3626     e2a nf_conntrack_proto_udp.o
      68565   17721     268   86554   1521a nf_conntrack.ko
      Signed-off-by: NFlorian Westphal <fw@strlen.de>
      Signed-off-by: NPablo Neira Ayuso <pablo@netfilter.org>
      e4781421
  16. 07 12月, 2016 1 次提交
  17. 05 12月, 2016 6 次提交
  18. 02 11月, 2016 3 次提交
    • A
      netfilter: nf_tables: introduce routing expression · 2fa84193
      Anders K. Pedersen 提交于
      Introduces an nftables rt expression for routing related data with support
      for nexthop (i.e. the directly connected IP address that an outgoing packet
      is sent to), which can be used either for matching or accounting, eg.
      
       # nft add rule filter postrouting \
      	ip daddr 192.168.1.0/24 rt nexthop != 192.168.0.1 drop
      
      This will drop any traffic to 192.168.1.0/24 that is not routed via
      192.168.0.1.
      
       # nft add rule filter postrouting \
      	flow table acct { rt nexthop timeout 600s counter }
       # nft add rule ip6 filter postrouting \
      	flow table acct { rt nexthop timeout 600s counter }
      
      These rules count outgoing traffic per nexthop. Note that the timeout
      releases an entry if no traffic is seen for this nexthop within 10 minutes.
      
       # nft add rule inet filter postrouting \
      	ether type ip \
      	flow table acct { rt nexthop timeout 600s counter }
       # nft add rule inet filter postrouting \
      	ether type ip6 \
      	flow table acct { rt nexthop timeout 600s counter }
      
      Same as above, but via the inet family, where the ether type must be
      specified explicitly.
      
      "rt classid" is also implemented identical to "meta rtclassid", since it
      is more logical to have this match in the routing expression going forward.
      Signed-off-by: NAnders K. Pedersen <akp@cohaesio.com>
      Signed-off-by: NPablo Neira Ayuso <pablo@netfilter.org>
      2fa84193
    • P
      netfilter: nf_log: add packet logging for netdev family · 1fddf4ba
      Pablo Neira Ayuso 提交于
      Move layer 2 packet logging into nf_log_l2packet() that resides in
      nf_log_common.c, so this can be shared by both bridge and netdev
      families.
      
      This patch adds the boiler plate code to register the netdev logging
      family.
      Signed-off-by: NPablo Neira Ayuso <pablo@netfilter.org>
      1fddf4ba
    • F
      netfilter: nf_tables: add fib expression · f6d0cbcf
      Florian Westphal 提交于
      Add FIB expression, supported for ipv4, ipv6 and inet family (the latter
      just dispatches to ipv4 or ipv6 one based on nfproto).
      
      Currently supports fetching output interface index/name and the
      rtm_type associated with an address.
      
      This can be used for adding path filtering. rtm_type is useful
      to e.g. enforce a strong-end host model where packets
      are only accepted if daddr is configured on the interface the
      packet arrived on.
      
      The fib expression is a native nftables alternative to the
      xtables addrtype and rp_filter matches.
      
      FIB result order for oif/oifname retrieval is as follows:
       - if packet is local (skb has rtable, RTF_LOCAL set, this
         will also catch looped-back multicast packets), set oif to
         the loopback interface.
       - if fib lookup returns an error, or result points to local,
         store zero result.  This means '--local' option of -m rpfilter
         is not supported. It is possible to use 'fib type local' or add
         explicit saddr/daddr matching rules to create exceptions if this
         is really needed.
       - store result in the destination register.
         In case of multiple routes, search set for desired oif in case
         strict matching is requested.
      
      ipv4 and ipv6 behave fib expressions are supposed to behave the same.
      
      [ I have collapsed Arnd Bergmann's ("netfilter: nf_tables: fib warnings")
      
      	http://patchwork.ozlabs.org/patch/688615/
      
        to address fallout from this patch after rebasing nf-next, that was
        posted to address compilation warnings. --pablo ]
      Signed-off-by: NFlorian Westphal <fw@strlen.de>
      Signed-off-by: NPablo Neira Ayuso <pablo@netfilter.org>
      f6d0cbcf
  19. 26 9月, 2016 1 次提交
    • P
      netfilter: nf_tables: add range expression · 0f3cd9b3
      Pablo Neira Ayuso 提交于
      Inverse ranges != [a,b] are not currently possible because rules are
      composites of && operations, and we need to express this:
      
      	data < a || data > b
      
      This patch adds a new range expression. Positive ranges can be already
      through two cmp expressions:
      
      	cmp(sreg, data, >=)
      	cmp(sreg, data, <=)
      
      This new range expression provides an alternative way to express this.
      Signed-off-by: NPablo Neira Ayuso <pablo@netfilter.org>
      0f3cd9b3
  20. 22 8月, 2016 2 次提交
    • L
      netfilter: nf_tables: add number generator expression · 91dbc6be
      Laura Garcia Liebana 提交于
      This patch adds the numgen expression that allows us to generated
      incremental and random numbers, this generator is bound to a upper limit
      that is specified by userspace.
      
      This expression is useful to distribute packets in a round-robin fashion
      as well as randomly.
      Signed-off-by: NLaura Garcia Liebana <nevola@gmail.com>
      Signed-off-by: NPablo Neira Ayuso <pablo@netfilter.org>
      91dbc6be
    • P
      netfilter: nf_tables: add quota expression · 3d2f30a1
      Pablo Neira Ayuso 提交于
      This patch adds the quota expression. This new stateful expression
      integrate easily into the dynset expression to build 'hashquota' flow
      tables.
      
      Arguably, we could use instead "counter bytes > 1000" instead, but this
      approach has several problems:
      
      1) We only support for one single stateful expression in dynamic set
         definitions, and the expression above is a composite of two
         expressions: get counter + comparison.
      
      2) We would need to restore the packed counter representation (that we
         used to have) based on seqlock to synchronize this, since per-cpu is
         not suitable for this.
      
      So instead of bloating the counter expression back with the seqlock
      representation and extending the existing set infrastructure to make it
      more complex for the composite described above, let's follow the more
      simple approach of adding a quota expression that we can plug into our
      existing infrastructure.
      Signed-off-by: NPablo Neira Ayuso <pablo@netfilter.org>
      3d2f30a1
  21. 12 8月, 2016 2 次提交
  22. 05 1月, 2016 1 次提交
  23. 04 1月, 2016 1 次提交
  24. 09 12月, 2015 1 次提交
    • F
      netfilter: nf_tables: extend tracing infrastructure · 33d5a7b1
      Florian Westphal 提交于
      nft monitor mode can then decode and display this trace data.
      
      Parts of LL/Network/Transport headers are provided as separate
      attributes.
      
      Otherwise, printing IP address data becomes virtually impossible
      for userspace since in the case of the netdev family we really don't
      want userspace to have to know all the possible link layer types
      and/or sizes just to display/print an ip address.
      
      We also don't want userspace to have to follow ipv6 header chains
      to get the s/dport info, the kernel already did this work for us.
      
      To avoid bloating nft_do_chain all data required for tracing is
      encapsulated in nft_traceinfo.
      
      The structure is initialized unconditionally(!) for each nft_do_chain
      invocation.
      
      This unconditionall call will be moved under a static key in a
      followup patch.
      
      With lots of help from Patrick McHardy and Pablo Neira.
      Signed-off-by: NFlorian Westphal <fw@strlen.de>
      Acked-by: NPatrick McHardy <kaber@trash.net>
      Signed-off-by: NPablo Neira Ayuso <pablo@netfilter.org>
      33d5a7b1