codingfreak
codingfreak

Reputation: 4595

Retrieving Mac Address for the given IP-Address

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.

Upvotes: 0

Views: 603

Answers (1)

eemz
eemz

Reputation: 1211

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.

Upvotes: 1

Related Questions