1. 27 6月, 2014 1 次提交
    • P
      netfilter: log: split family specific code to nf_log_{ip,ip6,common}.c files · 83e96d44
      Pablo Neira Ayuso 提交于
      The plain text logging is currently embedded into the xt_LOG target.
      In order to be able to use the plain text logging from nft_log, as a
      first step, this patch moves the family specific code to the following
      files and Kconfig symbols:
      
      1) net/ipv4/netfilter/nf_log_ip.c: CONFIG_NF_LOG_IPV4
      2) net/ipv6/netfilter/nf_log_ip6.c: CONFIG_NF_LOG_IPV6
      3) net/netfilter/nf_log_common.c: CONFIG_NF_LOG_COMMON
      
      These new modules will be required by xt_LOG and nft_log. This patch
      is based on original patch from Arturo Borrero Gonzalez.
      Signed-off-by: NPablo Neira Ayuso <pablo@netfilter.org>
      83e96d44
  2. 26 6月, 2014 1 次提交
  3. 06 2月, 2014 1 次提交
  4. 02 1月, 2014 1 次提交
  5. 31 12月, 2013 1 次提交
    • E
      netfilter: nft_reject: support for IPv6 and TCP reset · bee11dc7
      Eric Leblond 提交于
      This patch moves nft_reject_ipv4 to nft_reject and adds support
      for IPv6 protocol. This patch uses functions included in nf_reject.h
      to implement reject by TCP reset.
      
      The code has to be build as a module if NF_TABLES_IPV6 is also a
      module to avoid compilation error due to usage of IPv6 functions.
      This has been done in Kconfig by using the construct:
      
       depends on NF_TABLES_IPV6 || !NF_TABLES_IPV6
      
      This seems a bit weird in terms of syntax but works perfectly.
      Signed-off-by: NEric Leblond <eric@regit.org>
      Signed-off-by: NPablo Neira Ayuso <pablo@netfilter.org>
      bee11dc7
  6. 15 10月, 2013 2 次提交
  7. 14 10月, 2013 2 次提交
    • P
      netfilter: nf_tables: convert built-in tables/chains to chain types · 9370761c
      Pablo Neira Ayuso 提交于
      This patch converts built-in tables/chains to chain types that
      allows you to deploy customized table and chain configurations from
      userspace.
      
      After this patch, you have to specify the chain type when
      creating a new chain:
      
       add chain ip filter output { type filter hook input priority 0; }
                                    ^^^^ ------
      
      The existing chain types after this patch are: filter, route and
      nat. Note that tables are just containers of chains with no specific
      semantics, which is a significant change with regards to iptables.
      Signed-off-by: NPablo Neira Ayuso <pablo@netfilter.org>
      9370761c
    • P
      netfilter: add nftables · 96518518
      Patrick McHardy 提交于
      This patch adds nftables which is the intended successor of iptables.
      This packet filtering framework reuses the existing netfilter hooks,
      the connection tracking system, the NAT subsystem, the transparent
      proxying engine, the logging infrastructure and the userspace packet
      queueing facilities.
      
      In a nutshell, nftables provides a pseudo-state machine with 4 general
      purpose registers of 128 bits and 1 specific purpose register to store
      verdicts. This pseudo-machine comes with an extensible instruction set,
      a.k.a. "expressions" in the nftables jargon. The expressions included
      in this patch provide the basic functionality, they are:
      
      * bitwise: to perform bitwise operations.
      * byteorder: to change from host/network endianess.
      * cmp: to compare data with the content of the registers.
      * counter: to enable counters on rules.
      * ct: to store conntrack keys into register.
      * exthdr: to match IPv6 extension headers.
      * immediate: to load data into registers.
      * limit: to limit matching based on packet rate.
      * log: to log packets.
      * meta: to match metainformation that usually comes with the skbuff.
      * nat: to perform Network Address Translation.
      * payload: to fetch data from the packet payload and store it into
        registers.
      * reject (IPv4 only): to explicitly close connection, eg. TCP RST.
      
      Using this instruction-set, the userspace utility 'nft' can transform
      the rules expressed in human-readable text representation (using a
      new syntax, inspired by tcpdump) to nftables bytecode.
      
      nftables also inherits the table, chain and rule objects from
      iptables, but in a more configurable way, and it also includes the
      original datatype-agnostic set infrastructure with mapping support.
      This set infrastructure is enhanced in the follow up patch (netfilter:
      nf_tables: add netlink set API).
      
      This patch includes the following components:
      
      * the netlink API: net/netfilter/nf_tables_api.c and
        include/uapi/netfilter/nf_tables.h
      * the packet filter core: net/netfilter/nf_tables_core.c
      * the expressions (described above): net/netfilter/nft_*.c
      * the filter tables: arp, IPv4, IPv6 and bridge:
        net/ipv4/netfilter/nf_tables_ipv4.c
        net/ipv6/netfilter/nf_tables_ipv6.c
        net/ipv4/netfilter/nf_tables_arp.c
        net/bridge/netfilter/nf_tables_bridge.c
      * the NAT table (IPv4 only):
        net/ipv4/netfilter/nf_table_nat_ipv4.c
      * the route table (similar to mangle):
        net/ipv4/netfilter/nf_table_route_ipv4.c
        net/ipv6/netfilter/nf_table_route_ipv6.c
      * internal definitions under:
        include/net/netfilter/nf_tables.h
        include/net/netfilter/nf_tables_core.h
      * It also includes an skeleton expression:
        net/netfilter/nft_expr_template.c
        and the preliminary implementation of the meta target
        net/netfilter/nft_meta_target.c
      
      It also includes a change in struct nf_hook_ops to add a new
      pointer to store private data to the hook, that is used to store
      the rule list per chain.
      
      This patch is based on the patch from Patrick McHardy, plus merged
      accumulated cleanups, fixes and small enhancements to the nftables
      code that has been done since 2009, which are:
      
      From Patrick McHardy:
      * nf_tables: adjust netlink handler function signatures
      * nf_tables: only retry table lookup after successful table module load
      * nf_tables: fix event notification echo and avoid unnecessary messages
      * nft_ct: add l3proto support
      * nf_tables: pass expression context to nft_validate_data_load()
      * nf_tables: remove redundant definition
      * nft_ct: fix maxattr initialization
      * nf_tables: fix invalid event type in nf_tables_getrule()
      * nf_tables: simplify nft_data_init() usage
      * nf_tables: build in more core modules
      * nf_tables: fix double lookup expression unregistation
      * nf_tables: move expression initialization to nf_tables_core.c
      * nf_tables: build in payload module
      * nf_tables: use NFPROTO constants
      * nf_tables: rename pid variables to portid
      * nf_tables: save 48 bits per rule
      * nf_tables: introduce chain rename
      * nf_tables: check for duplicate names on chain rename
      * nf_tables: remove ability to specify handles for new rules
      * nf_tables: return error for rule change request
      * nf_tables: return error for NLM_F_REPLACE without rule handle
      * nf_tables: include NLM_F_APPEND/NLM_F_REPLACE flags in rule notification
      * nf_tables: fix NLM_F_MULTI usage in netlink notifications
      * nf_tables: include NLM_F_APPEND in rule dumps
      
      From Pablo Neira Ayuso:
      * nf_tables: fix stack overflow in nf_tables_newrule
      * nf_tables: nft_ct: fix compilation warning
      * nf_tables: nft_ct: fix crash with invalid packets
      * nft_log: group and qthreshold are 2^16
      * nf_tables: nft_meta: fix socket uid,gid handling
      * nft_counter: allow to restore counters
      * nf_tables: fix module autoload
      * nf_tables: allow to remove all rules placed in one chain
      * nf_tables: use 64-bits rule handle instead of 16-bits
      * nf_tables: fix chain after rule deletion
      * nf_tables: improve deletion performance
      * nf_tables: add missing code in route chain type
      * nf_tables: rise maximum number of expressions from 12 to 128
      * nf_tables: don't delete table if in use
      * nf_tables: fix basechain release
      
      From Tomasz Bursztyka:
      * nf_tables: Add support for changing users chain's name
      * nf_tables: Change chain's name to be fixed sized
      * nf_tables: Add support for replacing a rule by another one
      * nf_tables: Update uapi nftables netlink header documentation
      
      From Florian Westphal:
      * nft_log: group is u16, snaplen u32
      
      From Phil Oester:
      * nf_tables: operational limit match
      Signed-off-by: NPatrick McHardy <kaber@trash.net>
      Signed-off-by: NPablo Neira Ayuso <pablo@netfilter.org>
      96518518
  8. 28 8月, 2013 1 次提交
    • P
      netfilter: add SYNPROXY core/target · 48b1de4c
      Patrick McHardy 提交于
      Add a SYNPROXY for netfilter. The code is split into two parts, the synproxy
      core with common functions and an address family specific target.
      
      The SYNPROXY receives the connection request from the client, responds with
      a SYN/ACK containing a SYN cookie and announcing a zero window and checks
      whether the final ACK from the client contains a valid cookie.
      
      It then establishes a connection to the original destination and, if
      successful, sends a window update to the client with the window size
      announced by the server.
      
      Support for timestamps, SACK, window scaling and MSS options can be
      statically configured as target parameters if the features of the server
      are known. If timestamps are used, the timestamp value sent back to
      the client in the SYN/ACK will be different from the real timestamp of
      the server. In order to now break PAWS, the timestamps are translated in
      the direction server->client.
      Signed-off-by: NPatrick McHardy <kaber@trash.net>
      Tested-by: NMartin Topholm <mph@one.com>
      Signed-off-by: NJesper Dangaard Brouer <brouer@redhat.com>
      Signed-off-by: NPablo Neira Ayuso <pablo@netfilter.org>
      48b1de4c
  9. 23 5月, 2013 1 次提交
  10. 19 4月, 2013 1 次提交
  11. 20 3月, 2013 1 次提交
  12. 12 1月, 2013 1 次提交
    • K
      net/ipv4/netfilter: remove depends on CONFIG_EXPERIMENTAL · aec9a0eb
      Kees Cook 提交于
      The CONFIG_EXPERIMENTAL config item has not carried much meaning for a
      while now and is almost always enabled by default. As agreed during the
      Linux kernel summit, remove it from any "depends on" lines in Kconfigs.
      
      CC: Pablo Neira Ayuso <pablo@netfilter.org>
      CC: Patrick McHardy <kaber@trash.net>
      CC: "David S. Miller" <davem@davemloft.net>
      CC: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
      CC: James Morris <jmorris@namei.org>
      CC: Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>
      Signed-off-by: NKees Cook <keescook@chromium.org>
      Acked-by: NDavid S. Miller <davem@davemloft.net>
      aec9a0eb
  13. 21 9月, 2012 2 次提交
  14. 30 8月, 2012 6 次提交
  15. 08 3月, 2012 1 次提交
  16. 28 12月, 2011 2 次提交
  17. 05 12月, 2011 1 次提交
    • F
      netfilter: add ipv4 reverse path filter match · 8f97339d
      Florian Westphal 提交于
      This tries to do the same thing as fib_validate_source(), but differs
      in several aspects.
      
      The most important difference is that the reverse path filter built into
      fib_validate_source uses the oif as iif when performing the reverse
      lookup.  We do not do this, as the oif is not yet known by the time the
      PREROUTING hook is invoked.
      
      We can't wait until FORWARD chain because by the time FORWARD is invoked
      ipv4 forward path may have already sent icmp messages is response
      to to-be-discarded-via-rpfilter packets.
      
      To avoid the such an additional lookup in PREROUTING, Patrick McHardy
      suggested to attach the path information directly in the match
      (i.e., just do what the standard ipv4 path does a bit earlier in PREROUTING).
      
      This works, but it also has a few caveats. Most importantly, when using
      marks in PREROUTING to re-route traffic based on the nfmark, -m rpfilter
      would have to be used after the nfmark has been set; otherwise the nfmark
      would have no effect (because the route is already attached).
      
      Another problem would be interaction with -j TPROXY, as this target sets an
      nfmark and uses ACCEPT instead of continue, i.e. such a version of
      -m rpfilter cannot be used for the initial to-be-intercepted packets.
      
      In case in turns out that the oif is required, we can add Patricks
      suggestion with a new match option (e.g. --rpf-use-oif) to keep ruleset
      compatibility.
      
      Another difference to current builtin ipv4 rpfilter is that packets subject to ipsec
      transformation are not automatically excluded. If you want this, simply
      combine -m rpfilter with the policy match.
      
      Packets arriving on loopback interfaces always match.
      Signed-off-by: NFlorian Westphal <fw@strlen.de>
      Acked-by: NDavid S. Miller <davem@davemloft.net>
      Signed-off-by: NPablo Neira Ayuso <pablo@netfilter.org>
      8f97339d
  18. 24 11月, 2011 1 次提交
  19. 16 3月, 2011 1 次提交
  20. 19 1月, 2011 1 次提交
    • J
      netfilter: nf_conntrack: nf_conntrack snmp helper · 93557f53
      Jiri Olsa 提交于
      Adding support for SNMP broadcast connection tracking. The SNMP
      broadcast requests are now paired with the SNMP responses.
      Thus allowing using SNMP broadcasts with firewall enabled.
      
      Please refer to the following conversation:
      http://marc.info/?l=netfilter-devel&m=125992205006600&w=2
      
      Patrick McHardy wrote:
      > > The best solution would be to add generic broadcast tracking, the
      > > use of expectations for this is a bit of abuse.
      > > The second best choice I guess would be to move the help() function
      > > to a shared module and generalize it so it can be used for both.
      This patch implements the "second best choice".
      
      Since the netbios-ns conntrack module uses the same helper
      functionality as the snmp, only one helper function is added
      for both snmp and netbios-ns modules into the new object -
      nf_conntrack_broadcast.
      Signed-off-by: NJiri Olsa <jolsa@redhat.com>
      Signed-off-by: NPatrick McHardy <kaber@trash.net>
      93557f53
  21. 18 10月, 2010 2 次提交
  22. 16 3月, 2009 1 次提交
  23. 19 2月, 2009 3 次提交
  24. 08 10月, 2008 4 次提交
  25. 24 7月, 2008 1 次提交