All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH RESEND] Add element count to bitmap and hash headers
@ 2015-02-17 15:35 Eric B Munson
  2015-02-17 15:53 ` Pablo Neira Ayuso
  0 siblings, 1 reply; 6+ messages in thread
From: Eric B Munson @ 2015-02-17 15:35 UTC (permalink / raw)
  To: netfilter-devel; +Cc: kadlec, johunt, Eric B Munson

It would be useful for userspace to query the size of an ipset.  This
data is held for both the bitmask and hash types, however, it is not
exposed to userspace.  This patch uses the otherwise unused attribute
IPSET_ATTR_ELEMENTS to indicate the size in the the header that is
exported to userspace.

Signed-off-by: Eric B Munson <emunson@akamai.com>
---
 net/netfilter/ipset/ip_set_bitmap_gen.h |    3 ++-
 net/netfilter/ipset/ip_set_hash_gen.h   |    3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/net/netfilter/ipset/ip_set_bitmap_gen.h b/net/netfilter/ipset/ip_set_bitmap_gen.h
index 6f024a8..faa9f3e 100644
--- a/net/netfilter/ipset/ip_set_bitmap_gen.h
+++ b/net/netfilter/ipset/ip_set_bitmap_gen.h
@@ -101,7 +101,8 @@ mtype_head(struct ip_set *set, struct sk_buff *skb)
 	    nla_put_net32(skb, IPSET_ATTR_MEMSIZE,
 			  htonl(sizeof(*map) +
 				map->memsize +
-				set->dsize * map->elements)))
+				set->dsize * map->elements)) ||
+	    nla_put_net32(skb, IPSET_ATTR_ELEMENTS, htonl(map->elements)))
 		goto nla_put_failure;
 	if (unlikely(ip_set_put_flags(skb, set)))
 		goto nla_put_failure;
diff --git a/net/netfilter/ipset/ip_set_hash_gen.h b/net/netfilter/ipset/ip_set_hash_gen.h
index 974ff38..3734b2f 100644
--- a/net/netfilter/ipset/ip_set_hash_gen.h
+++ b/net/netfilter/ipset/ip_set_hash_gen.h
@@ -930,7 +930,8 @@ mtype_head(struct ip_set *set, struct sk_buff *skb)
 		goto nla_put_failure;
 #endif
 	if (nla_put_net32(skb, IPSET_ATTR_REFERENCES, htonl(set->ref - 1)) ||
-	    nla_put_net32(skb, IPSET_ATTR_MEMSIZE, htonl(memsize)))
+	    nla_put_net32(skb, IPSET_ATTR_MEMSIZE, htonl(memsize)) ||
+	    nla_put_net32(skb, IPSET_ATTR_ELEMENTS, htonl(h->elements)))
 		goto nla_put_failure;
 	if (unlikely(ip_set_put_flags(skb, set)))
 		goto nla_put_failure;
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH RESEND] Add element count to bitmap and hash headers
  2015-02-17 15:35 [PATCH RESEND] Add element count to bitmap and hash headers Eric B Munson
@ 2015-02-17 15:53 ` Pablo Neira Ayuso
  2015-02-17 21:35   ` Jozsef Kadlecsik
  0 siblings, 1 reply; 6+ messages in thread
From: Pablo Neira Ayuso @ 2015-02-17 15:53 UTC (permalink / raw)
  To: Eric B Munson; +Cc: netfilter-devel, kadlec, johunt

On Tue, Feb 17, 2015 at 10:35:35AM -0500, Eric B Munson wrote:
> It would be useful for userspace to query the size of an ipset.  This
> data is held for both the bitmask and hash types, however, it is not
> exposed to userspace.  This patch uses the otherwise unused attribute
> IPSET_ATTR_ELEMENTS to indicate the size in the the header that is
> exported to userspace.

Thanks for your patch.

I think Jozsef will need the userspace bits for his library and
utility.

Jozsef?

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH RESEND] Add element count to bitmap and hash headers
  2015-02-17 15:53 ` Pablo Neira Ayuso
@ 2015-02-17 21:35   ` Jozsef Kadlecsik
  2015-02-18  3:54     ` Pablo Neira Ayuso
  0 siblings, 1 reply; 6+ messages in thread
From: Jozsef Kadlecsik @ 2015-02-17 21:35 UTC (permalink / raw)
  To: Pablo Neira Ayuso; +Cc: Eric B Munson, netfilter-devel, johunt

On Tue, 17 Feb 2015, Pablo Neira Ayuso wrote:

> On Tue, Feb 17, 2015 at 10:35:35AM -0500, Eric B Munson wrote:
> > It would be useful for userspace to query the size of an ipset.  This
> > data is held for both the bitmask and hash types, however, it is not
> > exposed to userspace.  This patch uses the otherwise unused attribute
> > IPSET_ATTR_ELEMENTS to indicate the size in the the header that is
> > exported to userspace.
> 
> Thanks for your patch.
> 
> I think Jozsef will need the userspace bits for his library and
> utility.

Yes, that's missing from the patch. Also, I don't like any change which 
affects the userspace but not expressed in new set type revision. Later on 
the new revision makes much simpler to identify why the "Elements: is 
missing from the listing of a set.

Best regards,
Jozsef
-
E-mail  : kadlec@blackhole.kfki.hu, kadlecsik.jozsef@wigner.mta.hu
PGP key : http://www.kfki.hu/~kadlec/pgp_public_key.txt
Address : Wigner Research Centre for Physics, Hungarian Academy of Sciences
          H-1525 Budapest 114, POB. 49, Hungary

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH RESEND] Add element count to bitmap and hash headers
  2015-02-17 21:35   ` Jozsef Kadlecsik
@ 2015-02-18  3:54     ` Pablo Neira Ayuso
  2015-02-18 14:59       ` Eric B Munson
  2015-02-18 19:53       ` Eric B Munson
  0 siblings, 2 replies; 6+ messages in thread
From: Pablo Neira Ayuso @ 2015-02-18  3:54 UTC (permalink / raw)
  To: Eric B Munson; +Cc: netfilter-devel, johunt, Jozsef Kadlecsik

On Tue, Feb 17, 2015 at 10:35:40PM +0100, Jozsef Kadlecsik wrote:
> On Tue, 17 Feb 2015, Pablo Neira Ayuso wrote:
> 
> > On Tue, Feb 17, 2015 at 10:35:35AM -0500, Eric B Munson wrote:
> > > It would be useful for userspace to query the size of an ipset.  This
> > > data is held for both the bitmask and hash types, however, it is not
> > > exposed to userspace.  This patch uses the otherwise unused attribute
> > > IPSET_ATTR_ELEMENTS to indicate the size in the the header that is
> > > exported to userspace.
> > 
> > Thanks for your patch.
> > 
> > I think Jozsef will need the userspace bits for his library and
> > utility.
> 
> Yes, that's missing from the patch. Also, I don't like any change which 
> affects the userspace but not expressed in new set type revision. Later on 
> the new revision makes much simpler to identify why the "Elements: is 
> missing from the listing of a set.

Please address Jozsef's feedback and resubmit. Thanks.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH RESEND] Add element count to bitmap and hash headers
  2015-02-18  3:54     ` Pablo Neira Ayuso
@ 2015-02-18 14:59       ` Eric B Munson
  2015-02-18 19:53       ` Eric B Munson
  1 sibling, 0 replies; 6+ messages in thread
From: Eric B Munson @ 2015-02-18 14:59 UTC (permalink / raw)
  To: Pablo Neira Ayuso
  Cc: netfilter-devel@vger.kernel.org, Hunt, Joshua, Jozsef Kadlecsik

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 02/17/2015 10:54 PM, Pablo Neira Ayuso wrote:
> On Tue, Feb 17, 2015 at 10:35:40PM +0100, Jozsef Kadlecsik wrote:
>> On Tue, 17 Feb 2015, Pablo Neira Ayuso wrote:
>> 
>>> On Tue, Feb 17, 2015 at 10:35:35AM -0500, Eric B Munson wrote:
>>>> It would be useful for userspace to query the size of an
>>>> ipset.  This data is held for both the bitmask and hash
>>>> types, however, it is not exposed to userspace.  This patch
>>>> uses the otherwise unused attribute IPSET_ATTR_ELEMENTS to
>>>> indicate the size in the the header that is exported to
>>>> userspace.
>>> 
>>> Thanks for your patch.
>>> 
>>> I think Jozsef will need the userspace bits for his library
>>> and utility.
>> 
>> Yes, that's missing from the patch. Also, I don't like any change
>> which affects the userspace but not expressed in new set type
>> revision. Later on the new revision makes much simpler to
>> identify why the "Elements: is missing from the listing of a
>> set.
> 
> Please address Jozsef's feedback and resubmit. Thanks.
> 

Let me look into it.  It has been a while but I am pretty sure no user
space changes were required.  This field exists in the base structure
returned to user space, it is just not used prior to this patch in the
hash sets.  If that is the case (and I don't remember off the top of
my head as it has been >2 months since I looked) that is the reason I
did not create a new set type revision.

Eric
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iQIcBAEBAgAGBQJU5KjcAAoJELbVsDOpoOa95ggP+QGnlc4yW3Jz45NuwgZGgHpo
rVognvjAG9Xs8WwANKnr1gi1LYfuAQJC2APu6IeYA3Fh7zKqKHgSG4o1LNghtcDv
pCwRiOnqqAJZoYD9JBDoUNx/0Cnc3F7hJnag4G9LXXe5zUcuVaUzUYw49Fk7V6sI
4kNMiPcsXnd21+SQEJqFJXj60NRSgEke5e2sXSxfwqhq+lzTdJiL7sNV8aR8R9DH
Ak10hbIv3iAmWtANvNuD9T+T1YSIlh2Y/PrWnDGUk/b4mohj8ZVELnESO6aiUjZK
OT0Gy3LrI7VxIGdzxkA42WZhFNIhbpyDCNnVTiNsxXl8y6djbYieZv/ecM/d9GR0
FcrZtx3iGSLn5B6LHHzWufd0+KBaCgL8HupNWYrX/JOyohipEL7YKQzqj3jXn44g
0yyHRZA3Cys8fZHvXMI2LqB1iSsjwqxTSyS60C2mNuAGuVm0zIQOWHRhsfsLVsMq
n7yNa1hhGMlj0CdaZXRoqU7+/JwbXWap1eMT+Hb2wu8i482xZwgmV9SiCpTP+hrZ
8s2YavuV7Tl2zqMp+mui9PGOdtMwiWdB8Ccn9/x0GzRY2fV3PXcmmOFqfo/9nlhy
2tvDpja7bpWGS9WPECY6zElTkCOUtO7JZspHuWMhCcIvzYTD82HFjjkCL/0j06BA
rPzd7QIx4wzeuqAvT+Sa
=Z+5d
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH RESEND] Add element count to bitmap and hash headers
  2015-02-18  3:54     ` Pablo Neira Ayuso
  2015-02-18 14:59       ` Eric B Munson
@ 2015-02-18 19:53       ` Eric B Munson
  1 sibling, 0 replies; 6+ messages in thread
From: Eric B Munson @ 2015-02-18 19:53 UTC (permalink / raw)
  To: Pablo Neira Ayuso
  Cc: netfilter-devel@vger.kernel.org, Hunt, Joshua, Jozsef Kadlecsik

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 02/17/2015 10:54 PM, Pablo Neira Ayuso wrote:
> On Tue, Feb 17, 2015 at 10:35:40PM +0100, Jozsef Kadlecsik wrote:
>> On Tue, 17 Feb 2015, Pablo Neira Ayuso wrote:
>> 
>>> On Tue, Feb 17, 2015 at 10:35:35AM -0500, Eric B Munson wrote:
>>>> It would be useful for userspace to query the size of an
>>>> ipset.  This data is held for both the bitmask and hash
>>>> types, however, it is not exposed to userspace.  This patch
>>>> uses the otherwise unused attribute IPSET_ATTR_ELEMENTS to
>>>> indicate the size in the the header that is exported to
>>>> userspace.
>>> 
>>> Thanks for your patch.
>>> 
>>> I think Jozsef will need the userspace bits for his library
>>> and utility.
>> 
>> Yes, that's missing from the patch. Also, I don't like any change
>> which affects the userspace but not expressed in new set type
>> revision. Later on the new revision makes much simpler to
>> identify why the "Elements: is missing from the listing of a
>> set.
> 
> Please address Jozsef's feedback and resubmit. Thanks.
> 

The missing user space was my mistake, I sent an early version of the
patch.  The correct version is in flight.

Eric
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iQIcBAEBAgAGBQJU5O3DAAoJELbVsDOpoOa9hF4QALAGxVYC6Tvt3TNH8TQZk9aK
dS9rwP/6GL+pj5eUzpDlPRzvfuTqWcg2OVOGsOSYsrlzVfBwveSg++EsXq6fm5CU
RmtgnbrBRK9exIDmpD89loDBgWANvMajGfIGVdWlC7gblOoPzZrMJByeUfOrw1WB
sJm6lodWnqfQJFGDdXGl0ZFX0C71Hvt5y7NF9vBQhXF0U9smooyvNT+tng1Y8faU
9jLbscOxwKtlLRYtpRMpQ+kg4YmWbu3mdR3UqGvlCb3KYK3C79XfJPTdYur9zc5s
RNyrIXkXye31LCOgmZ7YYxcALUb2MRdsHU05dbPuq1/0RRFGaSjNNKJkBX798aTk
snzHYmqo7ldySB5uvLqdcr6MtQi0KkTGmdhPZAbWFm26SFx3e3tywdDzFUweT95R
/39t9uee++vAfB8wa9W+tGZ2zddkK90GYTKFb4flF0bTS7Bv4POVYKW2c9siX4eG
HKQuWx66L1SSRfih1u3MMle5yv+C/2uud255rz5PcqbqXbZ3d71o2+tRmf9TqZW1
yHu6rbJbIHu/e+bLSM6yjVdiRAC4zjokT2LzvCsWRasdIb2Rw3raND/2M6L81ZpH
u+Iz5hLXKZJ7nC0M8iTqIWAOpas+9IDjV/AwM4LW1erNgJ5qXX35bwWHIhMdViDt
ModRCpWkBlLTq+stLZpQ
=6nGr
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-02-18 19:53 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-17 15:35 [PATCH RESEND] Add element count to bitmap and hash headers Eric B Munson
2015-02-17 15:53 ` Pablo Neira Ayuso
2015-02-17 21:35   ` Jozsef Kadlecsik
2015-02-18  3:54     ` Pablo Neira Ayuso
2015-02-18 14:59       ` Eric B Munson
2015-02-18 19:53       ` Eric B Munson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.