Subject: Re: Custom packet editing
To: Mike Pelley , NetBSD Tech-Net <tech-net@netbsd.org>
From: Ignatios Souvatzis <ignatios@cs.uni-bonn.de>
List: tech-net
Date: 05/26/1999 10:29:48
On Mon, May 24, 1999 at 03:15:07AM -0400, Mike Pelley wrote:
> I would like to write some code that would allow me to edit ip and arp
> packets as they come off the wire and then pass them on to the kernel, and
> edit them as the packets are about to be written to the wire.  I will also
> be using ipnat and ipfilter.  My brief research tells me that I might want
> something like the FreeBSD divert sockets functionality, but it doesn't seem
> to carry over to NetBSD.  Does ipfilter offer some hooks like this?  Or will
> I have to attempt mucking around in the kernel (which I haven't done
> really)?

Why do you want to do this?

For IP packets, you can use IPfilter.

For ARP packets, thats currently not possible. ARP packets are completely
handled within the kernel.

However: you can tap ARP packets with a BPF expression, and handle them
completely in a user program, as long as the kernel may still handle its
own ARP packets. I don't think that this is a limitation: if you have 
a valid IP address on an Ethernet interface, you must handle ARP for it
anyway.

Regards,
	Ignatios Souvatzis