WiSet moduleΒΆ

High level ipset support.

When IPSet module is providing a direct netlink socket with low level functions, a WiSet object is built to map ipset objects from kernel. It helps to add/remove entries, list content, etc.

For example, adding an entry with pr2modules.ipset.IPSet object implies to set a various number of parameters:

>>> ipset = IPSet()
>>> ipset.add("foo", "", etype="net")
>>> ipset.close()

When they are discovered by a WiSet:

>>> wiset = load_ipset("foo")
>>> wiset.add("")

Listing entries is also easier using WiSet, since it parses for you netlink messages:

>>> wiset.content
{'': IPStats(packets=None, bytes=None, comment=None,
                       timeout=None, skbmark=None, physdev=False)}