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 /tests/py/ip/hash.t.payload | |
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 'tests/py/ip/hash.t.payload')
-rw-r--r-- | tests/py/ip/hash.t.payload | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/py/ip/hash.t.payload b/tests/py/ip/hash.t.payload index 1188a1b1..c410a8c6 100644 --- a/tests/py/ip/hash.t.payload +++ b/tests/py/ip/hash.t.payload @@ -12,6 +12,20 @@ ip test-ip4 pre [ hash reg 1 = jhash(reg 2, 8, 0x0) % mod 2 ] [ ct set mark with reg 1 ] +# ct mark set jhash ip saddr . ip daddr mod 2 seed 0xdeadbeef offset 100 +ip test-ip4 pre + [ payload load 4b @ network header + 12 => reg 2 ] + [ payload load 4b @ network header + 16 => reg 13 ] + [ hash reg 1 = jhash(reg 2, 8, 0xdeadbeef) % mod 2 offset 100 ] + [ ct set mark with reg 1 ] + +# ct mark set jhash ip saddr . ip daddr mod 2 offset 100 +ip test-ip4 pre + [ payload load 4b @ network header + 12 => reg 2 ] + [ payload load 4b @ network header + 16 => reg 13 ] + [ hash reg 1 = jhash(reg 2, 8, 0x0) % mod 2 offset 100 ] + [ ct set mark with reg 1 ] + # dnat to jhash ip saddr mod 2 seed 0xdeadbeef map { 0 : 192.168.20.100, 1 : 192.168.30.100 } __map%d test-ip4 b __map%d test-ip4 0 |