help getting external interface address linux

help getting external interface address linux

Post by Giacom » Sun, 18 Sep 2005 22:08:34



Good morning, what kernel space function could i use to get the ip address
of the
interface connected to the external Internet?

When i receive a packet, i would like to compare its destination address
with the one
corresponding to the interface connected to the internet, to distinguish
packets that originate from my internal net between those who come from the
internet.

I want it in a general way, such as taken from routing tables, not by
interface name or
other interface properties. In my case external interface would be ppp0, but
in another
system may change, so i would like to get it in a general way.

Thanks.

Giacomo