summaryrefslogtreecommitdiffstats
path: root/src/expr/hash.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/expr/hash.c')
-rw-r--r--src/expr/hash.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/expr/hash.c b/src/expr/hash.c
index 08f09f5..c235502 100644
--- a/src/expr/hash.c
+++ b/src/expr/hash.c
@@ -214,12 +214,16 @@ nftnl_expr_hash_snprintf_default(char *buf, size_t size,
struct nftnl_expr_hash *hash = nftnl_expr_data(e);
int len = size, offset = 0, ret;
- ret = snprintf(buf, len,
- "reg %u = %u + jhash(reg %u, %u, 0x%x) %% mod %u ",
- hash->offset, hash->dreg, hash->sreg, hash->len,
- hash->seed, hash->modulus);
+ ret = snprintf(buf, len, "reg %u = jhash(reg %u, %u, 0x%x) %% mod %u ",
+ hash->dreg, hash->sreg, hash->len, hash->seed,
+ hash->modulus);
SNPRINTF_BUFFER_SIZE(ret, size, len, offset);
+ if (hash->offset) {
+ ret = snprintf(buf, len, "offset %u ", hash->offset);
+ SNPRINTF_BUFFER_SIZE(ret, size, len, offset);
+ }
+
return offset;
}