Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 22 Dec 2006 11:03:54 -0500
From:      Chuck Swiger <cswiger@mac.com>
To:        =?ISO-8859-1?Q?Fabr=EDcio_Barros_Cabral?= <fxcabral@yahoo.com.br>
Cc:        freebsd-net@freebsd.org
Subject:   Re: Intercepting a packet, changing it and re-injecting into the network
Message-ID:  <458C01EA.3080207@mac.com>
In-Reply-To: <1166802209.7642.17.camel@hades.no-ip.org>
References:  <1166802209.7642.17.camel@hades.no-ip.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Fabrício Barros Cabral wrote:
> Hello everybody!
> 
> I'm developing a network application which needs *to intercept* a packet
> (not just *copy* a packet, like libpcap does), move this packet into my
> application (userland), do some checking in the packet and according
> with some heuristics, the application may change the payload and
> re-inject the modified packet into the network. Note that sometimes,
> I'll change the payload, drop the packet or just let it go.
> 
> So, how can a I do that in FreeBSD? I can use 6.1, 7.1, any version.

Use IPFW plus a divert socket, or possibly netgraph.  See the sources for natd 
for an example of a userland app which intercepts and re-injects packets, 
possibly modified...

-- 
-Chuck



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?458C01EA.3080207>