netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: "Slagter, EM" <eslagter@wlz.nl>
Cc: netfilter-devel@vger.kernel.org, netfilter@vger.kernel.org
Subject: Re: Possible bug ipsec and SNAT?
Date: Sat, 22 Dec 2007 08:37:54 +0100	[thread overview]
Message-ID: <476CBED2.8050808@trash.net> (raw)
In-Reply-To: <476A494C.1050606@wlz.nl>

Slagter, EM wrote:
> Patrick McHardy wrote:
> 
>> This is expected behaviour. Before NAT takes place, the packet
>> doesn't match a policy, it only does after getting mangled by
>> NAT, but at that point it already passed through your policy
>> matches.
> 
> I think we're not talking about the same thing :-/
> 
> I have a rule in the filter table like this:
> 
> iptables -t filter -A FORWARD -i ... -o ... -s ... -d ... -m policy
> --mode tunnel --pol ipsec --dir out --tunnnel-src ... --tunnel-dst ...
> -j ACCEPT
> 
> This rule works as expected, it matches certain ipsec traffic as intended.
> 
> As soon as I add a rule like this to the nat table:
> 
> iptables -t nat -A POSTROUTING -s ... -d ... -j SNAT --to-source ...
> 
> then the OTHER rule (above, the one in the filter table) doesn't match
> anymore. This has nothing to do with the source address having changed
> because even in this "bare" form:
> 
> iptables -t filter -A FORWARD -i ... -o ... -m policy --pol ipsec --dir out
> 
> it doesn't match.
> 
> This one does match (changed --pol ipsec into --pol none):
> 
> iptables -t filter -A FORWARD -i ... -o ... -m policy --pol none --dir out
> 
> Yet the traffic IS being encapsulated like before I applied the SNAT rule.
> 
> That doesn't seem right to me.


Does this rule apply in the direction you do SNAT or to reply packets?
Please post the rules including IP addresses.

  reply	other threads:[~2007-12-22  7:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-19 11:42 Possible bug ipsec and SNAT? Slagter, EM
2007-12-19 14:44 ` Patrick McHardy
2007-12-20 10:51   ` Slagter, EM
2007-12-22  7:37     ` Patrick McHardy [this message]
2007-12-22 10:49       ` Slagter, EM

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=476CBED2.8050808@trash.net \
    --to=kaber@trash.net \
    --cc=eslagter@wlz.nl \
    --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).