Re: API to find out wether a IP address is local?

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

 



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.

This is not necessarily useful though: redirection happens in all kinds
of ways and all kinds of places and while getpeeraddr(2) might tell you
that you're connected to one of google.com's addresses, that could be
far from the truth.  (Of course, the inverse is true, just because you
thought you were connecting to a local address doesn't mean that some
wild and woolly iptables configuration didn't send your packets winging
half way around the globe.)

jch
--
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


[Index of Archives]     [Linux Netfilter Development]     [Linux Kernel Networking Development]     [Netem]     [Berkeley Packet Filter]     [Linux Kernel Development]     [Advanced Routing & Traffice Control]     [Bugtraq]

  Powered by Linux