diff options
author | Laura Garcia Liebana <nevola@gmail.com> | 2016-11-04 14:01:12 +0100 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2016-11-09 00:21:39 +0100 |
commit | 9bee0c86f1794c6c5418f256420758dc15d91f77 (patch) | |
tree | df1290b54bff6323a62dcc14e3bd83422e1cd123 /src/netlink_delinearize.c | |
parent | 7f027e82d7a21f8b088bcc7c838774071e79b89b (diff) |
src: add offset attribute for hash expression
Add support to add an offset to the hash generator, eg.
ct mark set hash ip saddr mod 10 offset 100
This will generate marks with series between 100-109.
Signed-off-by: Laura Garcia Liebana <nevola@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/netlink_delinearize.c')
-rw-r--r-- | src/netlink_delinearize.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/netlink_delinearize.c b/src/netlink_delinearize.c index f0df8848..434089b7 100644 --- a/src/netlink_delinearize.c +++ b/src/netlink_delinearize.c @@ -513,7 +513,7 @@ static void netlink_parse_hash(struct netlink_parse_ctx *ctx, { enum nft_registers sreg, dreg; struct expr *expr, *hexpr; - uint32_t mod, seed, len; + uint32_t mod, seed, len, offset; sreg = netlink_parse_register(nle, NFTNL_EXPR_HASH_SREG); hexpr = netlink_get_register(ctx, loc, sreg); @@ -521,6 +521,7 @@ static void netlink_parse_hash(struct netlink_parse_ctx *ctx, return netlink_error(ctx, loc, "hash statement has no expression"); + offset = nftnl_expr_get_u32(nle, NFTNL_EXPR_HASH_OFFSET); seed = nftnl_expr_get_u32(nle, NFTNL_EXPR_HASH_SEED); mod = nftnl_expr_get_u32(nle, NFTNL_EXPR_HASH_MODULUS); len = nftnl_expr_get_u32(nle, NFTNL_EXPR_HASH_LEN) * BITS_PER_BYTE; @@ -531,7 +532,7 @@ static void netlink_parse_hash(struct netlink_parse_ctx *ctx, return; } - expr = hash_expr_alloc(loc, mod, seed); + expr = hash_expr_alloc(loc, mod, seed, offset); expr->hash.expr = hexpr; dreg = netlink_parse_register(nle, NFTNL_EXPR_HASH_DREG); |