From 48a71a20420e307d0a1d8a89ac9fc7b46ec5a1ca Mon Sep 17 00:00:00 2001 From: Laura Garcia Liebana Date: Sat, 13 Aug 2016 01:02:03 +0200 Subject: expr: add hash expression Support for the nft hash expression in libnftnl. Signed-off-by: Laura Garcia Liebana Signed-off-by: Pablo Neira Ayuso --- include/buffer.h | 2 ++ include/libnftnl/expr.h | 8 ++++++++ include/linux/netfilter/nf_tables.h | 21 +++++++++++++++++++++ 3 files changed, 31 insertions(+) (limited to 'include') diff --git a/include/buffer.h b/include/buffer.h index cc4bfbc..a753c78 100644 --- a/include/buffer.h +++ b/include/buffer.h @@ -89,5 +89,7 @@ int nftnl_buf_reg(struct nftnl_buf *b, int type, union nftnl_data_reg *reg, #define DELETE "delete" #define REPLACE "replace" #define FLUSH "flush" +#define MODULUS "modulus" +#define SEED "seed" #endif diff --git a/include/libnftnl/expr.h b/include/libnftnl/expr.h index 17f60bd..1efe31c 100644 --- a/include/libnftnl/expr.h +++ b/include/libnftnl/expr.h @@ -191,6 +191,14 @@ enum { NFTNL_EXPR_FWD_SREG_DEV = NFTNL_EXPR_BASE, }; +enum { + NFTNL_EXPR_HASH_SREG = NFTNL_EXPR_BASE, + NFTNL_EXPR_HASH_DREG, + NFTNL_EXPR_HASH_LEN, + NFTNL_EXPR_HASH_MODULUS, + NFTNL_EXPR_HASH_SEED, +}; + /* * Compat */ diff --git a/include/linux/netfilter/nf_tables.h b/include/linux/netfilter/nf_tables.h index 01751fa..fcf9a39 100644 --- a/include/linux/netfilter/nf_tables.h +++ b/include/linux/netfilter/nf_tables.h @@ -1082,4 +1082,25 @@ enum nft_trace_types { __NFT_TRACETYPE_MAX }; #define NFT_TRACETYPE_MAX (__NFT_TRACETYPE_MAX - 1) + +/** + * enum nft_hash_attributes - nf_tables hash expression attributes + * + * @NFTA_HASH_SREG: source register (NLA_U32) + * @NFTA_HASH_DREG: destination register (NLA_U32) + * @NFTA_HASH_LEN: data length (NLA_U32) + * @NFTA_HASH_MODULUS: Modulus value (NLA_U32) + * @NFTA_HASH_SEED: hash initial value (NLA_U32) + */ +enum nft_hash_attributes { + NFTA_HASH_UNSPEC, + NFTA_HASH_SREG, + NFTA_HASH_DREG, + NFTA_HASH_LEN, + NFTA_HASH_MODULUS, + NFTA_HASH_SEED, + __NFTA_HASH_MAX +}; +#define NFTA_HASH_MAX (__NFTA_HASH_MAX - 1) + #endif /* _LINUX_NF_TABLES_H */ -- cgit v1.2.3