Re: Userlevel ARP request

sjw44@eng.cam.ac.uk
Tue, 31 Aug 1999 16:42:58 +0100 (BST)


Mike Panetta wrote:
>
> Does the socket code in the kernel allow one to do a userlevel
> arp? I want to create a user level "arp ping" type program
> that if given an IP will report wether or not a machine is on that address
> given an arp reply on the IP. Is this possible? This is to work around
> a windows TCP/IP "bug"...
>
> --
> Mike Panetta
>
Hi,

yes this can be done with a PF_PACKET socket. You have a choice of
SOCK_RAW (with datalink headers) or SOCK_DGRAM (a slightly more cooked
mode of operation). Probably you would do something like:

s = socket(PF_PACKET, SOCK_RAW, htons(ETH_P_ARP));

You can restrict this to a single device with bind() too if you want to.
man 4 packet has more information,

Steve.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/