netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andreas Herz <andi@geekosphere.org>
To: "Maciej Żenczykowski" <zenczykowski@gmail.com>
Cc: Jan Engelhardt <jengelh@inai.de>,
	Netfilter Development Mailinglist
	<netfilter-devel@vger.kernel.org>
Subject: Re: function for getting the source ip defined in the routing table
Date: Wed, 21 May 2014 10:36:43 +0200	[thread overview]
Message-ID: <20140521083643.GU10939@kvmbude> (raw)
In-Reply-To: <CAHo-OozhUDnEJX3AZFTdWAx+trKhT9m=hKjj0Kr32aZm+Q_u=g@mail.gmail.com>

On 20/05/14 at 08:38, Maciej Żenczykowski wrote:
> Guessing that after ip_route_output_key(net, &fl4) fl4.saddr will have
> what you want.

Only if the fl4.saddr wasn't set before:

if (!fl4->saddr)
    fl4->saddr = FIB_RES_PREFSRC(net, res);

But i have (or need) a fl4->saddr since i want "ip rules" to be
inspected as well, and with an ip rule with "from $SRC" i need to call
ip_route_output_key(dev_net(dev), &fl4) with an fl4->saddr set or the
rule won't match correctly.

In the past i could call "ip_route_output_key" and then use "rt->rt_src"
to get the source ip i needed.

-- 
Andreas Herz
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2014-05-21  8:36 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-20 12:46 function for getting the source ip defined in the routing table Andreas Herz
2014-05-20 14:03 ` Jan Engelhardt
2014-05-20 14:18   ` Andreas Herz
2014-05-20 15:38     ` Maciej Żenczykowski
2014-05-21  8:36       ` Andreas Herz [this message]
2014-05-21 17:06         ` Maciej Żenczykowski
2014-05-21 17:07           ` Maciej Żenczykowski
2014-05-22  9:11           ` Andreas Herz
     [not found]             ` <CAJ26g5T1Ugfy-tfeFUBWABLrwuNkG26V7u=SvF6cr9pFwkGobA@mail.gmail.com>
2014-05-22 10:31               ` Andreas Herz
2014-06-03  7:55   ` Andreas Herz

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=20140521083643.GU10939@kvmbude \
    --to=andi@geekosphere.org \
    --cc=jengelh@inai.de \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=zenczykowski@gmail.com \
    /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).