public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* How to find the correct source address to a destination in a kernel driver?
@ 2014-10-17  8:08 Stephan von Krawczynski
  0 siblings, 0 replies; only message in thread
From: Stephan von Krawczynski @ 2014-10-17  8:08 UTC (permalink / raw)
  To: linux-kernel

Hello all,

in former kernels with routing cache things were easy. We just used :

        rt = ip_route_output_key(XXX)
        src = rt->rt_src;

Now if there is no routing cache, we tried this:

        rt = ip_route_output_key(XXX)
        src = inet_select_addr(rt->dst.dev, dst, RT_SCOPE_UNIVERSE);

Unfortunately this does not work with interfaces having multiple ip addresses
and the routing in question is not over the first configured ip.
How do I get the correct src for all possible cases?

-- 
Regards,
Stephan

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2014-10-17  8:14 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-17  8:08 How to find the correct source address to a destination in a kernel driver? Stephan von Krawczynski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox