1. 01 3月, 2011 1 次提交
    • P
      netfilter: nf_ct_tcp: fix out of sync scenario while in SYN_RECV · 8a80c79a
      Pablo Neira Ayuso 提交于
      This patch fixes the out of sync scenarios while in SYN_RECV state.
      
      Quoting Jozsef, what it happens if we are out of sync if the
      following:
      
      > > b. conntrack entry is outdated, new SYN received
      > >    - (b1) we ignore it but save the initialization data from it
      > >    - (b2) when the reply SYN/ACK receives and it matches the saved data,
      > >      we pick up the new connection
      This is what it should happen if we are in SYN_RECV state. Initially,
      the SYN packet hits b1, thus we save data from it. But the SYN/ACK
      packet is considered a retransmission given that we're in SYN_RECV
      state. Therefore, we never hit b2 and we don't get in sync. To fix
      this, we ignore SYN/ACK if we are in SYN_RECV. If the previous packet
      was a SYN, then we enter the ignore case that get us in sync.
      
      This patch helps a lot to conntrackd in stress scenarios (assumming a
      client that generates lots of small TCP connections). During the failover,
      consider that the new primary has injected one outdated flow in SYN_RECV
      state (this is likely to happen if the conntrack event rate is high
      because the backup will be a bit delayed from the primary). With the
      current code, if the client starts a new fresh connection that matches
      the tuple, the SYN packet will be ignored without updating the state
      tracking, and the SYN+ACK in reply will blocked as it will not pass
      checkings III or IV (since all state tracking in the original direction
      is not initialized because of the SYN packet was ignored and the ignore
      case that get us in sync is not applied).
      
      I posted a couple of patches before this one. Changli Gao spotted
      a simpler way to fix this problem. This patch implements his idea.
      
      Cc: Changli Gao <xiaosuo@gmail.com>
      Cc: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
      Signed-off-by: NPablo Neira Ayuso <pablo@netfilter.org>
      Signed-off-by: NJozsef Kadlecsik <kadlec@blackhole.kfki.hu>
      Signed-off-by: NPatrick McHardy <kaber@trash.net>
      8a80c79a
  2. 25 2月, 2011 1 次提交
  3. 24 2月, 2011 1 次提交
  4. 22 2月, 2011 1 次提交
  5. 16 2月, 2011 4 次提交
  6. 15 2月, 2011 1 次提交
  7. 14 2月, 2011 2 次提交
  8. 12 2月, 2011 1 次提交
    • S
      netfilter: xt_connlimit: connlimit-above early loop termination · 44bd4de9
      Stefan Berger 提交于
      The patch below introduces an early termination of the loop that is
      counting matches. It terminates once the counter has exceeded the
      threshold provided by the user. There's no point in continuing the loop
      afterwards and looking at other entries.
      
      It plays together with the following code further below:
      
      return (connections > info->limit) ^ info->inverse;
      
      where connections is the result of the counted connection, which in turn
      is the matches variable in the loop. So once
      
              -> matches = info->limit + 1
      alias   -> matches > info->limit
      alias   -> matches > threshold
      
      we can terminate the loop.
      Signed-off-by: NStefan Berger <stefanb@linux.vnet.ibm.com>
      Signed-off-by: NPatrick McHardy <kaber@trash.net>
      44bd4de9
  9. 10 2月, 2011 1 次提交
  10. 07 2月, 2011 1 次提交
  11. 03 2月, 2011 4 次提交
  12. 02 2月, 2011 8 次提交
  13. 01 2月, 2011 14 次提交
    • P
      netfilter: ipset: remove unnecessary includes · 582e1fc8
      Patrick McHardy 提交于
      None of the set types need uaccess.h since this is handled centrally
      in ip_set_core. Most set types additionally don't need bitops.h and
      spinlock.h since they use neither. tcp.h is only needed by those
      using before(), udp.h is not needed at all.
      Signed-off-by: NPatrick McHardy <kaber@trash.net>
      582e1fc8
    • P
      netfilter: ipset: use nla_parse_nested() · 8da560ce
      Patrick McHardy 提交于
      Replace calls of the form:
      
      nla_parse(tb, ATTR_MAX, nla_data(attr), nla_len(attr), policy)
      
      by:
      
      nla_parse_nested(tb, ATTR_MAX, attr, policy)
      Signed-off-by: NPatrick McHardy <kaber@trash.net>
      8da560ce
    • J
      netfilter: xtables: "set" match and "SET" target support · d956798d
      Jozsef Kadlecsik 提交于
      The patch adds the combined module of the "SET" target and "set" match
      to netfilter. Both the previous and the current revisions are supported.
      Signed-off-by: NJozsef Kadlecsik <kadlec@blackhole.kfki.hu>
      Signed-off-by: NPatrick McHardy <kaber@trash.net>
      d956798d
    • J
      netfilter: ipset: list:set set type support · f830837f
      Jozsef Kadlecsik 提交于
      The module implements the list:set type support in two flavours:
      without and with timeout. The sets has two sides: for the userspace,
      they store the names of other (non list:set type of) sets: one can add,
      delete and test set names. For the kernel, it forms an ordered union of
      the member sets: the members sets are tried in order when elements are
      added, deleted and tested and the process stops at the first success.
      Signed-off-by: NJozsef Kadlecsik <kadlec@blackhole.kfki.hu>
      Signed-off-by: NPatrick McHardy <kaber@trash.net>
      f830837f
    • J
      netfilter: ipset: hash:net,port set type support · 21f45020
      Jozsef Kadlecsik 提交于
      The module implements the hash:net,port type support in four flavours:
      for IPv4 and IPv6, both without and with timeout support. The elements
      are two dimensional: IPv4/IPv6 network address/prefix and protocol/port
      pairs.
      Signed-off-by: NJozsef Kadlecsik <kadlec@blackhole.kfki.hu>
      Signed-off-by: NPatrick McHardy <kaber@trash.net>
      21f45020
    • J
      netfilter: ipset: hash:net set type support · b3837029
      Jozsef Kadlecsik 提交于
      The module implements the hash:net type support in four flavours:
      for IPv4 and IPv6, both without and with timeout support. The elements
      are one dimensional: IPv4/IPv6 network address/prefixes.
      Signed-off-by: NJozsef Kadlecsik <kadlec@blackhole.kfki.hu>
      Signed-off-by: NPatrick McHardy <kaber@trash.net>
      b3837029
    • J
      netfilter: ipset: hash:ip,port,net set type support · 41d22f7b
      Jozsef Kadlecsik 提交于
      The module implements the hash:ip,port,net type support in four flavours:
      for IPv4 and IPv6, both without and with timeout support. The elements
      are three dimensional: IPv4/IPv6 address, protocol/port and IPv4/IPv6
      network address/prefix triples. The different prefixes are searched/matched
      from the longest prefix to the shortes one (most specific to least).
      In other words the processing time linearly grows with the number of
      different prefixes in the set.
      Signed-off-by: NJozsef Kadlecsik <kadlec@blackhole.kfki.hu>
      Signed-off-by: NPatrick McHardy <kaber@trash.net>
      41d22f7b
    • J
      netfilter: ipset: hash:ip,port,ip set type support · 5663bc30
      Jozsef Kadlecsik 提交于
      The module implements the hash:ip,port,ip type support in four flavours:
      for IPv4 and IPv6, both without and with timeout support. The elements
      are three dimensional: IPv4/IPv6 address, protocol/port and IPv4/IPv6
      address triples.
      Signed-off-by: NJozsef Kadlecsik <kadlec@blackhole.kfki.hu>
      Signed-off-by: NPatrick McHardy <kaber@trash.net>
      5663bc30
    • J
      netfilter: ipset: hash:ip,port set type support · 07896ed3
      Jozsef Kadlecsik 提交于
      The module implements the hash:ip,port type support in four flavours:
      for IPv4 and IPv6, both without and with timeout support. The elements
      are two dimensional: IPv4/IPv6 address and protocol/port pairs. The port
      is interpeted for TCP, UPD, ICMP and ICMPv6 (at the latters as type/code
      of course).
      Signed-off-by: NJozsef Kadlecsik <kadlec@blackhole.kfki.hu>
      Signed-off-by: NPatrick McHardy <kaber@trash.net>
      07896ed3
    • J
      netfilter: ipset: hash:ip set type support · 6c027889
      Jozsef Kadlecsik 提交于
      The module implements the hash:ip type support in four flavours:
      for IPv4 or IPv6, both without and with timeout support.
      
      All the hash types are based on the "array hash" or ahash structure
      and functions as a good compromise between minimal memory footprint
      and speed. The hashing uses arrays to resolve clashes. The hash table
      is resized (doubled) when searching becomes too long. Resizing can be
      triggered by userspace add commands only and those are serialized by
      the nfnl mutex. During resizing the set is read-locked, so the only
      possible concurrent operations are the kernel side readers. Those are
      protected by RCU locking.
      
      Because of the four flavours and the other hash types, the functions
      are implemented in general forms in the ip_set_ahash.h header file
      and the real functions are generated before compiling by macro expansion.
      Thus the dereferencing of low-level functions and void pointer arguments
      could be avoided: the low-level functions are inlined, the function
      arguments are pointers of type-specific structures.
      Signed-off-by: NJozsef Kadlecsik <kadlec@blackhole.kfki.hu>
      Signed-off-by: NPatrick McHardy <kaber@trash.net>
      6c027889
    • J
      netfilter: ipset; bitmap:port set type support · 54326190
      Jozsef Kadlecsik 提交于
      The module implements the bitmap:port type in two flavours, without
      and with timeout support to store TCP/UDP ports from a range.
      Signed-off-by: NJozsef Kadlecsik <kadlec@blackhole.kfki.hu>
      Signed-off-by: NPatrick McHardy <kaber@trash.net>
      54326190
    • J
      netfilter: ipset: bitmap:ip,mac type support · de76021a
      Jozsef Kadlecsik 提交于
      The module implements the bitmap:ip,mac set type in two flavours,
      without and with timeout support. In this kind of set one can store
      IPv4 address and (source) MAC address pairs. The type supports elements
      added without the MAC part filled out: when the first matching from kernel
      happens, the MAC part is automatically filled out. The timing out of the
      elements stars when an element is complete in the IP,MAC pair.
      Signed-off-by: NJozsef Kadlecsik <kadlec@blackhole.kfki.hu>
      Signed-off-by: NPatrick McHardy <kaber@trash.net>
      de76021a
    • J
      netfilter: ipset: bitmap:ip set type support · 72205fc6
      Jozsef Kadlecsik 提交于
      The module implements the bitmap:ip set type in two flavours, without
      and with timeout support. In this kind of set one can store IPv4
      addresses (or network addresses) from a given range.
      
      In order not to waste memory, the timeout version does not rely on
      the kernel timer for every element to be timed out but on garbage
      collection. All set types use this mechanism.
      Signed-off-by: NJozsef Kadlecsik <kadlec@blackhole.kfki.hu>
      Signed-off-by: NPatrick McHardy <kaber@trash.net>
      72205fc6
    • J
      netfilter: ipset: IP set core support · a7b4f989
      Jozsef Kadlecsik 提交于
      The patch adds the IP set core support to the kernel.
      
      The IP set core implements a netlink (nfnetlink) based protocol by which
      one can create, destroy, flush, rename, swap, list, save, restore sets,
      and add, delete, test elements from userspace. For simplicity (and backward
      compatibilty and for not to force ip(6)tables to be linked with a netlink
      library) reasons a small getsockopt-based protocol is also kept in order
      to communicate with the ip(6)tables match and target.
      
      The netlink protocol passes all u16, etc values in network order with
      NLA_F_NET_BYTEORDER flag. The protocol enforces the proper use of the
      NLA_F_NESTED and NLA_F_NET_BYTEORDER flags.
      
      For other kernel subsystems (netfilter match and target) the API contains
      the functions to add, delete and test elements in sets and the required calls
      to get/put refereces to the sets before those operations can be performed.
      
      The set types (which are implemented in independent modules) are stored
      in a simple RCU protected list. A set type may have variants: for example
      without timeout or with timeout support, for IPv4 or for IPv6. The sets
      (i.e. the pointers to the sets) are stored in an array. The sets are
      identified by their index in the array, which makes possible easy and
      fast swapping of sets. The array is protected indirectly by the nfnl
      mutex from nfnetlink. The content of the sets are protected by the rwlock
      of the set.
      
      There are functional differences between the add/del/test functions
      for the kernel and userspace:
      
      - kernel add/del/test: works on the current packet (i.e. one element)
      - kernel test: may trigger an "add" operation  in order to fill
        out unspecified parts of the element from the packet (like MAC address)
      - userspace add/del: works on the netlink message and thus possibly
        on multiple elements from the IPSET_ATTR_ADT container attribute.
      - userspace add: may trigger resizing of a set
      Signed-off-by: NJozsef Kadlecsik <kadlec@blackhole.kfki.hu>
      Signed-off-by: NPatrick McHardy <kaber@trash.net>
      a7b4f989