From d4f9a8fb9e9acc09b0726e19e7c8e5faaa959803 Mon Sep 17 00:00:00 2001 From: Laura Garcia Liebana Date: Sat, 22 Oct 2016 23:36:07 +0200 Subject: src: add offset attribute for numgen expression Add support to add an offset to the numgen generated value. Example: ct mark set numgen inc mod 2 offset 100 This will generate marks with serie like 100, 101, 100, ... Signed-off-by: Laura Garcia Liebana Signed-off-by: Pablo Neira Ayuso --- include/expression.h | 1 + include/linux/netfilter/nf_tables.h | 2 ++ include/numgen.h | 3 ++- 3 files changed, 5 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/expression.h b/include/expression.h index 13ca315c..eda3d98f 100644 --- a/include/expression.h +++ b/include/expression.h @@ -291,6 +291,7 @@ struct expr { /* EXPR_NUMGEN */ enum nft_ng_types type; uint32_t mod; + uint32_t offset; } numgen; struct { /* EXPR_HASH */ diff --git a/include/linux/netfilter/nf_tables.h b/include/linux/netfilter/nf_tables.h index b21a844c..e84a9f5b 100644 --- a/include/linux/netfilter/nf_tables.h +++ b/include/linux/netfilter/nf_tables.h @@ -1157,12 +1157,14 @@ enum nft_trace_types { * @NFTA_NG_DREG: destination register (NLA_U32) * @NFTA_NG_MODULUS: maximum counter value (NLA_U32) * @NFTA_NG_TYPE: operation type (NLA_U32) + * @NFTA_NG_OFFSET: offset value (NLA_U32) */ enum nft_ng_attributes { NFTA_NG_UNSPEC, NFTA_NG_DREG, NFTA_NG_MODULUS, NFTA_NG_TYPE, + NFTA_NG_OFFSET, __NFTA_NG_MAX }; #define NFTA_NG_MAX (__NFTA_NG_MAX - 1) diff --git a/include/numgen.h b/include/numgen.h index bec18e5a..b2306200 100644 --- a/include/numgen.h +++ b/include/numgen.h @@ -2,6 +2,7 @@ #define NFTABLES_NUMGEN_H extern struct expr *numgen_expr_alloc(const struct location *loc, - enum nft_ng_types type, uint32_t until); + enum nft_ng_types type, uint32_t until, + uint32_t offset); #endif /* NFTABLES_NUMGEN_H */ -- cgit v1.2.3