]> granicus.if.org Git - ipset/log
ipset
10 years agoBash utilities updated
Jozsef Kadlecsik [Tue, 30 Sep 2014 07:48:51 +0000 (09:48 +0200)]
Bash utilities updated

10 years agoipset: Fix hyphen used as minus sign in manpage
Neutron Soutmun [Thu, 25 Sep 2014 07:56:11 +0000 (14:56 +0700)]
ipset: Fix hyphen used as minus sign in manpage

Signed-off-by: Neutron Soutmun <neo.neutron@gmail.com>
Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
10 years agoipset 6.23 released v6.23
Jozsef Kadlecsik [Tue, 23 Sep 2014 11:18:34 +0000 (13:18 +0200)]
ipset 6.23 released

10 years agoThe utils are updated from their sources
Jozsef Kadlecsik [Tue, 23 Sep 2014 11:08:54 +0000 (13:08 +0200)]
The utils are updated from their sources

10 years agoOrder create and add options in manpage so that generic ones come first
Jozsef Kadlecsik [Tue, 23 Sep 2014 11:06:36 +0000 (13:06 +0200)]
Order create and add options in manpage so that generic ones come first

10 years agoCentralise generic create options (family, hashsize, maxelem) on top of man page...
Mart Frauenlob [Mon, 22 Sep 2014 16:08:55 +0000 (18:08 +0200)]
Centralise generic create options (family, hashsize, maxelem) on top of man page in the generic options section.

Signed-off-by: Mart Frauenlob <mart.frauenlob@chello.at>
Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
10 years agoSupport glibc < 2.9 (fixes bugzilla id #891)
Jozsef Kadlecsik [Tue, 23 Sep 2014 09:43:20 +0000 (11:43 +0200)]
Support glibc < 2.9 (fixes bugzilla id #891)

10 years agoSupport updating extensions when the set is full
Jozsef Kadlecsik [Tue, 23 Sep 2014 09:10:12 +0000 (11:10 +0200)]
Support updating extensions when the set is full

When the set was full (hash type and maxelem reached), it was not
possible to update the extension part of already existing elements.
The patch removes this limitation. (Fixes netfilter bugzilla id 880.)

10 years agoAdd description of hash:mac set type to man page.
Mart Frauenlob [Fri, 19 Sep 2014 11:30:49 +0000 (13:30 +0200)]
Add description of hash:mac set type to man page.

Signed-off-by: Mart Frauenlob <mart.frauenlob@chello.at>
Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
10 years agoAdd missing space for skbinfo option synopsis.
Mart Frauenlob [Fri, 19 Sep 2014 11:23:43 +0000 (13:23 +0200)]
Add missing space for skbinfo option synopsis.

Signed-off-by: Mart Frauenlob <mart.frauenlob@chello.at>
Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
10 years agoThe library/API versions were forgotten to bump (reported by Sergei Zhirikov)
Jozsef Kadlecsik [Mon, 22 Sep 2014 05:44:23 +0000 (07:44 +0200)]
The library/API versions were forgotten to bump (reported by Sergei Zhirikov)

With introducing the skbinfo extension, the library/API versions should
have been incremented, which is fixed now.

10 years agoRetry printing when sprintf fails (reported by Stig Thormodsrud)
Jozsef Kadlecsik [Mon, 22 Sep 2014 05:32:38 +0000 (07:32 +0200)]
Retry printing when sprintf fails (reported by Stig Thormodsrud)

Instead of returning the length of the string which would have been
printed, sprintf sometimes simply returns an error code. Handle
the case and flush the printing buffer and retry.

10 years agoipset 6.22 released v6.22
Jozsef Kadlecsik [Mon, 15 Sep 2014 16:10:08 +0000 (18:10 +0200)]
ipset 6.22 released

10 years agohash:mac type added to ipset
Jozsef Kadlecsik [Mon, 15 Sep 2014 15:36:06 +0000 (17:36 +0200)]
hash:mac type added to ipset

10 years agoskbinfo extension: send nonzero extension elements only to userspace
Jozsef Kadlecsik [Mon, 15 Sep 2014 15:30:54 +0000 (17:30 +0200)]
skbinfo extension: send nonzero extension elements only to userspace

10 years agoAdd test to check mark mapping
Jozsef Kadlecsik [Sun, 14 Sep 2014 19:50:28 +0000 (21:50 +0200)]
Add test to check mark mapping

Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
10 years agoipset: remove extran newline on debug output
Holger Eitzenberger [Mon, 8 Sep 2014 14:30:48 +0000 (16:30 +0200)]
ipset: remove extran newline on debug output

    [ The following text is in the "utf-8" character set. ]
    [ Your display is set for the "ISO-8859-2" character set.  ]
    [ Some characters may be displayed incorrectly. ]

Signed-off-by: Holger Eitzenberger <holger@eitzenberger.org>
Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
10 years agoipset: avoid duplicate command flags
Holger Eitzenberger [Mon, 8 Sep 2014 14:30:38 +0000 (16:30 +0200)]
ipset: avoid duplicate command flags

    [ The following text is in the "utf-8" character set. ]
    [ Your display is set for the "ISO-8859-2" character set.  ]
    [ Some characters may be displayed incorrectly. ]

NLM_F_DUMP is #defined as (NLM_F_ROOT | NLM_F_ACK), so specifying
all of them is redundant.

Signed-off-by: Holger Eitzenberger <holger@eitzenberger.org>
Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
10 years agoRemove a duplicate debug print
Holger Eitzenberger [Mon, 8 Sep 2014 14:30:33 +0000 (16:30 +0200)]
Remove a duplicate debug print

    [ The following text is in the "utf-8" character set. ]
    [ Your display is set for the "ISO-8859-2" character set.  ]
    [ Some characters may be displayed incorrectly. ]

Signed-off-by: Holger Eitzenberger <holger@eitzenberger.org>
Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
10 years agonetfilter: Convert pr_warning to pr_warn
Joe Perches [Sun, 14 Sep 2014 18:57:03 +0000 (20:57 +0200)]
netfilter: Convert pr_warning to pr_warn

Use the more common pr_warn.

Other miscellanea:

o Coalesce formats
o Realign arguments

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
10 years agonetfilter: ipset: Add skbinfo extension support to SET target.
Anton Danilov [Tue, 2 Sep 2014 10:21:20 +0000 (14:21 +0400)]
netfilter: ipset: Add skbinfo extension support to SET target.

Signed-off-by: Anton Danilov <littlesmilingcloud@gmail.com>
Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
10 years agoipset: man: Add the skbinfo extension documentation.
Anton Danilov [Thu, 28 Aug 2014 06:11:35 +0000 (10:11 +0400)]
ipset: man: Add the skbinfo extension documentation.

Signed-off-by: Anton Danilov <littlesmilingcloud@gmail.com>
Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
10 years agolibipset: Add userspace support of the skbinfo extension of the list set type.
Anton Danilov [Thu, 28 Aug 2014 06:11:34 +0000 (10:11 +0400)]
libipset: Add userspace support of the skbinfo extension of the list set type.

Add userspace part for support of new revisions of the list set type
with the skbinfo extension.

Signed-off-by: Anton Danilov <littlesmilingcloud@gmail.com>
Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
10 years agolibipset: Add userspace support of the skbinfo extension of the hash set types.
Anton Danilov [Thu, 28 Aug 2014 06:11:33 +0000 (10:11 +0400)]
libipset: Add userspace support of the skbinfo extension of the hash set types.

Add userspace part for support of new revisions of the hash set types
with the skbinfo extension.

Signed-off-by: Anton Danilov <littlesmilingcloud@gmail.com>
Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
10 years agolibipset: Add userspace support of the skbinfo extension of the bitmap set types.
Anton Danilov [Thu, 28 Aug 2014 06:11:32 +0000 (10:11 +0400)]
libipset: Add userspace support of the skbinfo extension of the bitmap set types.

Add userspace part for support of new revisions of the bitmap set types
with the skbinfo extension.

Signed-off-by: Anton Danilov <littlesmilingcloud@gmail.com>
Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
10 years agolibipset: Add userspace code for the skbinfo extension support.
Anton Danilov [Thu, 28 Aug 2014 06:11:31 +0000 (10:11 +0400)]
libipset: Add userspace code for the skbinfo extension support.

Add userspace code to support of the skbinfo extension independly of set types.
Defines constants, flag and function for print/parse/send/recieve of skbinfo
parameters.

Signed-off-by: Anton Danilov <littlesmilingcloud@gmail.com>
Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
10 years agonetfilter: ipset: Add skbinfo extension kernel support for the list set type.
Anton Danilov [Thu, 28 Aug 2014 06:11:30 +0000 (10:11 +0400)]
netfilter: ipset: Add skbinfo extension kernel support for the list set type.

Add skbinfo extension kernel support for the list set type.
Introduce the new revision of the list set type.

Signed-off-by: Anton Danilov <littlesmilingcloud@gmail.com>
Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
10 years agonetfilter: ipset: Add skbinfo extension kernel support for the hash set types.
Anton Danilov [Thu, 28 Aug 2014 06:11:29 +0000 (10:11 +0400)]
netfilter: ipset: Add skbinfo extension kernel support for the hash set types.

Add skbinfo extension kernel support for the hash set types.
Inroduce the new revisions of all hash set types.

Signed-off-by: Anton Danilov <littlesmilingcloud@gmail.com>
Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
10 years agonetfilter: ipset: Add skbinfo extension kernel support for the bitmap set types.
Anton Danilov [Thu, 28 Aug 2014 06:11:28 +0000 (10:11 +0400)]
netfilter: ipset: Add skbinfo extension kernel support for the bitmap set types.

Add skbinfo extension kernel support for the bitmap set types.
Inroduce the new revisions of bitmap_ip, bitmap_ipmac and bitmap_port set types.

Signed-off-by: Anton Danilov <littlesmilingcloud@gmail.com>
Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
10 years agonetfilter: ipset: Add skbinfo extension kernel support in the ipset core.
Anton Danilov [Thu, 28 Aug 2014 06:11:27 +0000 (10:11 +0400)]
netfilter: ipset: Add skbinfo extension kernel support in the ipset core.

Skbinfo extension provides mapping of metainformation with lookup in the ipset tables.
This patch defines the flags, the constants, the functions and the structures
for the data type independent support of the extension.
Note the firewall mark stores in the kernel structures as two 32bit values,
but transfered through netlink as one 64bit value.

Signed-off-by: Anton Danilov <littlesmilingcloud@gmail.com>
Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
10 years agoFix static checker warning in ip_set_core.c
Jozsef Kadlecsik [Mon, 1 Sep 2014 16:58:43 +0000 (18:58 +0200)]
Fix static checker warning in ip_set_core.c

Dan Carpenter reported the following static checker warning:

        net/netfilter/ipset/ip_set_core.c:1414 call_ad()
        error: 'nlh->nlmsg_len' from user is not capped properly

The payload size is limited now by the max size of size_t.

10 years agoMake possible to compile ipset with IPSET_DEBUG from the dist.
Clinton Roy [Tue, 19 Aug 2014 13:53:16 +0000 (15:53 +0200)]
Make possible to compile ipset with IPSET_DEBUG from the dist.

Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
10 years agoFix warn: integer overflows 'sizeof(*map) + size * set->dsize'
Jozsef Kadlecsik [Tue, 5 Aug 2014 20:02:34 +0000 (22:02 +0200)]
Fix warn: integer overflows 'sizeof(*map) + size * set->dsize'

Dan Carpenter reported that the static checker emits the warning

        net/netfilter/ipset/ip_set_list_set.c:600 init_list_set()
        warn: integer overflows 'sizeof(*map) + size * set->dsize'

Limit the maximal number of elements in list type of sets.

10 years agonet/netfilter/ipset: Resolve missing-field-initializer warnings
Mark Rustad [Tue, 5 Aug 2014 11:56:21 +0000 (04:56 -0700)]
net/netfilter/ipset: Resolve missing-field-initializer warnings

Resolve missing-field-initializer warnings by providing a
directed initializer.

Signed-off-by: Mark Rustad <mark.d.rustad@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
10 years agonetnet,netportnet: Fix value range support for IPv4
Sergey Popovich [Mon, 5 May 2014 08:07:06 +0000 (11:07 +0300)]
netnet,netportnet: Fix value range support for IPv4

Ranges of values are broken with hash:net,net and hash:net,port,net.

hash:net,net
============

   # ipset create test-nn hash:net,net
   # ipset add test-nn 10.0.10.1-10.0.10.127,10.0.0.0/8

   # ipset list test-nn
   Name: test-nn
   Type: hash:net,net
   Revision: 0
   Header: family inet hashsize 1024 maxelem 65536
   Size in memory: 16960
   References: 0
   Members:
   10.0.10.1,10.0.0.0/8

   # ipset test test-nn 10.0.10.65,10.0.0.1
   10.0.10.65,10.0.0.1 is NOT in set test-nn.
   # ipset test test-nn 10.0.10.1,10.0.0.1
   10.0.10.1,10.0.0.1 is in set test-nn.

hash:net,port,net
=================

   # ipset create test-npn hash:net,port,net
   # ipset add test-npn 10.0.10.1-10.0.10.127,tcp:80,10.0.0.0/8
   # ipset list test-npn
   Name: test-npn
   Type: hash:net,port,net
   Revision: 0
   Header: family inet hashsize 1024 maxelem 65536
   Size in memory: 17344
   References: 0
   Members:
   10.0.10.8/29,tcp:80,10.0.0.0
   10.0.10.16/28,tcp:80,10.0.0.0
   10.0.10.2/31,tcp:80,10.0.0.0
   10.0.10.64/26,tcp:80,10.0.0.0
   10.0.10.32/27,tcp:80,10.0.0.0
   10.0.10.4/30,tcp:80,10.0.0.0
   10.0.10.1,tcp:80,10.0.0.0
   # ipset list test-npn
   # ipset test test-npn 10.0.10.126,tcp:80,10.0.0.2
   10.0.10.126,tcp:80,10.0.0.2 is NOT in set test-npn.
   # ipset test test-npn 10.0.10.126,tcp:80,10.0.0.0
   10.0.10.126,tcp:80,10.0.0.0 is in set test-npn.

   # ipset create test-npn hash:net,port,net
   # ipset add test-npn 10.0.10.0/24,tcp:80-81,10.0.0.0/8
   # ipset list test-npn
   Name: test-npn
   Type: hash:net,port,net
   Revision: 0
   Header: family inet hashsize 1024 maxelem 65536
   Size in memory: 17024
   References: 0
   Members:
   10.0.10.0,tcp:80,10.0.0.0
   10.0.10.0,tcp:81,10.0.0.0
   # ipset test test-npn 10.0.10.126,tcp:80,10.0.0.0
   10.0.10.126,tcp:80,10.0.0.0 is NOT in set test-npn.
   # ipset test test-npn 10.0.10.0,tcp:80,10.0.0.0
   10.0.10.0,tcp:80,10.0.0.0 is in set test-npn.

Correctly setup from..to variables where no IPSET_ATTR_IP_TO{,2}
attribute is given, so in range processing loop we construct proper
cidr value. Check whenever we have no ranges and can short cut in
hash:net,net properly. Use unlikely() where appropriate, to comply
with other modules.

Signed-off-by: Sergey Popovich <popovich_sergei@mail.ru>
Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
10 years agolibipset: print third element in debugging
Sergey Popovich [Mon, 5 May 2014 08:07:05 +0000 (11:07 +0300)]
libipset: print third element in debugging

We have that done for first and second elements when
parsing element string, do this for third element for
convenience.

Signed-off-by: Sergey Popovich <popovich_sergei@mail.ru>
Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
10 years agoipset: Handle missing leading zeros in ethernet address parser
Janeks Jaunups [Tue, 6 May 2014 05:30:15 +0000 (07:30 +0200)]
ipset: Handle missing leading zeros in ethernet address parser

ipset would not parse ether addresses which are not exactly
17 characters long, for ex. 1:2:3:4:5:6, which is fixed in
the patch.

Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
10 years agoRemoved invalid IPSET_ATTR_MARKMASK validation
Vytas Dauksa [Fri, 4 Apr 2014 15:10:14 +0000 (16:10 +0100)]
Removed invalid IPSET_ATTR_MARKMASK validation

Markmask is an u32, hence it can't be greater then 4294967295 ( i.e.
0xffffffff ). This was causing smatch warning:
 net/netfilter/ipset/ip_set_hash_gen.h:1084 hash_ipmark_create() warn:
 impossible condition '(markmask > 4294967295) => (0-u32max > u32max)'

Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
10 years agoipset: Pass IPSET_BIN to test scripts to change binary location
Neutron Soutmun [Fri, 4 Apr 2014 03:24:22 +0000 (10:24 +0700)]
ipset: Pass IPSET_BIN to test scripts to change binary location

In the "as-installed" package testing situation, the test scripts should
invokes the system installed "ipset" binary.
Therefore, the IPSET_BIN could be passed to change the binary location.

  IPSET_BIN=/sbin/ipset ./runtest.sh

The test scripts run fine in build source tree without IPSET_BIN.

Signed-off-by: Neutron Soutmun <neo.neutron@gmail.com>
Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
10 years agoipset: Fix grammar error in manpage
Neutron Soutmun [Tue, 1 Apr 2014 10:46:34 +0000 (17:46 +0700)]
ipset: Fix grammar error in manpage

Refer to: https://bugs.launchpad.net/ubuntu/+source/lintian/+bug/608231

The "allows to" is a common grammar error which it will probably be replaced
by "allows one to" as a suggestion in above bug report page.

Signed-off-by: Neutron Soutmun <neo.neutron@gmail.com>
Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
10 years agoipset: Fix printf format warning
Neutron Soutmun [Tue, 1 Apr 2014 10:44:52 +0000 (17:44 +0700)]
ipset: Fix printf format warning

Using PRIx32 macro is portable across multiple architectures and
also fix the printf format warning on any architectures that
"%llx" is not refer to 32 bits size.

Signed-off-by: Neutron Soutmun <neo.neutron@gmail.com>
Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
10 years agoipset 6.21.1 released v6.21.1
Jozsef Kadlecsik [Fri, 7 Mar 2014 12:22:12 +0000 (13:22 +0100)]
ipset 6.21.1 released

10 years agonetfilter: ip_set: rename nfnl_dereference()/nfnl_set()
Patrick McHardy [Fri, 7 Mar 2014 12:18:28 +0000 (13:18 +0100)]
netfilter: ip_set: rename nfnl_dereference()/nfnl_set()

The next patch will introduce a nfnl_dereference() macro that actually
checks that the appropriate mutex is held and therefore needs a
subsystem argument.

Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
10 years agoThe bash utilities are updated
Jozsef Kadlecsik [Fri, 7 Mar 2014 12:10:01 +0000 (13:10 +0100)]
The bash utilities are updated

10 years agoFix libipset library release versioning
Jozsef Kadlecsik [Fri, 7 Mar 2014 12:03:37 +0000 (13:03 +0100)]
Fix libipset library release versioning

Patch "add hash:ip,mark data type to ipset" broke the API and
library release versioning with not incrementing "current",
just "age", which is fixed here. Reported by Mathieu Bridon.

10 years agoipset 6.21 released v6.21
Jozsef Kadlecsik [Tue, 4 Mar 2014 20:40:26 +0000 (21:40 +0100)]
ipset 6.21 released

10 years agoipset: add userspace support for forceadd
Josh Hunt [Sat, 1 Mar 2014 03:14:58 +0000 (22:14 -0500)]
ipset: add userspace support for forceadd

The userspace side of the forceadd changes.

Signed-off-by: Josh Hunt <johunt@akamai.com>
Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
10 years agoipset: add forceadd kernel support for hash set types
Josh Hunt [Sat, 1 Mar 2014 03:14:57 +0000 (22:14 -0500)]
ipset: add forceadd kernel support for hash set types

Adds a new property for hash set types, where if a set is created
with the 'forceadd' option and the set becomes full the next addition
to the set may succeed and evict a random entry from the set.

To keep overhead low eviction is done very simply. It checks to see
which bucket the new entry would be added. If the bucket's pos value
is non-zero (meaning there's at least one entry in the bucket) it
replaces the first entry in the bucket. If pos is zero, then it continues
down the normal add process.

This property is useful if you have a set for 'ban' lists where it may
not matter if you release some entries from the set early.

Signed-off-by: Josh Hunt <johunt@akamai.com>
Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
10 years agonetfilter: ipset: move registration message to init from net_init
Ilia Mirkin [Sun, 16 Feb 2014 10:18:52 +0000 (11:18 +0100)]
netfilter: ipset: move registration message to init from net_init

Commit 1785e8f473 ("netfiler: ipset: Add net namespace for ipset") moved
the initialization print into net_init, which can get called a lot due
to namespaces. Move it back into init, reduce to pr_info.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
10 years agokernel: uapi: fix MARKMASK attr ABI breakage
Florian Westphal [Thu, 13 Feb 2014 11:40:59 +0000 (12:40 +0100)]
kernel: uapi: fix MARKMASK attr ABI breakage

commit 2dfb973c0dcc6d2211 (add markmask for hash:ip,mark data type)
inserted IPSET_ATTR_MARKMASK in-between other enum values, i.e.
changing values of all further attributes.  This causes 'ipset list'
segfault on existing kernels since ipset no longer finds
IPSET_ATTR_MEMSIZE (it has a different value on kernel side).

Jozsef points out it should be moved below IPSET_ATTR_MARK which
works since there is some extra reserved space after that value.

Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
10 years agolib: fix ifname 'physdev:' prefix parsing
Florian Westphal [Wed, 12 Feb 2014 09:27:19 +0000 (10:27 +0100)]
lib: fix ifname 'physdev:' prefix parsing

hash:net,iface supports matching on the bridge port as well,
but userspace currently doesn't handle it correctly as it passes
in 'physdev:eth0' instead of 'eth0'+IPSET_OPT_PHYSDEV.

Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
10 years agoPrepare the kernel for create option flags when no extension is needed
Jozsef Kadlecsik [Thu, 13 Feb 2014 11:19:56 +0000 (12:19 +0100)]
Prepare the kernel for create option flags when no extension is needed

10 years agoprint mark & mark mask in hex rather then decimal
Vytas Dauksa [Thu, 23 Jan 2014 06:37:48 +0000 (07:37 +0100)]
print mark & mark mask in hex rather then decimal

modified ipset_print_mark to print in hex rather then decimal and
altered accordingly test cases.

Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
10 years agoadd markmask for hash:ip,mark data type
Vytas Dauksa [Tue, 17 Dec 2013 14:01:44 +0000 (14:01 +0000)]
add markmask for hash:ip,mark data type

Introduce packet mark mask for hash:ip,mark data type. This allows to
set mark bit filter for the ip set.

Change-Id: Id8dd9ca7e64477c4f7b022a1d9c1a5b187f1c96e

Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
10 years agoadd hash:ip,mark data type to ipset
Vytas Dauksa [Tue, 17 Dec 2013 14:01:43 +0000 (14:01 +0000)]
add hash:ip,mark data type to ipset

Introduce packet mark support with new ip,mark hash set. This includes
userspace and kernelspace code, hash:ip,mark set tests and man page
updates.

The intended use of ip,mark set is similar to the ip:port type, but for
protocols which don't use a predictable port number. Instead of port
number it matches a firewall mark determined by a layer 7 filtering
program like opendpi.

As well as allowing or blocking traffic it will also be used for
accounting packets and bytes sent for each protocol.

Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
10 years agoipset: remove unused code
Stephen Hemminger [Tue, 7 Jan 2014 16:31:47 +0000 (17:31 +0100)]
ipset: remove unused code

Function never used in current upstream code.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
10 years agonetfilter: ipset: Add hash: fix coccinelle warnings
Fengguang Wu [Fri, 27 Dec 2013 10:13:03 +0000 (11:13 +0100)]
netfilter: ipset: Add hash: fix coccinelle warnings

net/netfilter/ipset/ip_set_hash_netnet.c:115:8-9: WARNING: return of 0/1 in function 'hash_netnet4_data_list' with return type bool
/c/kernel-tests/src/cocci/net/netfilter/ipset/ip_set_hash_netnet.c:338:8-9: WARNING: return of 0/1 in function 'hash_netnet6_data_list' with return type bool

Return statements in functions returning bool should use
true/false instead of 1/0.
Generated by: coccinelle/misc/boolreturn.cocci

Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
10 years agoTypo in ip_set_hash_netnet.c fixed
David Binderman [Tue, 3 Dec 2013 16:11:23 +0000 (17:11 +0100)]
Typo in ip_set_hash_netnet.c fixed

I just ran the static analyser "cppcheck" over the source
code of linux-3.13-rc1. It said

[linux-3.13-rc1/net/netfilter/ipset/ip_set_hash_netnet.c:62] ->
[linux-3.13-rc1/net/net
filter/ipset/ip_set_hash_netnet.c:62]: (style)
Same expression on both sides of '=='.

Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
10 years agoipset: manpage: correct add action synopsis for hash:net,port,net.
Mart Frauenlob [Mon, 18 Nov 2013 14:20:52 +0000 (15:20 +0100)]
ipset: manpage: correct add action synopsis for hash:net,port,net.

Signed-off-by: Mart Frauenlob <mart.frauenlob@chello.at>
Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
10 years agoipset: manpage: remove spare comma for hash:net,net test action.
Mart Frauenlob [Mon, 18 Nov 2013 14:18:50 +0000 (15:18 +0100)]
ipset: manpage: remove spare comma for hash:net,net test action.

Signed-off-by: Mart Frauenlob <mart.frauenlob@chello.at>
Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
10 years agonet ipset: use rbtree postorder iteration instead of opencoding
Cody P Schafer [Wed, 13 Nov 2013 09:30:35 +0000 (10:30 +0100)]
net ipset: use rbtree postorder iteration instead of opencoding

Use rbtree_postorder_for_each_entry_safe() to destroy the rbtree instead
of opencoding an alternate postorder iteration that modifies the tree

Signed-off-by: Cody P Schafer <cody@linux.vnet.ibm.com>
Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
10 years agoFix all set output from list/save when set with counters in use.
Sergey Popovich [Tue, 12 Nov 2013 10:30:56 +0000 (12:30 +0200)]
Fix all set output from list/save when set with counters in use.

Using upstream version with counters support we have following
output when listing all sets currently configured:
--------------------------------------------------

 # ipset create test-1 hash:ip
 # ipset create test-2 hash:ip counters
 # ipset add test-2 192.0.2.1/32
 # ipset create test-3 hash:ip
 # ipset add test-3 192.0.2.1/32
 # ipset list
 Name: test-1
 Type: hash:ip
 Revision: 2
 Header: family inet hashsize 1024 maxelem 65536
 Size in memory: 16504
 References: 0
 Members:

 Name: test-2
 Type: hash:ip
 Revision: 2
 Header: family inet hashsize 1024 maxelem 65536 counters
 Size in memory: 16616
 References: 0
 Members:
 192.0.2.1 packets 0 bytes 0

 Name: test-3
 Type: hash:ip
 Revision: 2
 Header: family inet hashsize 1024 maxelem 65536 counters
 Size in memory: 16520
 References: 0
 Members:
 192.0.2.1 packets 0 bytes 0

Set test-3 created without counters, but displayed as with counters
present.

Restricting output to list only test-3 set we have:
---------------------------------------------------
  # ipset list test-3
  Name: test-3
  Type: hash:ip
  Revision: 2
  Header: family inet hashsize 1024 maxelem 65536
  Size in memory: 16520
  References: 0
  Members:
  192.0.2.1

So test-3 set created correctly without counters support, but in
all sets listing it displayed as such one with counters.

It seems with commit 5a6021823aa0da24b83f8d03f46ad4202f149fa3
(Support counters in the ipset library) we fogot to add counter
options flags to IPSET_CREATE_FLAGS and IPSET_ADT_FLAGS defines to
clear these flags when preparing output in callback_list() from
lib/session.c.

v2: Remove IPSET_OPT_BYTES, IPSET_PAKETS from CREATE and
    IPSET_OPT_COUNTERS from ADT.

Signed-off-by: Sergey Popovich <popovich_sergei@mail.ru>
Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
10 years agoipset: Follow manual page behavior for SET target on list:set
Sergey Popovich [Thu, 7 Nov 2013 10:56:45 +0000 (12:56 +0200)]
ipset: Follow manual page behavior for SET target on list:set

ipset(8) for list:set says:
  The match will try to find a matching entry in the sets and the
  target will try to add an entry to the first set to which it can
  be added.

However real behavior is bit differ from described. Consider example:

 # ipset create test-1-v4 hash:ip family inet
 # ipset create test-1-v6 hash:ip family inet6
 # ipset create test-1 list:set
 # ipset add test-1 test-1-v4
 # ipset add test-1 test-1-v6

 # iptables  -A INPUT -p tcp --destination-port 25 -j SET --add-set test-1 src
 # ip6tables -A INPUT -p tcp --destination-port 25 -j SET --add-set test-1 src

And then when iptables/ip6tables rule matches packet IPSET target
tries to add src from packet to the list:set test-1 where first
entry is test-1-v4 and the second one is test-1-v6.

For IPv4, as it first entry in test-1 src added to test-1-v4
correctly, but for IPv6 src not added!

Placing test-1-v6 to the first element of list:set makes behavior
correct for IPv6, but brokes for IPv4.

This is due to result, returned from ip_set_add() and ip_set_del() from
net/netfilter/ipset/ip_set_core.c when set in list:set equires more
parameters than given or address families do not match (which is this
case).

It seems wrong returning 0 from ip_set_add() and ip_set_del() in
this case, as 0 should be returned only when an element successfuly
added/deleted to/from the set, contrary to ip_set_test() which
returns 0 when no entry exists and >0 when entry found in set.

Signed-off-by: Sergey Popovich <popovich_sergei@mail.ru>
Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
10 years agoipset: Fix malformed output from list/save for ICMP types in port field.
Sergey Popovich [Thu, 7 Nov 2013 10:56:15 +0000 (12:56 +0200)]
ipset: Fix malformed output from list/save for ICMP types in port field.

Found with ipset 6.12.1, but upstream version is still affected.

Creating set of dimension three, adding elements to it and then
displaying gives following results:
-----------------------------------

 # ipset create test-1 hash:ip,port,ip
 # ipset add test-1 192.0.2.1,icmp:echo-request,192.0.2.1
 # ipset add test-1 192.0.2.1,icmp:ttl-zero-during-reassembly,192.0.2.1
 # ipset list test-1
 Name: test-1
 Type: hash:ip,port,ip
 Header: family inet hashsize 1024 maxelem 65536
 Size in memory: 16608
 References: 0
 Members:
 192.0.2.1,icmp:ttl-zero-during-reass,192.0.2.1
 192.0.2.1,icmp:echo-re,192.0.2.1

Same results with -output save|xml.

ipset_print_proto_port() from lib/print.c returns incorrect length
of printed string when ICMP/ICMPv6 specified in port field.

Signed-off-by: Sergey Popovich <popovich_sergei@mail.ru>
Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
10 years agoipset: fix timeout data type size
Nikolay Martynov [Thu, 31 Oct 2013 04:34:31 +0000 (00:34 -0400)]
ipset: fix timeout data type size

Currently it is impossible to set timeout on some architectures
(MIPS ar71xx at least) because timeout is parsed into long long data
type but used as uint32 without proper conversion. This patch fixes
this issue. Tested on ar71xx router.

Signed-off-by: Nikolay Martynov <mar.kolya@gmail.com>
Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
10 years agoipset 6.20.1 released v6.20.1
Jozsef Kadlecsik [Sun, 27 Oct 2013 18:38:37 +0000 (19:38 +0100)]
ipset 6.20.1 released

10 years agobuild: fix incorrect library versioning
Jan Engelhardt [Sun, 20 Oct 2013 13:17:24 +0000 (15:17 +0200)]
build: fix incorrect library versioning

Commit v6.20~12 caused libipset to shift from libipset.so.3 to
.so.2. That is the wrong thing to do. Set it back to 3+2, as
intended.

Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
10 years agonetfilter: ipset: remove duplicate define
Michael Opdenacker [Sun, 27 Oct 2013 18:06:45 +0000 (19:06 +0100)]
netfilter: ipset: remove duplicate define

This patch removes a duplicate define from
net/netfilter/ipset/ip_set_hash_gen.h

Signed-off-by: Michael Opdenacker <michael.opdenacker@free-electrons.com>
10 years agonet->user_ns is available starting from 3.8, add compatibility checking
Jozsef Kadlecsik [Sun, 27 Oct 2013 18:00:36 +0000 (19:00 +0100)]
net->user_ns is available starting from 3.8, add compatibility checking

Reported by Jan Engelhardt

10 years agoFix memory allocation for bitmap:port
Jozsef Kadlecsik [Fri, 18 Oct 2013 12:03:41 +0000 (14:03 +0200)]
Fix memory allocation for bitmap:port

At the restructuring of the bitmap types creation in ipset, for the
bitmap:port type wrong (too large) memory allocation was copied
(netfilter bugzilla id #859).

Reported-by: Quentin Armitage <quentin@armitage.org.uk>
10 years agonetfilter: ipset: Fix configure failure when --with-kmod=no
Oliver Smith [Fri, 11 Oct 2013 14:41:12 +0000 (16:41 +0200)]
netfilter: ipset: Fix configure failure when --with-kmod=no

When configuring the sources to build without kernel modules, the path
to the kernel sources was not set and the kernel header files were still
checked.

Now, we do not check the kernel sources for compatibility if we're not
going to build any kernel modules.

Signed-off-by: Oliver Smith <oliver@8.c.9.b.0.7.4.0.1.0.0.2.ip6.arpa>
Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
10 years agoAvoid clashing with configured kernel in [CONFIG_]IP_SET_MAX
Jozsef Kadlecsik [Tue, 8 Oct 2013 19:16:01 +0000 (21:16 +0200)]
Avoid clashing with configured kernel in [CONFIG_]IP_SET_MAX

10 years agoThe unnamed union initialization may lead to compilation error
Jozsef Kadlecsik [Tue, 8 Oct 2013 19:05:20 +0000 (21:05 +0200)]
The unnamed union initialization may lead to compilation error

The unnamed union should be possible to be initialized directly, but
unfortunately it's not so:

/usr/src/ipset/kernel/net/netfilter/ipset/ip_set_hash_netnet.c: In
function ?hash_netnet4_kadt?:
/usr/src/ipset/kernel/net/netfilter/ipset/ip_set_hash_netnet.c:141:
error: unknown field ?cidr? specified in initializer

Reported-by: Husnu Demir <hdemir@metu.edu.tr>
10 years agoUse dev_net() instead of the direct access to ->nd_net
Jozsef Kadlecsik [Fri, 4 Oct 2013 19:59:39 +0000 (21:59 +0200)]
Use dev_net() instead of the direct access to ->nd_net

We have to use dev_net() instead of the direct access to ->nd_net,
otherwise compilation fails if NET_NS is not enabled. Reported by
the kbuild test robot.

10 years agoipset 6.20 released v6.20
Jozsef Kadlecsik [Wed, 2 Oct 2013 20:53:23 +0000 (22:53 +0200)]
ipset 6.20 released

10 years agoMissing comment support added to hash:ip,port,ip and hash:net,iface types
Jozsef Kadlecsik [Wed, 2 Oct 2013 20:40:34 +0000 (22:40 +0200)]
Missing comment support added to hash:ip,port,ip and hash:net,iface types

10 years agoCompatibility code is modified not to rely on kernel version numbers
Jozsef Kadlecsik [Wed, 2 Oct 2013 15:31:15 +0000 (17:31 +0200)]
Compatibility code is modified not to rely on kernel version numbers

Instead the kernel source code is checked to verify the different
compatibility issues for the supported kernel releases.

This way hopefully backported features will be handled properly.

10 years agoUse netlink callback dump args only
Jozsef Kadlecsik [Wed, 2 Oct 2013 06:13:18 +0000 (08:13 +0200)]
Use netlink callback dump args only

Instead of cb->data, use callback dump args only and introduce symbolic
names instead of plain numbers at accessing the argument members.

10 years agoipset: Add userspace code to support hash:net,port,net kernel module.
Oliver Smith [Sat, 28 Sep 2013 18:20:01 +0000 (20:20 +0200)]
ipset: Add userspace code to support hash:net,port,net kernel module.

This adds the userspace library, tests to validate correct operation of
the module and also provides appropriate usage information in the man
page.

Signed-off-by: Oliver Smith <oliver@8.c.9.b.0.7.4.0.1.0.0.2.ip6.arpa>
Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
11 years agonetfilter: ipset: Add hash:net,port,net module to kernel.
Oliver Smith [Sat, 28 Sep 2013 18:33:23 +0000 (20:33 +0200)]
netfilter: ipset: Add hash:net,port,net module to kernel.

This adds a new set that provides similar functionality to ip,port,net
but permits arbitrary size subnets for both the first and last
parameter.

Signed-off-by: Oliver Smith <oliver@8.c.9.b.0.7.4.0.1.0.0.2.ip6.arpa>
Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
11 years agoipset: Add net namespace for ipset
Vitaly Lavrov [Sat, 28 Sep 2013 16:41:20 +0000 (18:41 +0200)]
ipset: Add net namespace for ipset

This patch adds netns support for ipset.

Major changes were made in ip_set_core.c and ip_set.h.
Global variables are moved to per net namespace.
Added initialization code and the destruction of the network namespace ipset subsystem.
In the prototypes of public functions ip_set_* added parameter "struct net*".

The remaining corrections related to the change prototypes of public functions ip_set_*.

The patch for git://git.netfilter.org/ipset.git commit 6a4ec96c0b8caac5c35474e40e319704d92ca347

Signed-off-by: Vitaly Lavrov <lve@guap.ru>
Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
11 years agoUse a common function at listing the extensions of the elements
Jozsef Kadlecsik [Wed, 25 Sep 2013 15:44:35 +0000 (17:44 +0200)]
Use a common function at listing the extensions of the elements

11 years agoTests added to check comment extension
Jozsef Kadlecsik [Tue, 24 Sep 2013 15:20:26 +0000 (17:20 +0200)]
Tests added to check comment extension

11 years agoFor set:list types, replaced elements must be zeroed out
Jozsef Kadlecsik [Mon, 23 Sep 2013 19:28:06 +0000 (21:28 +0200)]
For set:list types, replaced elements must be zeroed out

The new extensions require zero initialization for the new element
to be added into a slot from where another element was pushed away.

11 years agoFix hash resizing with comments
Jozsef Kadlecsik [Mon, 23 Sep 2013 15:45:21 +0000 (17:45 +0200)]
Fix hash resizing with comments

The destroy function must take into account that resizing doesn't
create new extensions so those cannot be destroyed at resize.

11 years agoipset: Add new userspace set revisions for comment support
Oliver Smith [Sun, 22 Sep 2013 18:56:36 +0000 (20:56 +0200)]
ipset: Add new userspace set revisions for comment support

This introduces new revisions of all hash and bitmap ipsets to
complement the comment functionality introduced into the kernel modules.

Currently all sets have a compile-time limit of 255 characters including
\0. This can otherwise be arbitrarily modified.

Signed-off-by: Oliver Smith <oliver@8.c.9.b.0.7.4.0.1.0.0.2.ip6.arpa>
Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
11 years agoipset: Support comments in the userspace library.
Oliver Smith [Sun, 22 Sep 2013 18:56:35 +0000 (20:56 +0200)]
ipset: Support comments in the userspace library.

This adds support to the userspace portion of ipset for handling ipsets
with the comment extension enabled. The library revision has been raised
accordingly.

Signed-off-by: Oliver Smith <oliver@8.c.9.b.0.7.4.0.1.0.0.2.ip6.arpa>
Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
11 years agoipset: Rework the "fake" argument parsing for ipset restore.
Oliver Smith [Sun, 22 Sep 2013 18:56:34 +0000 (20:56 +0200)]
ipset: Rework the "fake" argument parsing for ipset restore.

This reworks the argument parsing functionality of ipset to handle
quote-delimited lines in such a way that they are considered to be a
single argument.

This commit is necessary for ipset to successfully restore sets that
have comments.

Signed-off-by: Oliver Smith <oliver@8.c.9.b.0.7.4.0.1.0.0.2.ip6.arpa>
Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
11 years agonetfilter: ipset: Support comments in the list-type ipset.
Oliver Smith [Sun, 22 Sep 2013 18:56:33 +0000 (20:56 +0200)]
netfilter: ipset: Support comments in the list-type ipset.

This provides kernel support for creating list ipsets with the comment
annotation extension.

Signed-off-by: Oliver Smith <oliver@8.c.9.b.0.7.4.0.1.0.0.2.ip6.arpa>
Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
11 years agonetfilter: ipset: Support comments in bitmap-type ipsets.
Oliver Smith [Sun, 22 Sep 2013 18:56:32 +0000 (20:56 +0200)]
netfilter: ipset: Support comments in bitmap-type ipsets.

This provides kernel support for creating bitmap ipsets with comment
support.

As is the case for hashes, this incurs a penalty when flushing or
destroying the entire ipset as the entries must first be walked in order
to free the comment strings. This penalty is of course far less than the
cost of listing an ipset to userspace. Any set created without support
for comments will be flushed/destroyed as before.

Signed-off-by: Oliver Smith <oliver@8.c.9.b.0.7.4.0.1.0.0.2.ip6.arpa>
Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
11 years agonetfilter: ipset: Support comments in hash-type ipsets.
Oliver Smith [Sun, 22 Sep 2013 18:56:31 +0000 (20:56 +0200)]
netfilter: ipset: Support comments in hash-type ipsets.

This provides kernel support for creating ipsets with comment support.

This does incur a penalty to flushing/destroying an ipset since all
entries are walked in order to free the allocated strings, this penalty
is of course less expensive than the operation of listing an ipset to
userspace, so for general-purpose usage the overall impact is expected
to be little to none.

Signed-off-by: Oliver Smith <oliver@8.c.9.b.0.7.4.0.1.0.0.2.ip6.arpa>
Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
11 years agonetfilter: ipset: Support comments for ipset entries in the core.
Oliver Smith [Sun, 22 Sep 2013 18:56:30 +0000 (20:56 +0200)]
netfilter: ipset: Support comments for ipset entries in the core.

This adds the core support for having comments on ipset entries.

The comments are stored as standard null-terminated strings in
dynamically allocated memory after being passed to the kernel. As a
result of this, code has been added to the generic destroy function to
iterate all extensions and call that extension's destroy task if the set
has that extension activated, and if such a task is defined.

Signed-off-by: Oliver Smith <oliver@8.c.9.b.0.7.4.0.1.0.0.2.ip6.arpa>
Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
11 years agoipset: Add userspace code to support hash:net,net kernel module.
Oliver Smith [Fri, 20 Sep 2013 08:13:54 +0000 (10:13 +0200)]
ipset: Add userspace code to support hash:net,net kernel module.

This adds the userspace library, tests to validate correct operation of
the module and also provides appropriate usage information in the man
page. The library version has been bumped accordingly.

Signed-off-by: Oliver Smith <oliver@8.c.9.b.0.7.4.0.1.0.0.2.ip6.arpa>
Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
11 years agonetfilter: ipset: Add hash:net,net module to kernel.
Oliver Smith [Fri, 20 Sep 2013 08:13:53 +0000 (10:13 +0200)]
netfilter: ipset: Add hash:net,net module to kernel.

This adds a new set that provides the ability to configure pairs of
subnets. A small amount of additional handling code has been added to
the generic hash header file - this code is conditionally activated by a
preprocessor definition.

Signed-off-by: Oliver Smith <oliver@8.c.9.b.0.7.4.0.1.0.0.2.ip6.arpa>
Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
11 years agoKconfig: ipset needs NETFILTER_NETLINK
Jozsef Kadlecsik [Tue, 17 Sep 2013 08:32:58 +0000 (10:32 +0200)]
Kconfig: ipset needs NETFILTER_NETLINK

NETFILTER_NETLINK is not selectable in recent kernels, check and warn
if not enabled indirectly.

11 years agoAdd test to verify CIDR tracking
Jozsef Kadlecsik [Sun, 15 Sep 2013 13:11:17 +0000 (15:11 +0200)]
Add test to verify CIDR tracking

11 years agonetfilter: ipset: Fix serious failure in CIDR tracking
Oliver Smith [Sat, 14 Sep 2013 09:05:53 +0000 (11:05 +0200)]
netfilter: ipset: Fix serious failure in CIDR tracking

This fixes a serious bug affecting all hash types with a net element -
specifically, if a CIDR value is deleted such that none of the same size
exist any more, all larger (less-specific) values will then fail to
match. Adding back any prefix with a CIDR equal to or more specific than
the one deleted will fix it.

Steps to reproduce:
ipset -N test hash:net
ipset -A test 1.1.0.0/16
ipset -A test 2.2.2.0/24
ipset -T test 1.1.1.1 #1.1.1.1 IS in set
ipset -D test 2.2.2.0/24
ipset -T test 1.1.1.1 #1.1.1.1 IS NOT in set

This is due to the fact that the nets counter was unconditionally
decremented prior to the iteration that shifts up the entries. Now, we
first check if there is a proceeding entry and if not, decrement it and
return. Otherwise, we proceed to iterate and then zero the last element,
which, in most cases, will already be zero.

Signed-off-by: Oliver Smith <oliver@8.c.9.b.0.7.4.0.1.0.0.2.ip6.arpa>
Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
11 years agoconfigure: uclinux is also linux
Gustavo Zacarias [Tue, 10 Sep 2013 19:23:27 +0000 (16:23 -0300)]
configure: uclinux is also linux

Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
11 years agolist:set: make sure all elements are checked by the gc
Jozsef Kadlecsik [Mon, 9 Sep 2013 15:10:20 +0000 (17:10 +0200)]
list:set: make sure all elements are checked by the gc

When an element timed out, the next one was skipped by the garbage
collector, fixed.

11 years agoSupport extensions which need a per data destroy function
Jozsef Kadlecsik [Mon, 9 Sep 2013 12:44:29 +0000 (14:44 +0200)]
Support extensions which need a per data destroy function