tags:

views:

71

answers:

1

Hi

Is there any way to retrieve the mac-address for the given ip-address from the ARP table without providing the Interface name ??

I do know the procedure of retrieving the mac address using ioctl call but in that case I should provide the interface name .. :(

One Crude Solution: Read /proc/net/arp file ... :( .. other than that .. any system call or anything else where i can retrieve the mac-address without the need of interface name ??

NOTE: Simple C based solution not interested in scripting libraries.

NOTE: I am expecting a *NUX based solution rather than WINDOWS based one.

+1  A: 

I do know the procedure of retrieving the mac address using ioctl call but in that case I should provide the interface name

So all you need is a way to find the interface name associated with a given IP. The ioctl SIOCGIFCONF will give you that.

joefis