netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: Konstantin Ushakov <kostik@oktetlabs.ru>
Cc: coreteam@netfilter.org,
	Netfilter Development Mailinglist
	<netfilter-devel@vger.kernel.org>
Subject: Re: [netfilter-core] Mangle table rules are not taken into account in preliminary routing decision
Date: Thu, 11 Oct 2007 06:10:23 +0200	[thread overview]
Message-ID: <470DA22F.70807@trash.net> (raw)
In-Reply-To: <470CA4DF.6000803@oktetlabs.ru>

Konstantin Ushakov wrote:
> Netfilter team,
> 
> we use netfilter under linux kernel 2.4.31 and have the problem
> described below.
> !Note, that it can be easily reproduced for latest kernels.
> 
>  - we want to connect to some on tcp port #80
>  - in the kernel and in some time we get to ip_route_output_slow function
>  - in this function kernel searches for route for the packet:
>          if (fib_lookup(&key, &res)) {
>             res.fi = NULL;
>             if (oldkey->oif) {               <- oif is zero at this
> point, so we miss that "if"
>                 ......
>             }
>             ...
>             err = -ENETUNREACH;
>             goto out;
>          }
>     It fails to find one as we don't have fwmark set for the packet and
> there is not route for packets without fwmark (see configuration
> attached). So, ENETUNREACH is returned and the packet fails to be sent.
> In fact the packet could be routed
> correctly, but this would happen in ip_build_xmit function in netfilter
> hook for LOCAL_OUT packets.
> 
> Questions:
>  - is it a bug or it's a deliberate decision to have such behaviour?
>  - is there any known add-hock solution for the problem?


Its a consequence of how routing by fwmark works. Its not perfect,
but I don't see a better solution since the initial routing takes
place before we even have a packet.

Just add a route to the dummy device or something like that, that
should make sure you don't get ENETUNREACH.

       reply	other threads:[~2007-10-11  4:10 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <470CA4DF.6000803@oktetlabs.ru>
2007-10-11  4:10 ` Patrick McHardy [this message]
2007-10-11  6:47   ` [netfilter-core] Mangle table rules are not taken into account in preliminary routing decision Konstantin Ushakov
2007-10-11  7:21     ` Patrick McHardy
2007-10-11  9:13       ` Pascal Hambourg
2007-10-15 14:11         ` Konstantin Ushakov
2007-10-15 15:01           ` Pascal Hambourg

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=470DA22F.70807@trash.net \
    --to=kaber@trash.net \
    --cc=coreteam@netfilter.org \
    --cc=kostik@oktetlabs.ru \
    --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).