expr: numgen: Rename until attribute by modulus
PATCH v2 1/1 expr: numgen: Rename until attribute by modulus
The _modulus_ attribute will be reused as _until_, as it's similar to other expressions with value limits (ex. hash).
Renaming is possible according to the kernel module ntf_numgen that has not been released yet.
Signed-off-by Laura Garcia Liebana <[email protected]>
---
Changes in V2:
- Separate changes with incremental counter offset value.
include/buffer.h | 1 - include/libnftnl/expr.h | 2 +- include/linux/netfilter/nf_tables.h | 4 +-- src/expr/numgen.c | 54 ++++++++++++++++++------------------- tests/nft-expr_numgen-test.c | 8 +++--- 5 files changed, 34 insertions(+), 35 deletions(-)
include/buffer.h +0 -1
@@ -82,7 +82,6 @@ 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"
include/libnftnl/expr.h +1 -1
@@ -52,7 +52,7 @@ enum {enum {NFTNL_EXPR_NG_DREG =NFTNL_EXPR_BASE , -NFTNL_EXPR_NG_UNTIL , +NFTNL_EXPR_NG_MODULUS ,NFTNL_EXPR_NG_TYPE , };
include/linux/netfilter/nf_tables.h +2 -2
@@ -670,13 +670,13 @@ enum nft_exthdr_attributes {* 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_MODULUS: maximum value to be returned (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_MODULUS ,NFTA_NG_TYPE , __NFTA_NG_MAX };
src/expr/numgen.c +27 -27
134 lines not on this page · raw message
tests/nft-expr_numgen-test.c +4 -4
@@ -33,9 +33,9 @@ static void cmp_nftnl_expr(struct nftnl_expr *rule_a,if (nftnl_expr_get_u32 (rule_a,NFTNL_EXPR_NG_DREG ) !=nftnl_expr_get_u32 (rule_b,NFTNL_EXPR_NG_DREG ))print_err ("Expr NFTNL_EXPR_NG_DREG mismatches" ); -if (nftnl_expr_get_u32 (rule_a,NFTNL_EXPR_NG_UNTIL ) != -nftnl_expr_get_u32 (rule_b,NFTNL_EXPR_NG_UNTIL )) -print_err ("Expr NFTNL_EXPR_NG_UNTIL mismatches" ); +if (nftnl_expr_get_u32 (rule_a,NFTNL_EXPR_NG_MODULUS ) != +nftnl_expr_get_u32 (rule_b,NFTNL_EXPR_NG_MODULUS )) +print_err ("Expr NFTNL_EXPR_NG_MODULUS mismatches" );if (nftnl_expr_get_u32 (rule_a,NFTNL_EXPR_NG_TYPE ) !=nftnl_expr_get_u32 (rule_b,NFTNL_EXPR_NG_TYPE ))print_err ("Expr NFTNL_EXPR_NG_TYPE mismatches" );
@@ -59,7 +59,7 @@ int main(int argc, char *argv[])print_err ("OOM" );nftnl_expr_set_u32 (ex,NFTNL_EXPR_NG_DREG ,0x1234568 ); -nftnl_expr_set_u32 (ex,NFTNL_EXPR_NG_UNTIL ,0x78123456 ); +nftnl_expr_set_u32 (ex,NFTNL_EXPR_NG_MODULUS ,0x78123456 );nftnl_expr_set_u32 (ex,NFTNL_EXPR_NG_TYPE ,NFT_NG_INCREMENTAL );nftnl_rule_add_expr (a, ex);
Signature · 1 line
2.8.1
Pablo Neira Ayuso
maintainerQuoted 5 lines · Laura Garcia Liebana
The _modulus_ attribute will be reused as _until_, as it's similar to other expressions with value limits (ex. hash).
Renaming is possible according to the kernel module
ntf_numgenthat has not been released yet.
This doesn't apply cleanly to libnftnl.
Please, git pull --rebase there, resolve conflicts and resubmit. Thanks.