From 39646feffc0fc247ba8098adb33f76f0a12a9b7a Mon Sep 17 00:00:00 2001 From: Laura Garcia Liebana Date: Sun, 14 Aug 2016 16:48:48 +0200 Subject: expr: add number generation expression Support for the nft ng expression within libnftnl. Signed-off-by: Laura Garcia Liebana Signed-off-by: Pablo Neira Ayuso --- include/buffer.h | 1 + include/libnftnl/expr.h | 6 ++++++ include/linux/netfilter/nf_tables.h | 27 +++++++++++++++++++++++++++ 3 files changed, 34 insertions(+) (limited to 'include') diff --git a/include/buffer.h b/include/buffer.h index a753c78..8cfe377 100644 --- a/include/buffer.h +++ b/include/buffer.h @@ -82,6 +82,7 @@ int nftnl_buf_reg(struct nftnl_buf *b, int type, union nftnl_data_reg *reg, #define TOTAL "total" #define TYPE "type" #define UNIT "unit" +#define UNTIL "until" #define USE "use" #define XOR "xor" #define ADD "add" diff --git a/include/libnftnl/expr.h b/include/libnftnl/expr.h index 663cbf3..8815154 100644 --- a/include/libnftnl/expr.h +++ b/include/libnftnl/expr.h @@ -50,6 +50,12 @@ enum { NFTNL_EXPR_PAYLOAD_CSUM_OFFSET, }; +enum { + NFTNL_EXPR_NG_DREG = NFTNL_EXPR_BASE, + NFTNL_EXPR_NG_UNTIL, + NFTNL_EXPR_NG_TYPE, +}; + enum { NFTNL_EXPR_META_KEY = NFTNL_EXPR_BASE, NFTNL_EXPR_META_DREG, diff --git a/include/linux/netfilter/nf_tables.h b/include/linux/netfilter/nf_tables.h index 6390d6e..0b11abf 100644 --- a/include/linux/netfilter/nf_tables.h +++ b/include/linux/netfilter/nf_tables.h @@ -666,6 +666,33 @@ enum nft_exthdr_attributes { }; #define NFTA_EXTHDR_MAX (__NFTA_EXTHDR_MAX - 1) +/** + * enum nft_ng_attributes - nf_tables number generator expression attributes + * + * @NFTA_NG_DREG: destination register (NLA_U32) + * @NFTA_NG_UNTIL: limit value (NLA_U32) + * @NFTA_NG_TYPE: type of operation (NLA_U32) + */ +enum nft_ng_attributes { + NFTA_NG_UNSPEC, + NFTA_NG_DREG, + NFTA_NG_UNTIL, + NFTA_NG_TYPE, + __NFTA_NG_MAX +}; +#define NFTA_NG_MAX (__NFTA_NG_MAX - 1) + +/** + * enum nft_ng_type - nf_tables number generator expression reject types + * + * @NFT_NG_INCREMENTAL: Incremental number generator + * @NFT_NG_RANDOM: Random number generator + */ +enum nft_ng_type { + NFT_NG_INCREMENTAL, + NFT_NG_RANDOM +}; + /** * enum nft_meta_keys - nf_tables meta expression keys * -- cgit v1.2.3