path: root/include/hash.h
Commit message (Collapse)AuthorAgeFilesLines
* src: add offset attribute for hash expressionLaura Garcia Liebana2016-11-091-1/+2
| | | | | | | | | | | 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 <> Signed-off-by: Pablo Neira Ayuso <>
* src: add hash expressionPablo Neira Ayuso2016-08-291-0/+7
This is special expression that transforms an input expression into a 32-bit unsigned integer. This expression takes a modulus parameter to scale the result and the random seed so the hash result becomes harder to predict. You can use it to set the packet mark, eg. # nft add rule x y meta mark set jhash ip saddr . ip daddr mod 2 seed 0xdeadbeef You can combine this with maps too, eg. # nft add rule x y dnat to jhash ip saddr mod 2 seed 0xdeadbeef map { \ 0 :, \ 1 : \ } Currently, this expression implements the jenkins hash implementation available in the Linux kernel: But it should be possible to extend it to support any other hash function type. Signed-off-by: Pablo Neira Ayuso <>