Thread (1 message) 1 message, 1 author, 2003-11-20

Re: Function to determine if IP exists on a net-device?

From: Ben Greear <hidden>
Date: 2003-11-20 02:05:15

David S. Miller wrote:
On Wed, 19 Nov 2003 01:25:06 -0800
Ben Greear [off-list ref] wrote:

quoted
Is there a method already written that will tell me if an IP exists on
a netdevice?

If not, I am quite sure the answer lies in the in_ifaddr
list, but which field holds the IP address for the device?

Call getifaddrs(), walk the list finding the each and every list entry
with the 'ifa_name' name matching the device you want.  If there are
multiple addresses attached to an interface there will be multiple
in_ifaddr list entries with the 'ifa_name' of your interface.

In each of those entry, check the sockaddr pointed to by the 'ifa_addr'
field.

Is there not a more direct access if I already have the netdevice in question?
ie, can I get at the list by looking at dev->ip_ptr struct?


Thanks,
Ben


-- 
Ben Greear [off-list ref]
Candela Technologies Inc  http://www.candelatech.com
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help