lkml.org 
[lkml]   [2014]   [Oct]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectHow to find the correct source address to a destination in a kernel driver?
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


\
 
 \ /
  Last update: 2014-10-17 10:41    [W:0.030 / U:0.320 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site