• Christophe Gouault's avatar
    xfrm: add command for configuring SPD hash table · 025fa9dc
    Christophe Gouault authored
    add a new command to configure the SPD hash table:
       ip xfrm policy set [ hthresh4 LBITS RBITS ] [ hthresh6 LBITS RBITS ]
    
    and code to display the SPD hash configuration:
      ip -s -s xfrm policy count
    
    hthresh4: defines minimum local and remote IPv4 prefix lengths of
    selectors to hash a policy. If prefix lengths are greater or equal
    to the thresholds, then the policy is hashed, otherwise it falls back
    in the policy_inexact chained list.
    
    hthresh6: defines minimum local and remote IPv6 prefix lengths of
    selectors to hash a policy, otherwise it falls back
    in the policy_inexact chained list.
    
    Example:
    
    % ip -s -s xfrm policy count
             SPD IN  0 OUT 0 FWD 0 (Sock: IN 0 OUT 0 FWD 0)
             SPD buckets: count 7 Max 1048576
             SPD IPv4 thresholds: local 32 remote 32
             SPD IPv6 thresholds: local 128 remote 128
    
    % ip xfrm pol set hthresh4 24 16 hthresh6 64 56
    
    % ip -s -s xfrm policy count
             SPD IN  0 OUT 0 FWD 0 (Sock: IN 0 OUT 0 FWD 0)
             SPD buckets: count 7 Max 1048576
             SPD IPv4 thresholds: local 24 remote 16
             SPD IPv6 thresholds: local 64 remote 56
    Signed-off-by: default avatarChristophe Gouault <christophe.gouault@6wind.com>
    025fa9dc
xfrm_policy.c 28.7 KB