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: Netfilter Core Team <netfilter-devel@vger.kernel.org>,
	Pablo Neira Ayuso <pablo@netfilter.org>,
	Patrick McHardy <kaber@trash.net>
Subject: Re: [PATCH 0/3] ipset: change 'iface' part in hash:net,iface set
Date: Sun, 08 Jul 2012 14:03:22 +0100	[thread overview]
Message-ID: <4FF9851A.8080400@googlemail.com> (raw)
In-Reply-To: <alpine.DEB.2.00.1207071646130.17386@blackhole.kfki.hu>


> So I have to repeat again: your patches do not address the example of the 
> two rules with list:set type of sets, which give different results 
> depending on "in/out" or "src/dst" in the second direction position. 
>   
How many times would you like me to repeat this: they give "different 
results" because you are applying direction parameters which have 
different meanings by definition: "in" means "match on incoming 
interfaces *only*", "out" means "match on outgoing interface *only*", 
while "src" and "dst" do not have that restriction. This is how it 
works, by definition (if you know any different, please let me know).

This was stated from the outset in my patches and in the various man 
pages. So, given that in != src and out != dst (the same way as src != 
dst for example), one should not be surprised to get "different results" 
when different direction parameters are used (or direction parameters, 
which have different meaning). Simple logic and common sense will tell 
you all that.

>  
>   
>> To reiterate once again - 'in' is for matches of incoming interfaces 
>> only and should only be used for that particular purpose (it is one 
>> reason why I am dead against your idea for this to be used "everywhere" 
>> - to answer your other query below). Similar with 'out', but for 
>> outgoing interfaces.
>>     
>
> In the given example, in rule level, there is no hash:net,iface type of 
> set. Still, the result depends on the syntax.
>   
Please clarify, what "given example"?

> I wait for a better solution, which does not produce different results 
> depending on the "in/out" or "src/dst" syntax, for all set types, 
> including the list of sets.
>   
Again, you get "different results" because you apply direction 
parameters which have different meaning - by definition (see above if 
you are still "confused" what the definition of 'in' and 'out' is). So, 
to summarise, again, for your own benefit:

- "in" means match on incoming interface only;
- "out" means match on outgoing interface only;

Example: If list1 - list:set type of set has, say, 5 members: iface1 and 
iface2 - type hash:net,iface, and ipp1, ipp2 and ipp3 - type 
hash:ip,port, then the following iptables statement:

iptables -A INPUT -m set --match-set list1 src,in -j ACCEPT

will only match packets on src IP address/subnet (the 1st direction 
parameter) and the incoming interface (the 2nd direction parameter) - 
nothing else, simply because of the definition of the second parameter - 
"in" above, means "match on incoming interfaces only". In other words, 
the above statement will produce matching members of iface1 and iface2, 
while members of ipp1, ipp2 and ipp3 will be excluded from the match, 
quite naturally. However,

iptables -A INPUT -m set --match-set list1 src,src -j ACCEPT

will match packets on source IP address/subnet (1st direction 
parameter), 'src' interface (which you defined to mean incoming 
interface) as well as source ports (2nd direction parameter), simply 
because 'src' has a different definition from that of 'in' - it is more 
broad and does not have the restriction 'in' has.

So, given the above, I fail to see how by applying direction parameters 
with different meanings (by definition) surprises you, "confuses" you or 
is in any way inconsistent when it produces different results for 
different set members, but if you know any different I am all eyes/ears!


  parent reply	other threads:[~2012-07-08 13:03 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-05 22:34 [PATCH 0/3] ipset: change 'iface' part in hash:net,iface set Mr Dash Four
2012-07-05 22:34 ` [PATCH 1/3] iptables: " Mr Dash Four
2012-07-05 22:34 ` [PATCH 2/3] ipset: " Mr Dash Four
2012-07-05 22:34 ` [PATCH 3/3] " Mr Dash Four
2012-07-06  8:35 ` [PATCH 0/3] " Jozsef Kadlecsik
2012-07-06 19:05   ` Mr Dash Four
2012-07-06 19:11     ` Jan Engelhardt
2012-07-06 19:21       ` Mr Dash Four
2012-07-06 19:44       ` Mr Dash Four
2012-07-06 19:47     ` Jozsef Kadlecsik
2012-07-06 20:19       ` Mr Dash Four
2012-07-06 20:39         ` Jozsef Kadlecsik
2012-07-06 21:04           ` Mr Dash Four
     [not found]         ` <CAHo-OowHXH9f526QQc4Ln5_P_Osdm1Q_RrBkw83hSGj=oES5ww@mail.gmail.com>
2012-07-06 20:41           ` Mr Dash Four
2012-07-06 20:49             ` Jozsef Kadlecsik
2012-07-06 21:04               ` Mr Dash Four
2012-07-06 21:39                 ` Jozsef Kadlecsik
2012-07-06 22:25                   ` Mr Dash Four
2012-07-07 14:53                     ` Jozsef Kadlecsik
2012-07-07 16:23                       ` Jozsef Kadlecsik
2012-07-08 13:03                         ` Mr Dash Four
2012-07-08 18:55                           ` Jozsef Kadlecsik
2012-07-08 19:03                             ` Mr Dash Four
2012-07-08 19:07                               ` Jozsef Kadlecsik
2012-07-08 19:11                                 ` Mr Dash Four
2012-07-08 20:30                                   ` Jozsef Kadlecsik
2012-07-08 22:10                                     ` Mr Dash Four
2012-07-08 22:20                                       ` Jozsef Kadlecsik
2012-07-08 22:25                                         ` Mr Dash Four
2012-07-08 22:55                                           ` Jozsef Kadlecsik
2012-07-09 20:19                                             ` Mr Dash Four
2012-07-09 22:05                                             ` Mr Dash Four
2012-07-08 13:03                       ` Mr Dash Four [this message]
     [not found]                         ` <CAHo-Ooya+1H939TqppUcY+pwprOH34zi-jHtnsN+g522aJ3ctw@mail.gmail.com>
2012-07-08 19:43                           ` Mr Dash Four

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=4FF9851A.8080400@googlemail.com \
    --to=mr.dash.four@googlemail.com \
    --cc=kaber@trash.net \
    --cc=kadlec@blackhole.kfki.hu \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@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 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).