Skip to content
  • Pablo Neira Ayuso's avatar
    netfilter: nft_limit: fix packet ratelimiting · 3e0f64b7
    Pablo Neira Ayuso authored
    
    
    Credit calculations for the packet ratelimiting are not correct, as per
    the applied ratelimit of 25/second and burst 8, a total of 33 packets
    should have been accepted.  This is true in iptables(33) but not in
    nftables (~65). For packet ratelimiting, use:
    
    	div_u64(limit->nsecs, limit->rate) * limit->burst;
    
    to calculate credit, just like in iptables' xt_limit does.
    
    Moreover, use default burst in iptables, users are expecting similar
    behaviour.
    
    Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
    3e0f64b7