All of lore.kernel.org
 help / color / mirror / Atom feed
From: Menno Smits <menno@netboxblue.com>
To: Netfilter Mailing list <netfilter@lists.netfilter.org>
Subject: Re: Why is ipset nethash set type limited to /31?
Date: Mon, 13 Mar 2006 08:47:10 +1000	[thread overview]
Message-ID: <4414A4EE.8040207@netboxblue.com> (raw)
In-Reply-To: <Pine.LNX.4.58.0603100910240.6303@blackhole.kfki.hu>

Hi Jozsef,

Jozsef Kadlecsik wrote:
> Hi,
> 
> On Fri, 10 Mar 2006, Menno Smits wrote:
> 
>> Is there a reason why the ipset's nethash set type can't be used with
>> single IPs (/32) as well as larger networks? I'd really like to be able
>> to use networks and IPs in the same set.
> 
> An IP(v4) address is a 32bit number. A network address consists of an IP
> address and a mask value. In nethash the IP address *and* the mask
> together are stored on 32bits. Therefore it is not possible to store plain
> IP addresses in that type of sets.

Ok fair enough.

How would you feel about a "union" set type? Union sets would be
configured to refer to 1 or more other sets. If the IP is found in any
of the child sets it returns a match.

Example usage could be something like:

# ipset -N foo iphash
# ipset -A foo 192.168.0.1

# ipset -N bar nethash
# ipset -A bar 10.0.0.0/8

# ipset -N foobar union --set foo --set bar

# ipset -T foobar 192.168.0.1
192.168.0.1 is in set foobar.

# ipset -T foobar 10.1.2.3
10.1.2.3 is in set foobar.

# ipset -T foobar 192.168.0.2
192.168.0.2 is NOT in set foobar.

# ipset -T foobar 11.0.0.2
11.0.0.2 is NOT in set foobar.

Obviously the set types that could be used in the union would have to be 
compatible. Mixing an iphash and an ipportmap wouldn't make much sense.

Your thoughts?

Regards,
Menno



  reply	other threads:[~2006-03-12 22:47 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-10  3:36 Why is ipset nethash set type limited to /31? Menno Smits
2006-03-10  8:15 ` Jozsef Kadlecsik
2006-03-12 22:47   ` Menno Smits [this message]
2006-03-14  9:22     ` Jozsef Kadlecsik
  -- strict thread matches above, loose matches on Subject: below --
2006-03-10  4:24 Randy Grimshaw
     [not found] <s410b957.066@gwia201.syr.edu>
2006-03-10  7:13 ` Menno Smits
2006-03-10 13:33   ` Jozsef Kadlecsik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4414A4EE.8040207@netboxblue.com \
    --to=menno@netboxblue.com \
    --cc=netfilter@lists.netfilter.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.