diff options
author | Liping Zhang <zlpnobody@gmail.com> | 2017-04-15 17:22:17 +0800 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2017-04-15 11:30:08 +0200 |
commit | e2b25ccc31b8262a0739b46337fbb354e00aa1d6 (patch) | |
tree | 05db8f700716c22ef19ff6153807a173d17a8821 /tests | |
parent | cd3877cd4a7c4943dc29c274366795f02c42feb0 (diff) |
hash: generate a random seed if seed option is empty
Typing the "nft add rule x y ct mark set jhash ip saddr mod 2" will
not generate a random seed, instead, the seed will always be zero.
So if seed option is empty, we shoulde not set the NFTA_HASH_SEED
attribute, then a random seed will be generated in the kernel.
Signed-off-by: Liping Zhang <zlpnobody@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/py/ip/hash.t | 1 | ||||
-rw-r--r-- | tests/py/ip/hash.t.payload | 7 |
2 files changed, 8 insertions, 0 deletions
diff --git a/tests/py/ip/hash.t b/tests/py/ip/hash.t index 2becef62..cbfc7eef 100644 --- a/tests/py/ip/hash.t +++ b/tests/py/ip/hash.t @@ -3,6 +3,7 @@ ct mark set jhash ip saddr . ip daddr mod 2 seed 0xdeadbeef;ok ct mark set jhash ip saddr . ip daddr mod 2;ok +ct mark set jhash ip saddr . ip daddr mod 2 seed 0x0;ok ct mark set jhash ip saddr . ip daddr mod 2 seed 0xdeadbeef offset 100;ok ct mark set jhash ip saddr . ip daddr mod 2 offset 100;ok dnat to jhash ip saddr mod 2 seed 0xdeadbeef map { 0 : 192.168.20.100, 1 : 192.168.30.100 };ok diff --git a/tests/py/ip/hash.t.payload b/tests/py/ip/hash.t.payload index 21227e91..71ab0652 100644 --- a/tests/py/ip/hash.t.payload +++ b/tests/py/ip/hash.t.payload @@ -12,6 +12,13 @@ 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 0x0 +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 ] + [ 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 ] |