1. 01 Feb, 2011 5 commits
    • Jozsef Kadlecsik's avatar
      netfilter: ipset; bitmap:port set type support · 54326190
      Jozsef Kadlecsik authored
      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: default avatarJozsef Kadlecsik <kadlec@blackhole.kfki.hu>
      Signed-off-by: default avatarPatrick McHardy <kaber@trash.net>
      54326190
    • Jozsef Kadlecsik's avatar
      netfilter: ipset: bitmap:ip,mac type support · de76021a
      Jozsef Kadlecsik authored
      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: default avatarJozsef Kadlecsik <kadlec@blackhole.kfki.hu>
      Signed-off-by: default avatarPatrick McHardy <kaber@trash.net>
      de76021a
    • Jozsef Kadlecsik's avatar
      netfilter: ipset: bitmap:ip set type support · 72205fc6
      Jozsef Kadlecsik authored
      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: default avatarJozsef Kadlecsik <kadlec@blackhole.kfki.hu>
      Signed-off-by: default avatarPatrick McHardy <kaber@trash.net>
      72205fc6
    • Jozsef Kadlecsik's avatar
      netfilter: ipset: IP set core support · a7b4f989
      Jozsef Kadlecsik authored
      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: default avatarJozsef Kadlecsik <kadlec@blackhole.kfki.hu>
      Signed-off-by: default avatarPatrick McHardy <kaber@trash.net>
      a7b4f989
    • Jozsef Kadlecsik's avatar
      netfilter: NFNL_SUBSYS_IPSET id and NLA_PUT_NET* macros · f703651e
      Jozsef Kadlecsik authored
      The patch adds the NFNL_SUBSYS_IPSET id and NLA_PUT_NET* macros to the
      vanilla kernel.
      Signed-off-by: default avatarJozsef Kadlecsik <kadlec@blackhole.kfki.hu>
      Signed-off-by: default avatarPatrick McHardy <kaber@trash.net>
      f703651e
  2. 28 Jan, 2011 1 commit
  3. 27 Jan, 2011 1 commit
  4. 26 Jan, 2011 2 commits
  5. 25 Jan, 2011 2 commits
  6. 22 Jan, 2011 2 commits
  7. 20 Jan, 2011 21 commits
  8. 19 Jan, 2011 6 commits
    • Patrick McHardy's avatar
      14f0290b
    • Patrick McHardy's avatar
      netfilter: nf_conntrack: fix lifetime display for disabled connections · f5c88f56
      Patrick McHardy authored
      When no tstamp extension exists, ct_delta_time() returns -1, which is
      then assigned to an u64 and tested for negative values to decide
      whether to display the lifetime. This obviously doesn't work, use
      a s64 and merge the two minor functions into one.
      Signed-off-by: default avatarPatrick McHardy <kaber@trash.net>
      f5c88f56
    • Jan Engelhardt's avatar
      netfilter: xtables: connlimit revision 1 · cc4fc022
      Jan Engelhardt authored
      This adds destination address-based selection. The old "inverse"
      member is overloaded (memory-wise) with a new "flags" variable,
      similar to how J.Park did it with xt_string rev 1. Since revision 0
      userspace only sets flag 0x1, no great changes are made to explicitly
      test for different revisions.
      Signed-off-by: default avatarJan Engelhardt <jengelh@medozas.de>
      cc4fc022
    • Pablo Neira Ayuso's avatar
      netfilter: nf_conntrack_tstamp: add flow-based timestamp extension · a992ca2a
      Pablo Neira Ayuso authored
      This patch adds flow-based timestamping for conntracks. This
      conntrack extension is disabled by default. Basically, we use
      two 64-bits variables to store the creation timestamp once the
      conntrack has been confirmed and the other to store the deletion
      time. This extension is disabled by default, to enable it, you
      have to:
      
      echo 1 > /proc/sys/net/netfilter/nf_conntrack_timestamp
      
      This patch allows to save memory for user-space flow-based
      loogers such as ulogd2. In short, ulogd2 does not need to
      keep a hashtable with the conntrack in user-space to know
      when they were created and destroyed, instead we use the
      kernel timestamp. If we want to have a sane IPFIX implementation
      in user-space, this nanosecs resolution timestamps are also
      useful. Other custom user-space applications can benefit from
      this via libnetfilter_conntrack.
      
      This patch modifies the /proc output to display the delta time
      in seconds since the flow start. You can also obtain the
      flow-start date by means of the conntrack-tools.
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      Signed-off-by: default avatarPatrick McHardy <kaber@trash.net>
      a992ca2a
    • Eric Dumazet's avatar
      net: filter: dont block softirqs in sk_run_filter() · 80f8f102
      Eric Dumazet authored
      Packet filter (BPF) doesnt need to disable softirqs, being fully
      re-entrant and lock-less.
      Signed-off-by: default avatarEric Dumazet <eric.dumazet@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      80f8f102
    • Alban Crequy's avatar
      af_unix: implement socket filter · d6ae3bae
      Alban Crequy authored
      Linux Socket Filters can already be successfully attached and detached on unix
      sockets with setsockopt(sockfd, SOL_SOCKET, SO_{ATTACH,DETACH}_FILTER, ...).
      See: Documentation/networking/filter.txt
      
      But the filter was never used in the unix socket code so it did not work. This
      patch uses sk_filter() to filter buffers before delivery.
      
      This short program demonstrates the problem on SOCK_DGRAM.
      
      int main(void) {
        int i, j, ret;
        int sv[2];
        struct pollfd fds[2];
        char *message = "Hello world!";
        char buffer[64];
        struct sock_filter ins[32] = {{0,},};
        struct sock_fprog filter;
      
        socketpair(AF_UNIX, SOCK_DGRAM, 0, sv);
      
        for (i = 0 ; i < 2 ; i++) {
          fds[i].fd = sv[i];
          fds[i].events = POLLIN;
          fds[i].revents = 0;
        }
      
        for(j = 1 ; j < 13 ; j++) {
      
          /* Set a socket filter to truncate the message */
          memset(ins, 0, sizeof(ins));
          ins[0].code = BPF_RET|BPF_K;
          ins[0].k = j;
          filter.len = 1;
          filter.filter = ins;
          setsockopt(sv[1], SOL_SOCKET, SO_ATTACH_FILTER, &filter, sizeof(filter));
      
          /* send a message */
          send(sv[0], message, strlen(message) + 1, 0);
      
          /* The filter should let the message pass but truncated. */
          poll(fds, 2, 0);
      
          /* Receive the truncated message*/
          ret = recv(sv[1], buffer, 64, 0);
          printf("received %d bytes, expected %d\n", ret, j);
        }
      
          for (i = 0 ; i < 2 ; i++)
            close(sv[i]);
      
        return 0;
      }
      Signed-off-by: default avatarAlban Crequy <alban.crequy@collabora.co.uk>
      Reviewed-by: default avatarIan Molton <ian.molton@collabora.co.uk>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      d6ae3bae