linux/net/netfilter/ipset
Sergey Popovich 35f6e63abe netfilter: 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>
2014-03-06 09:31:41 +01:00
..
ip_set_bitmap_gen.h netfilter: ipset: Use netlink callback dump args only 2013-10-22 10:13:59 +02:00
ip_set_bitmap_ip.c netfiler: ipset: Add net namespace for ipset 2013-09-30 21:42:52 +02:00
ip_set_bitmap_ipmac.c netfiler: ipset: Add net namespace for ipset 2013-09-30 21:42:52 +02:00
ip_set_bitmap_port.c netfilter:ipset: Fix memory allocation for bitmap:port 2013-10-27 19:24:39 +01:00
ip_set_core.c netfilter: ipset: Follow manual page behavior for SET target on list:set 2014-03-06 09:31:41 +01:00
ip_set_getport.c netfilter: ipset: Support package fragments for IPv4 protos without ports 2013-09-30 21:33:26 +02:00
ip_set_hash_gen.h netfilter: ipset: remove duplicate define 2013-10-27 19:24:45 +01:00
ip_set_hash_ip.c netfilter: ipset: Support comments in hash-type ipsets. 2013-09-30 21:33:29 +02:00
ip_set_hash_ipport.c netfilter: ipset: Support comments in hash-type ipsets. 2013-09-30 21:33:29 +02:00
ip_set_hash_ipportip.c netfilter: ipset: Support comments in hash-type ipsets. 2013-09-30 21:33:29 +02:00
ip_set_hash_ipportnet.c netfilter: ipset: Support comments in hash-type ipsets. 2013-09-30 21:33:29 +02:00
ip_set_hash_net.c netfilter: ipset: Support comments in hash-type ipsets. 2013-09-30 21:33:29 +02:00
ip_set_hash_netiface.c net/netfilter/ipset/ip_set_hash_netiface.c: use rbtree postorder iteration instead of opencoding 2014-01-23 16:37:03 -08:00
ip_set_hash_netnet.c netfilter: ipset: fix incorret comparison in hash_netnet4_data_equal() 2013-11-25 22:42:18 +01:00
ip_set_hash_netport.c netfilter: ipset: Support comments in hash-type ipsets. 2013-09-30 21:33:29 +02:00
ip_set_hash_netportnet.c netfilter: ipset: The unnamed union initialization may lead to compilation error 2013-10-22 10:14:01 +02:00
ip_set_list_set.c netfilter: ipset: Use netlink callback dump args only 2013-10-22 10:13:59 +02:00
Kconfig Merge branch 'master' into for-next 2013-12-19 15:08:32 +01:00
Makefile netfilter: ipset: Add hash:net,port,net module to kernel. 2013-09-30 21:42:58 +02:00
pfxlen.c net: Add export.h for EXPORT_SYMBOL/THIS_MODULE to non-modules 2011-10-31 19:30:30 -04:00