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: Wed, 19 Dec 2007 15:44:13 +0100	[thread overview]
Message-ID: <47692E3D.7090008@trash.net> (raw)
In-Reply-To: <476903B4.8060303@wlz.nl>

Slagter, EM wrote:
> Hi,
> 
> I don't know whether this netfilter behaviour is a bug or intentional,
> but at least for me it's not what I'd expect (nor want).
> 
> Our system (simplified to significant parts):
> - linux i386 kernel 2.6.21.2 vanilla, almost all netfilter and ipsec
> parts compiled in, no (relevant) modules
> - one vlan interface connected to public internet
> - one vlan interface connected to internal vlan, RFC addresses
> - pluto ("openswan") to manage ISAKMP, appropriate config file
> - some netfilter rules that include -m policy to separate the ipsec
> traffic before and after encapsulation (for instance to prevent traffic
> to be sent over internet without encryption)
> 
> Using this scenario, it works pretty much as documented.
> 
> As soon as I add SNAT to traffic originating from this vlan (as required
> by our supplier), the rules that (properly) used to match on "-m policy
> --pol ipsec --dir out --tunnel-src ... --tunnel-dst ..." no longer
> match. Even if I remove the tunnel-src and --tunnel-dst the rule no
> longer matches. If I change "the --pol ipsec" to "--pol none" the rule
> matches again. This is wrong IMHO as the traffic is still encapsulated
> (checked this with tshark) as expected.
> 
> I've checked the ChangeLogs of the kernel from 2.6.21.2 to current but
> there doesn't seem to have been a relevant patch on this matter.


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.

  reply	other threads:[~2007-12-19 14:44 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 [this message]
2007-12-20 10:51   ` Slagter, EM
2007-12-22  7:37     ` Patrick McHardy
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=47692E3D.7090008@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).