netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mr Dash Four <mr.dash.four@googlemail.com>
To: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Cc: Dennis Jacobfeuerborn <dennisml@conversis.de>,
	netfilter-devel@vger.kernel.org, netfilter@vger.kernel.org
Subject: Re: [ANNOUNCE] ipset-5.0 released
Date: Wed, 22 Dec 2010 12:48:04 +0000	[thread overview]
Message-ID: <4D11F384.3070908@googlemail.com> (raw)
In-Reply-To: <alpine.DEB.2.00.1012221146060.3482@blackhole.kfki.hu>


> I could not come up with a good solution. It is not possible to avoid
> double lookup in the set if the elements may have (say hash:ip,port type 
> of set) the forms:
>
> ipaddr,tcp:port
> ipaddr,udp:port
> ipadd,tcpudp:port
>   
I was thinking that you may interpret either the absence of the protocol 
specification ('tcp', 'udp' and 'tcpudp' in your examples above) or the 
word 'all' (even '*' though I don't know if that's possible) to mean 
that no protocol match is necessary.

> But if the double-lookup is required, then better add all tcp and udp port 
> variants and go with a single-lookup.
>   
I am not sure I understand you.

> Or if you have uniform ports for all elements, you can use two set 
> matches:
>
> ipset create hash:ip ipaddrs
> ipset create bitmap:port ports
>
> ... -m set --match-set ipaddrs dst -m set --match-set ports dst ...
>   
There is a problem with this - the 'bond' which exists with (the 
imaginary and working) hash:ip,all,port (i.e. the implicit link between 
the element's ip address/subnet and the port or port range)  is not 
there if two separate sets are used!

In order to create this 'bond' I have to use not one, but two separate 
sets (i.e. vpn_hosts/vpn_ports) and even then I cannot control this fully.

One very simple example: if I have a vpn host group which is on the 
10.1.1.0/24 subnet and operates within the 1194 (tcp/udp) port range and 
then have another vpn host group 10.1.2.0/24 which operates on a 
different port range - 80,443 (tcp and udp).

If I follow your example above I have to define *four* sets to 
accommodate the double matches, because if I put all the vpn ports into 
one ipset group (say vpn-ports) which contains ports 1194,80 and 443 and 
then use a similar ipset for the vpn hosts (say vpn-hosts) containing 
10.1.1.0/24 and 10.1.2.0/24 as its members and then do a double match 
"-m set --match-set vpn-hosts dst -m set --match-set vpn-ports dst" that 
would mean packets destined to 10.1.1.0/24 on ports 80,443 (tcp/udp) and 
10.1.2.0/24:1194 (tcp,udp) will be allowed which is not what I want.

If I want to separate this fully and make it work as it should, I have 
to define *four* sets (vpn-hosts1->10.1.1.0/24, vpn-ports1->1194, then 
vpn-hosts2->10.1.2.0/24,vpn-ports2->80,443), which makes the whole job 
rather cumbersome. I currently have this problem when I employ a similar 
approach with the existing 4.x version of ipset.

If ipset 5.x can disregard the protocol match I will have to define a 
single set and place just 3 members in it: 10.1.1.0/24,all,1194; 
10.1.2.0/24,all,80 and 10.1.2.0/24,all,443


  reply	other threads:[~2010-12-22 12:48 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-17 22:26 [ANNOUNCE] ipset-5.0 released Jozsef Kadlecsik
2010-12-17 23:32 ` Jan Engelhardt
2010-12-18 10:40   ` Jozsef Kadlecsik
2010-12-18  7:29 ` Rob Sterenborg (lists)
2010-12-18 11:13   ` Jozsef Kadlecsik
2010-12-18 15:43     ` Jan Engelhardt
2010-12-18 19:50       ` Jozsef Kadlecsik
2010-12-18 21:49         ` Jan Engelhardt
2010-12-19  0:05           ` Jozsef Kadlecsik
2010-12-19  0:28             ` Jan Engelhardt
2010-12-19  5:56           ` Jan Engelhardt
2010-12-19 18:23     ` Rob Sterenborg (lists)
2010-12-21 11:14     ` Rob Sterenborg (lists)
2010-12-21 14:03       ` Jozsef Kadlecsik
2010-12-18 14:22 ` Mr Dash Four
2010-12-18 20:23   ` Jozsef Kadlecsik
2010-12-18 21:51     ` Mr Dash Four
2010-12-18 22:10       ` Jan Engelhardt
2010-12-18 22:23         ` Mr Dash Four
2010-12-19  0:34       ` Jozsef Kadlecsik
2010-12-19 13:52         ` Mr Dash Four
2010-12-19 15:20           ` Dennis Jacobfeuerborn
2010-12-19 17:04             ` Mr Dash Four
2010-12-22 10:59               ` Jozsef Kadlecsik
2010-12-22 12:48                 ` Mr Dash Four [this message]
2010-12-23 15:39                   ` Jozsef Kadlecsik
2010-12-23 17:50                     ` Mr Dash Four
2010-12-23 17:55                       ` David Miller
2010-12-23 18:00                         ` Mr Dash Four
2010-12-23 18:06                           ` David Miller
2010-12-23 18:10                             ` Mr Dash Four
2010-12-23 19:35                       ` Jozsef Kadlecsik
2010-12-23 22:23                         ` Mr Dash Four
2010-12-23 22:46                           ` Jozsef Kadlecsik
2010-12-23 22:56                             ` Jozsef Kadlecsik
2010-12-23 23:06                               ` Mr Dash Four
2010-12-26 10:30                                 ` Jozsef Kadlecsik
2010-12-26 13:47                                   ` Mr Dash Four
2010-12-26 20:09                                     ` Jozsef Kadlecsik
2010-12-26 21:44                                       ` Mr Dash Four
2010-12-27 14:49                                         ` Jozsef Kadlecsik
2010-12-27 16:23                                           ` Mr Dash Four
2010-12-27 18:20                                             ` Jozsef Kadlecsik
2010-12-27 18:52                                               ` Mr Dash Four
2010-12-28 19:26                                                 ` Jozsef Kadlecsik
2010-12-23 23:03                             ` Mr Dash Four
2010-12-26 10:32                               ` Jozsef Kadlecsik
2010-12-23 21:51                       ` Jan Engelhardt

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=4D11F384.3070908@googlemail.com \
    --to=mr.dash.four@googlemail.com \
    --cc=dennisml@conversis.de \
    --cc=kadlec@blackhole.kfki.hu \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=netfilter@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).