aboutsummaryrefslogtreecommitdiffstats
path: root/include/uapi
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2014-04-03 05:48:44 -0400
committerPablo Neira Ayuso <pablo@netfilter.org>2014-05-19 06:06:10 -0400
commit958bee14d0718ca7a5002c0f48a099d1d345812a (patch)
tree608d1ca657f8d5b23524b6c655734f401d9a7a84 /include/uapi
parentb380e5c733b9f18a6a3ebb97963b6dd037339bc0 (diff)
netfilter: nf_tables: use new transaction infrastructure to handle sets
This patch reworks the nf_tables API so set updates are included in the same batch that contains rule updates. This speeds up rule-set updates since we skip a dialog of four messages between kernel and user-space (two on each direction), from: 1) create the set and send netlink message to the kernel 2) process the response from the kernel that contains the allocated name. 3) add the set elements and send netlink message to the kernel. 4) process the response from the kernel (to check for errors). To: 1) add the set to the batch. 2) add the set elements to the batch. 3) add the rule that points to the set. 4) send batch to the kernel. This also introduces an internal set ID (NFTA_SET_ID) that is unique in the batch so set elements and rules can refer to new sets. Backward compatibility has been only retained in userspace, this means that new nft versions can talk to the kernel both in the new and the old fashion. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'include/uapi')
-rw-r--r--include/uapi/linux/netfilter/nf_tables.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/uapi/linux/netfilter/nf_tables.h b/include/uapi/linux/netfilter/nf_tables.h
index 7d6433f66bf8..2a88f645a5d8 100644
--- a/include/uapi/linux/netfilter/nf_tables.h
+++ b/include/uapi/linux/netfilter/nf_tables.h
@@ -246,6 +246,7 @@ enum nft_set_desc_attributes {
246 * @NFTA_SET_DATA_LEN: mapping data length (NLA_U32) 246 * @NFTA_SET_DATA_LEN: mapping data length (NLA_U32)
247 * @NFTA_SET_POLICY: selection policy (NLA_U32) 247 * @NFTA_SET_POLICY: selection policy (NLA_U32)
248 * @NFTA_SET_DESC: set description (NLA_NESTED) 248 * @NFTA_SET_DESC: set description (NLA_NESTED)
249 * @NFTA_SET_ID: uniquely identifies a set in a transaction (NLA_U32)
249 */ 250 */
250enum nft_set_attributes { 251enum nft_set_attributes {
251 NFTA_SET_UNSPEC, 252 NFTA_SET_UNSPEC,
@@ -258,6 +259,7 @@ enum nft_set_attributes {
258 NFTA_SET_DATA_LEN, 259 NFTA_SET_DATA_LEN,
259 NFTA_SET_POLICY, 260 NFTA_SET_POLICY,
260 NFTA_SET_DESC, 261 NFTA_SET_DESC,
262 NFTA_SET_ID,
261 __NFTA_SET_MAX 263 __NFTA_SET_MAX
262}; 264};
263#define NFTA_SET_MAX (__NFTA_SET_MAX - 1) 265#define NFTA_SET_MAX (__NFTA_SET_MAX - 1)
@@ -293,12 +295,14 @@ enum nft_set_elem_attributes {
293 * @NFTA_SET_ELEM_LIST_TABLE: table of the set to be changed (NLA_STRING) 295 * @NFTA_SET_ELEM_LIST_TABLE: table of the set to be changed (NLA_STRING)
294 * @NFTA_SET_ELEM_LIST_SET: name of the set to be changed (NLA_STRING) 296 * @NFTA_SET_ELEM_LIST_SET: name of the set to be changed (NLA_STRING)
295 * @NFTA_SET_ELEM_LIST_ELEMENTS: list of set elements (NLA_NESTED: nft_set_elem_attributes) 297 * @NFTA_SET_ELEM_LIST_ELEMENTS: list of set elements (NLA_NESTED: nft_set_elem_attributes)
298 * @NFTA_SET_ELEM_LIST_SET_ID: uniquely identifies a set in a transaction (NLA_U32)
296 */ 299 */
297enum nft_set_elem_list_attributes { 300enum nft_set_elem_list_attributes {
298 NFTA_SET_ELEM_LIST_UNSPEC, 301 NFTA_SET_ELEM_LIST_UNSPEC,
299 NFTA_SET_ELEM_LIST_TABLE, 302 NFTA_SET_ELEM_LIST_TABLE,
300 NFTA_SET_ELEM_LIST_SET, 303 NFTA_SET_ELEM_LIST_SET,
301 NFTA_SET_ELEM_LIST_ELEMENTS, 304 NFTA_SET_ELEM_LIST_ELEMENTS,
305 NFTA_SET_ELEM_LIST_SET_ID,
302 __NFTA_SET_ELEM_LIST_MAX 306 __NFTA_SET_ELEM_LIST_MAX
303}; 307};
304#define NFTA_SET_ELEM_LIST_MAX (__NFTA_SET_ELEM_LIST_MAX - 1) 308#define NFTA_SET_ELEM_LIST_MAX (__NFTA_SET_ELEM_LIST_MAX - 1)
@@ -484,12 +488,14 @@ enum nft_cmp_attributes {
484 * @NFTA_LOOKUP_SET: name of the set where to look for (NLA_STRING) 488 * @NFTA_LOOKUP_SET: name of the set where to look for (NLA_STRING)
485 * @NFTA_LOOKUP_SREG: source register of the data to look for (NLA_U32: nft_registers) 489 * @NFTA_LOOKUP_SREG: source register of the data to look for (NLA_U32: nft_registers)
486 * @NFTA_LOOKUP_DREG: destination register (NLA_U32: nft_registers) 490 * @NFTA_LOOKUP_DREG: destination register (NLA_U32: nft_registers)
491 * @NFTA_LOOKUP_SET_ID: uniquely identifies a set in a transaction (NLA_U32)
487 */ 492 */
488enum nft_lookup_attributes { 493enum nft_lookup_attributes {
489 NFTA_LOOKUP_UNSPEC, 494 NFTA_LOOKUP_UNSPEC,
490 NFTA_LOOKUP_SET, 495 NFTA_LOOKUP_SET,
491 NFTA_LOOKUP_SREG, 496 NFTA_LOOKUP_SREG,
492 NFTA_LOOKUP_DREG, 497 NFTA_LOOKUP_DREG,
498 NFTA_LOOKUP_SET_ID,
493 __NFTA_LOOKUP_MAX 499 __NFTA_LOOKUP_MAX
494}; 500};
495#define NFTA_LOOKUP_MAX (__NFTA_LOOKUP_MAX - 1) 501#define NFTA_LOOKUP_MAX (__NFTA_LOOKUP_MAX - 1)