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

From: Ben Greear <[email-masked]>
Date: Wed, 19 Nov 2003 18:05:15 -0800

David S. Miller wrote:
> On Wed, 19 Nov 2003 01:25:06 -0800
> Ben Greear <[email-masked]> wrote:
> 
> 
>>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 <[email-masked]>
Candela Technologies Inc  http://www.candelatech.com