History

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.

Oliver Smith committed 13 years ago

Commit 68b63f01 parent ea53ac54 files · +121 −9Browse files

Showing the changes to include/uapi/linux (1 of 4 files). Show all

Unified · Split

include/uapi/linux/netfilter/ipset/ip_set.h+7−1
@@ -10,12 +10,14 @@ · 9 unmodified lines
1010 #ifndef _UAPI_IP_SET_H
1111 #define _UAPI_IP_SET_H
1212
13−
1413 #include <linux/types.h>
1514
1615 /* The protocol version */
1716 #define IPSET_PROTOCOL 6
1817
18+/* The maximum permissible comment length we will accept over netlink */
19+#define IPSET_MAX_COMMENT_SIZE 255
20+
1921 /* The max length of strings including NUL: set and type identifiers */
2022 #define IPSET_MAXNAMELEN 32
2123
@@ -110,6 +112,7 @@ enum { · 88 unmodified lines
110112 IPSET_ATTR_IFACE,
111113 IPSET_ATTR_BYTES,
112114 IPSET_ATTR_PACKETS,
115+ IPSET_ATTR_COMMENT,
113116 __IPSET_ATTR_ADT_MAX,
114117 };
115118 #define IPSET_ATTR_ADT_MAX (__IPSET_ATTR_ADT_MAX - 1)
@@ -140,6 +143,7 @@ enum ipset_errno { · 24 unmodified lines
140143 IPSET_ERR_IPADDR_IPV4,
141144 IPSET_ERR_IPADDR_IPV6,
142145 IPSET_ERR_COUNTER,
146+ IPSET_ERR_COMMENT,
143147
144148 /* Type specific error codes */
145149 IPSET_ERR_TYPE_SPECIFIC = 4352,
@@ -176,6 +180,8 @@ enum ipset_cadt_flags { · 30 unmodified lines
176180 IPSET_FLAG_NOMATCH = (1 << IPSET_FLAG_BIT_NOMATCH),
177181 IPSET_FLAG_BIT_WITH_COUNTERS = 3,
178182 IPSET_FLAG_WITH_COUNTERS = (1 << IPSET_FLAG_BIT_WITH_COUNTERS),
183+ IPSET_FLAG_BIT_WITH_COMMENT = 4,
184+ IPSET_FLAG_WITH_COMMENT = (1 << IPSET_FLAG_BIT_WITH_COMMENT),
179185 IPSET_FLAG_CADT_MAX = 15,
180186 };
181187