]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
xfrm: Fix bucket count reported to userspace
authorBenjamin Poirier <bpoirier@suse.com>
Mon, 5 Nov 2018 08:00:53 +0000 (17:00 +0900)
committerSteffen Klassert <steffen.klassert@secunet.com>
Tue, 6 Nov 2018 11:25:47 +0000 (12:25 +0100)
sadhcnt is reported by `ip -s xfrm state count` as "buckets count", not the
hash mask.

Fixes: 28d8909bc790 ("[XFRM]: Export SAD info.")
Signed-off-by: Benjamin Poirier <bpoirier@suse.com>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
net/xfrm/xfrm_state.c

index b669262682c9763e7c863d6bb77f44ed34402cce..12cdb350c4562a481c58b92a2294cdb0a8727536 100644 (file)
@@ -788,7 +788,7 @@ void xfrm_sad_getinfo(struct net *net, struct xfrmk_sadinfo *si)
 {
        spin_lock_bh(&net->xfrm.xfrm_state_lock);
        si->sadcnt = net->xfrm.state_num;
-       si->sadhcnt = net->xfrm.state_hmask;
+       si->sadhcnt = net->xfrm.state_hmask + 1;
        si->sadhmcnt = xfrm_state_hashmax;
        spin_unlock_bh(&net->xfrm.xfrm_state_lock);
 }