How to tell if an IP address belongs to a host?
From within a C program, what is the best way to determine if a
particular IP address belongs to the host the program is running on?
The host may be a router, so it can have an arbitrary number of
interfaces and IP addresses, and it might not use DNS. The program runs
as root, so I can use weird low-level kernel interfaces if necessary.
If possible, I need this to work on both Linux 2.4 and Linux 2.6, but
other systems aren't important at the momment.
Rennie
Rennie deGraaf
|