Skip to content

Commit a54dad5

Browse files
Eric B MunsonJozsef Kadlecsik
authored andcommitted
netfilter: ipset: Add element count to hash headers
It would be useful for userspace to query the size of an ipset hash, however, this data is not exposed to userspace outside of counting the number of member entries. This patch uses the attribute IPSET_ATTR_ELEMENTS to indicate the size in the the header that is exported to userspace. This field is then printed by the userspace tool for hashes. Signed-off-by: Eric B Munson <emunson@akamai.com> Cc: Pablo Neira Ayuso <pablo@netfilter.org> Cc: Josh Hunt <johunt@akamai.com> Cc: netfilter-devel@vger.kernel.org Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
1 parent 837a90e commit a54dad5

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

net/netfilter/ipset/ip_set_hash_gen.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1083,7 +1083,8 @@ mtype_head(struct ip_set *set, struct sk_buff *skb)
10831083
goto nla_put_failure;
10841084
#endif
10851085
if (nla_put_net32(skb, IPSET_ATTR_REFERENCES, htonl(set->ref)) ||
1086-
nla_put_net32(skb, IPSET_ATTR_MEMSIZE, htonl(memsize)))
1086+
nla_put_net32(skb, IPSET_ATTR_MEMSIZE, htonl(memsize)) ||
1087+
nla_put_net32(skb, IPSET_ATTR_ELEMENTS, htonl(h->elements)))
10871088
goto nla_put_failure;
10881089
if (unlikely(ip_set_put_flags(skb, set)))
10891090
goto nla_put_failure;

0 commit comments

Comments
 (0)