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

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

 



On Tuesday 2014-05-20 14:46, Andreas Herz wrote:

>i was looking for a function to get the source ip that is defined in the
>routing table. I looked into the MASQUERADE module but the
>"inet_select_addr" function returns the source ip from the interface
>(the first one, in most use cases).
>
>See the following routing table entry:
>
>10.0.13.0/24 dev eth1  proto kernel  scope link  src 10.0.13.4
>
>while the interface has multiple IPs:
>
>    inet 10.0.12.1/24 scope global eth0
>    inet 10.0.13.2/24 scope global eth0
>    inet 10.0.13.4/24 scope global secondary eth0
>
>So what i want is the value of the src part in the routing table (for 
>connections to the related network).

RTM_GETROUTE in netlink, `ip route get` on sh, and 
ip6_route_output/ip_route_output_key in C.
--
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