]> granicus.if.org Git - ipset/commit
Fix all set output from list/save when set with counters in use.
authorSergey Popovich <popovich_sergei@mail.ru>
Tue, 12 Nov 2013 10:30:56 +0000 (12:30 +0200)
committerJozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Wed, 13 Nov 2013 09:08:37 +0000 (10:08 +0100)
commitea39db5d0778ced5bbed902c2b62abe5e7ee8c39
treef82fa0125dd8bfe8b98d82612cf984586679db51
parent0e3c7cac897a4436461e1b77bf0b2f870a63be42
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>
include/libipset/data.h