Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 393243 - net-firewall/ipset-6.9.1-r2 fails to stop if list:set includes other sets
Summary: net-firewall/ipset-6.9.1-r2 fails to stop if list:set includes other sets
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Robin Johnson
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-12-05 10:51 UTC by Andrew Savchenko
Modified: 2011-12-17 03:30 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
ipset.initd.diff (ipset.initd.diff,785 bytes, patch)
2011-12-05 10:52 UTC, Andrew Savchenko
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Savchenko gentoo-dev 2011-12-05 10:51:21 UTC
Hello,

if ipset set with type list (list:set) exists and is non-empty (includes references to other sets), ipset will refuse to stop even when iptables is stopped, because sets included into list:set have non-zero references counters corresponding to their membership into list:set.

The following rules illustrate this problem:
# cat /var/lib/ipset/rules-save
create private_net hash:net family inet hashsize 64 maxelem 8
add private_net 10.0.0.0/8
create multi_net hash:net family inet hashsize 64 maxelem 8
add multi_net 224.0.0.0/4
create local_net list:set size 4
add local_net private_net
add local_net multi_net

# ipset list
Name: private_net
Type: hash:net
Header: family inet hashsize 64 maxelem 8 
Size in memory: 916
References: 1
Members:
10.0.0.0/8

Name: multi_net
Type: hash:net
Header: family inet hashsize 64 maxelem 8 
Size in memory: 852
References: 1
Members:
224.0.0.0/4

Name: local_net
Type: list:set
Header: size 4 
Size in memory: 48
References: 0
Members:
private_net
multi_net

In order to fix this in-use inits script check should be changed: we need to count number of all references and substract total count of members in all list:set entries. Proposed patch does this.

Currently only list:set can use other sets, so ATM this fix is sufficient.
Comment 1 Andrew Savchenko gentoo-dev 2011-12-05 10:52:33 UTC
Created attachment 294847 [details, diff]
ipset.initd.diff

Proposed patch for init.d script.
Comment 2 Andrew Savchenko gentoo-dev 2011-12-05 10:53:58 UTC
And please note, ipset flush is required, because otherwise list:set entries will not be cleared and sets using by them can't be destroyed.
Comment 3 Peter Volkov (RETIRED) gentoo-dev 2011-12-17 03:30:34 UTC
Thank you for this job! Fixed in 6.10.