On Tuesday 2011-06-14 11:11, John Haxby wrote: >On 14/06/11 08:31, Clemens Eisserer wrote: >> I know this question is not really netfilter related, sorry. But I >> didn't know where to ask it instead. >> >> Does Linux have an API to find out wether an IP address is local? > >netdevice(7) tells you how to extract all the IPv4 addresses from the >network devices; /proc/net/if_inet6 lists all the local IPv6 addresses. The API is netlink: ip route get 2001:db8::1 and test for whether the standalone keyword "local" is present. (Or alternatively, do the interfacing with netlink yourself using something like libmnl.) Due to things like client-side transparent proxying using TPROXY, it is possible that "local" is returned even though the address is not on any interface - but depending on your definition of "local" that might just be what is desired. Oh and stop using procfs, it is way too inferior. -- To unsubscribe from this list: send the line "unsubscribe netfilter" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html