[1850] in linux-net channel archive
Re: Gratuitous ARP/RAW sockets under Linux
daemon@ATHENA.MIT.EDU (Alan Cox)
Mon Feb 5 08:15:02 1996
From: iialan@iifeak.swan.ac.uk (Alan Cox)
To: vgupta@cs.binghamton.edu (Vipul Gupta)
Date: Mon, 5 Feb 1996 08:49:13 +0000 (GMT)
Cc: linux-net@vger.rutgers.edu, vgupta@cs.binghamton.edu
In-Reply-To: <Pine.SUN.3.91.960203141414.3651B-100000@sol> from "Vipul Gupta" at Feb 3, 96 03:24:16 pm
> b) My second question is -- Is there an example code fragment that
> shows how to generate ethernet encapsulated IP messages from
> user space (with root privileges) in which various ethernet fields
> (dest addr, Type) and IP fields (e.g. TTL) can be controlled by the
> user? RAW sockets should be usbale in this fashion but
> the man pages don't say much about RAW sockets.
A SOCK_RAW IP socket lets you set the core fields, if you open it with
a type of IPPROTO_RAW you can fill in almost anything. I'd recommend reading
the soure to ping (from netkit-B) to see this in use.
You can also send raw frames down to the physical level using the SOCK_PACKET
interface (eg to send gratuitous arp from user space). See the
libpacket.[ch] files from DOSemu for a support library.
Alan