• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How to do ARP on OS X?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to do ARP on OS X?


  • Subject: Re: How to do ARP on OS X?
  • From: Ryan McGann <email@hidden>
  • Date: Wed, 1 Oct 2003 23:50:28 -0700

On Monday, September 29, 2003, at 10:01 PM, email@hidden wrote:

We need to detect the hardware address of a device when we know it's IP
address.

Is there a standard Unix or OS X way of finding out a hosts hardware address?

On OS/9 I just wrote a ARP interface. On OS X that doesnt work because
the ARP resolver is always listening to the incoming packets, which means
that my socket cant listen for the packets.
Take a look in Darwin's bootp projects. In particular, look at the bootplib project, and its ARP functions. You'll see that they use the BPF interfaces. (You'll need to be root to open up a BPF socket.)

Basically you use BPF (Berkley Packet Filters) to receive all ARP data coming in on a particular interface, and parse the ARP packets manually. Look at arp.c and bpflib.c inside the bootplib part of the bootp project in Darwin.

Alternatively, if you want to (rudely) assume the hardware address has already been resolved, you can look in the ARP cache. For that, look at the code for the arp command, also in Darwin, in the network_cmds project.

Ryan

Ryan McGann
Macintosh Internet Security
Symantec Corporation
email@hidden
Office: email@hidden
_______________________________________________
macnetworkprog mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/macnetworkprog
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: Re: disposing socket?
  • Next by Date: Re: URL Access Manager on OS9
  • Previous by thread: Re: disposing socket?
  • Next by thread: res_search and "xxx.local"
  • Index(es):
    • Date
    • Thread