[PATCH 0/2 v2] cleanup and shrink ipset handling code.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Oliver Smith <oliver@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>

Following on from my previous patch, I noticed that the existing way
of managing the extensions could actually be trivially reworked by
simply checking each flag bit in series and setting up the size and
offsets incrementally. This makes adding new extensions as simple as
throwing a new case into the switch, no set file changes needed. It
also avoids having to do any unpleasant upheaveal of timeout.

This patch is intended to apply directly against the current HEAD of
master in the ipset repo.

One caveat to note is that since we now define each extension
independently, it is important to ensure a proper alignment value so
that each subsequent struct ends up on a "nice" boundary in memory.
Since both timeout and counter should align on their own nicely, I
didn't bother adding alignment statements to them. Anyone writing a
new extension should ensure they're a good codizen and align appropriately.

On that note, there is the option of simply aligning everything to the GCC
value __BIGGEST_ALIGNMENT__, on my 64-bit box that comes out at 16 bytes,
perhaps that's overkill - although there are instructions that can do a 16
byte load. Perhaps I'm just going overboard though... in6_addr doesn't even
align to 64 bits, so maybe nobody cares but me. <breaks out the violin>

Cheers!

Oliver Smith (2):
  netfilter: ipset: rework hash ext. handling to be more manageable.
  netfilter: ipset: rework bitmap ext. handling to be more manageable.

 kernel/include/linux/netfilter/ipset/ip_set.h      |   4 +
 kernel/include/uapi/linux/netfilter/ipset/ip_set.h |   8 +-
 kernel/net/netfilter/ipset/ip_set_bitmap_gen.h     |  34 +++++++
 kernel/net/netfilter/ipset/ip_set_bitmap_ip.c      |  87 ++----------------
 kernel/net/netfilter/ipset/ip_set_bitmap_ipmac.c   |  96 ++-----------------
 kernel/net/netfilter/ipset/ip_set_bitmap_port.c    |  76 +--------------
 kernel/net/netfilter/ipset/ip_set_hash_gen.h       | 102 ++++++---------------
 kernel/net/netfilter/ipset/ip_set_hash_ip.c        |  36 +-------
 kernel/net/netfilter/ipset/ip_set_hash_ipport.c    |  54 +----------
 kernel/net/netfilter/ipset/ip_set_hash_ipportip.c  |  58 +-----------
 kernel/net/netfilter/ipset/ip_set_hash_ipportnet.c |  66 +------------
 kernel/net/netfilter/ipset/ip_set_hash_net.c       |  54 +----------
 kernel/net/netfilter/ipset/ip_set_hash_netiface.c  |  67 +-------------
 kernel/net/netfilter/ipset/ip_set_hash_netport.c   |  60 +-----------
 14 files changed, 106 insertions(+), 696 deletions(-)

-- 
1.8.3.2

--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux