netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Cc: Jan Engelhardt <jengelh@inai.de>,
	Chris Wilson <chris@aptivate.org>,
	netfilter-devel@vger.kernel.org
Subject: Re: UDP packets sent with wrong source address after routing change [AV#3431]
Date: Sun, 11 Nov 2012 13:23:44 +0100	[thread overview]
Message-ID: <20121111122344.GA2212@1984> (raw)
In-Reply-To: <alpine.DEB.2.00.1211102216540.14307@blackhole.kfki.hu>

On Sat, Nov 10, 2012 at 10:47:55PM +0100, Jozsef Kadlecsik wrote:
> On Sat, 10 Nov 2012, Jan Engelhardt wrote:
> 
> > On Saturday 2012-11-10 15:07, Pablo Neira Ayuso wrote:
> > 
> > >On Thu, Nov 08, 2012 at 06:37:24PM +0000, Chris Wilson wrote:
> > >[...]
> > >> >>Another option which doesn't violate layering might be to update
> > >> >>the NAT rule when the outgoing address is known (after routing),
> > >> >
> > >> >That is what MASQUERADE is usually for.
> > >> 
> > >> Unfortunately I am using MASQUERADE and this still happens. If it
> > >> could just be fixed in the MASQUERADE target that would be a big
> > >> win.
> > >
> > >MASQUERADE already cleans up the entries in the conntrack table once
> > >you get your device down, that code is still there in 2.6.18:
> > >
> > >http://lxr.linux.no/#linux+v2.6.18/net/ipv4/netfilter/ipt_MASQUERADE.c#L111
> > 
> > It looks like it only catches the case of a changing ifindex.
> > 
> > That may work for PPP links, but if you access the 'net over an
> > Ethernet-looking link as is (thankfully) done by cable ISPs,
> > the interface will never go away.
> > 
> > The DHCP client will simply change one or more addresses on it -- and
> > at the same time I wonder if that makes it a "you should run
> > conntrack -F or something from your dhclient.script" case.
> 
> That's also handled by the MASQUERADE target: if the device was downed or 
> its address deleted, the corresponding conntrack entries are cleaned up.
> 
> But the thread is drifted from the original cases:
> 
> > This only seems to happen when you're using a UDP device behind a Linux
> > NAT router, and your routing to the destination host changes, because:
> >
> > * You bring up a VPN tunnel and the SIP destination is at the other end 
> > of that tunnel; or
> 
> This case is not handled by MASQUERADE.
> 
> > * Your default route changes because you failover to another provider.
> 
> And this case is also not handled if the original default route device is 
> still healthy, that is for example when you use some dynamic routing 
> protocol which detects failure in the routing path.
> 
> I do not see any simple solution except to delete any NATed entry 
> unconditionally when the routing changes. But that can easily be too much 
> and may kill valid entries.

I do not see it either and flushing the entire table seems to me like
way too much.

My suggestion is to use conntrack -D ... including the appropriate
selectors to delete only affected entries, and those selectors depend
on the setup.

  reply	other threads:[~2012-11-11 12:23 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-08 16:35 UDP packets sent with wrong source address after routing change [AV#3431] Chris Wilson
2012-11-08 17:55 ` Jan Engelhardt
2012-11-08 18:37   ` Chris Wilson
2012-11-08 20:40     ` Jan Engelhardt
2012-11-09 16:17       ` Chris Wilson
2012-11-10 14:07     ` Pablo Neira Ayuso
2012-11-10 19:13       ` Jan Engelhardt
2012-11-10 21:47         ` Jozsef Kadlecsik
2012-11-11 12:23           ` Pablo Neira Ayuso [this message]
2012-11-12 10:24           ` Chris Wilson
2012-11-12 15:05             ` Jozsef Kadlecsik
2012-11-12 15:27               ` Chris Wilson
2012-11-12 16:56                 ` Jozsef Kadlecsik
2012-11-12 18:19                   ` Chris Wilson
2012-11-12 19:07                     ` Jozsef Kadlecsik
2012-11-12 20:56                       ` Chris Wilson
2012-11-13 15:58                         ` Jozsef Kadlecsik
2012-11-13 16:09                           ` Chris Wilson
2012-11-13 16:19                             ` Jozsef Kadlecsik
2012-11-13 17:02                               ` Chris Wilson
2012-11-13 18:01                                 ` Jan Engelhardt
2012-11-12 19:56                     ` Ed W
2012-11-12 19:34                 ` Jozsef Kadlecsik
2012-11-12 22:34                   ` Chris Wilson
2012-11-13 16:04                     ` Jozsef Kadlecsik
2012-11-12 23:30                   ` Pablo Neira Ayuso
2012-11-13 14:23                     ` Stephen Clark
2012-11-13 15:25                       ` Jozsef Kadlecsik
2012-11-13 18:30                         ` Stephen Clark
2012-11-13 19:24                           ` Jozsef Kadlecsik
2012-11-13 21:19                             ` Stephen Clark
2012-11-14  8:08                               ` Jozsef Kadlecsik
2012-11-14 14:14                                 ` Stephen Clark
2012-11-14 14:57                                   ` Chris Wilson
2012-11-14 20:15                                   ` Jozsef Kadlecsik
2012-11-15 12:33                                     ` Stephen Clark
2012-11-15 14:01                                       ` Jozsef Kadlecsik
2012-11-13 16:11                     ` Jozsef Kadlecsik
2012-11-13 16:47                       ` Pablo Neira Ayuso

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=20121111122344.GA2212@1984 \
    --to=pablo@netfilter.org \
    --cc=chris@aptivate.org \
    --cc=jengelh@inai.de \
    --cc=kadlec@blackhole.kfki.hu \
    --cc=netfilter-devel@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).