Using netgraph for filtering/modifing packets
James Housley
jim at Thehousleys.net
Mon Jun 14 17:28:41 GMT 2004
Julian Elischer wrote:
>
> On Mon, 14 Jun 2004, James Housley wrote:
>
>
>>For testing of a product I would like to be able to modify or even drop
>>packets based on their content. What I have in mind is forcing the
>>packets through a firewall that would redirect all packet to a netgraph
>>node that would either pass unchanged, drop or change the contents to
>>assist in testing some corner cases in the code.
>>
>>1) is this something doable with netgraph, I believe it is.
>
>
> yes
>
>
>
>>2) what might be a good place to start? Have done some searching, but
>>haven't found any example code I thought I could start from.
>
>
> What sort of filter do you need?
>
> you can pass packets to netgraph from ipfw by diverting them and
> openning a divert socket with teh ksocket node..
>
> Or you can pick them directly from the network interface
> and filter yourself using the 'bpf' node type to select
> on something.
> or you can use the etf type of node to filter on a particular
> ethertype..
>
> there are a lot of options but I don't knw your application enough :-)
>
I have a product that is connected to a PC via eithernet. The product
runs FBSD, but I would likely put another FBSD box in the middle. I want
to be able modify packets for good and evil based on the data portion of
the packet.
For example to ocasionally drop a packet that is acking some command. Or
send an ack for a command that was never sent. Or just change data to be
invalid.
Then after messing with the data portion put it back in the queue to be
sent, if it wasn't just dropped.
Jim
--
/"\ ASCII Ribbon Campaign .
\ / - NO HTML/RTF in e-mail .
X - NO Word docs in e-mail .
/ \ -----------------------------------------------------------------
jeh at FreeBSD.org http://www.FreeBSD.org The Power to Serve
jim at TheHousleys.Net http://www.TheHousleys.net
---------------------------------------------------------------------
"Eagles may soar, but weasels don't get sucked into jet engines"
-- Anon
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3228 bytes
Desc: S/MIME Cryptographic Signature
Url : http://lists.freebsd.org/pipermail/freebsd-net/attachments/20040614/f47fa3a4/smime.bin
More information about the freebsd-net
mailing list