I'm looking for some Linux code to find an IP address from an Ethernet address. I suppose I have to do some inverse ARP trickery but I don't find any example...
http://compnetworking.about.com/od/networkprotocolsip/f/convertipmacadd.htm
Try sending an IP broadcast (e.g. ping 192.168.1.255
if your subnet is 192.168.1.0/24) to prime your ARP cache, followed by arp -a
to spit it all out.
For computers that you have communicated with, you can look at their arp entry. This is available in text format in /proc/net/arp
for example. Finding an IP address for a MAC that you know but haven't communicated with is significantly more difficult. The closest match, protocol-wise, would be RARP but that's hardly ever in use so your are not likely to get a response.
You can always scan your local subnet to make sure you get a full view in your arp table. See for example fping
for an efficient way to do this. Note that hosts don't actually need to respond to the pings in question to appear in the ARP table, so this is useful even in the presence of local firewalls etc.
If the entry is already in the arp table, you may use code similar to the one posted in this question: http://stackoverflow.com/questions/2867038/using-netlink-to-obtain-arp-entries-only-returns-stale-entries