Re: function for getting the source ip defined in the routing table

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



That's not the way routing works.
If you don't specify a source ip, the routing table picks for you,
if you do already have a source ip specified the routing table will
use that information to make decisions (ip rule from ...) but will not
change it.

Otherwise TCP wouldn't work.

So this is working as intended.

- Maciej

On Wed, May 21, 2014 at 1:36 AM, Andreas Herz <andi@xxxxxxxxxxxxxxx> wrote:
> 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@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux