Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 14 Jun 2004 13:28:06 -0400
From:      James Housley <jim@Thehousleys.net>
To:        freebsd-net@FreeBSD.org
Subject:   Re: Using netgraph for filtering/modifing packets
Message-ID:  <40CDE026.3040502@Thehousleys.net>
In-Reply-To: <Pine.BSF.4.21.0406141016280.30464-100000@InterJet.elischer.org>
References:  <Pine.BSF.4.21.0406141016280.30464-100000@InterJet.elischer.org>

next in thread | previous in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
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@FreeBSD.org      http://www.FreeBSD.org     The Power to Serve
jim@TheHousleys.Net  http://www.TheHousleys.net
---------------------------------------------------------------------
"Eagles may soar, but weasels don't get sucked into jet engines"
     -- Anon

[-- Attachment #2 --]
0	*H
010	+0	*H
	#00U0
	*H
0b10	UZA1%0#U
Thawte Consulting (Pty) Ltd.1,0*U#Thawte Personal Freemail Issuing CA0
040131191100Z
050130191100Z0^10UHousley10U*James10U
James Housley1"0 	*H
	jim@thehousleys.net0"0
	*H
0
%k׈7o_tg?@<_P.Eh;_{)SӻNKH)'M(W_w%ވ,UnJ13{㎊‹t	[lBg]ѢbkKZ3OXmuq2$=d8ݨiܠc[)"(Vln嗛xRE%H%'zm6;!nij0$c`
wӁX	ᝐCs00.0U0jim@thehousleys.net0U00
	*H
}Nrx4Ae+d)?O}ibqWSVَUր0QjL*m$A
"Vs̱8~—`0e&q$5]%ړN00U0
	*H
0b10	UZA1%0#U
Thawte Consulting (Pty) Ltd.1,0*U#Thawte Personal Freemail Issuing CA0
040131191100Z
050130191100Z0^10UHousley10U*James10U
James Housley1"0 	*H
	jim@thehousleys.net0"0
	*H
0
%k׈7o_tg?@<_P.Eh;_{)SӻNKH)'M(W_w%ވ,UnJ13{㎊‹t	[lBg]ѢbkKZ3OXmuq2$=d8ݨiܠc[)"(Vln嗛xRE%H%'zm6;!nij0$c`
wӁX	ᝐCs00.0U0jim@thehousleys.net0U00
	*H
}Nrx4Ae+d)?O}ibqWSVَUր0QjL*m$A
"Vs̱8~—`0e&q$5]%ړN0?0
0
	*H
010	UZA10UWestern Cape10U	Cape Town10U
Thawte Consulting1(0&UCertification Services Division1$0"UThawte Personal Freemail CA1+0)	*H
	personal-freemail@thawte.com0
030717000000Z
130716235959Z0b10	UZA1%0#U
Thawte Consulting (Pty) Ltd.1,0*U#Thawte Personal Freemail Issuing CA00
	*H
0Ħ<UsUNʙZhup[v:aQP
0cZ,p+Z?qV˯<6$*+w=+>@dקe*TH<a@dr`00U00CU<0:08642http://crl.thawte.com/ThawtePersonalFreemailCA.crl0U0)U"0 010UPrivateLabel2-1380
	*H
HP.
fgCL!6-6/P p<ab:~t%Pb'qW%ݩ9 Oe_N4[5MwV!x!5$F]_eO1;070i0b10	UZA1%0#U
Thawte Consulting (Pty) Ltd.1,0*U#Thawte Personal Freemail Issuing CA0	+0	*H
	1	*H
0	*H
	1
040614172807Z0#	*H
	14"jh*DR_(}H0R	*H
	1E0C0
*H
0*H
0
*H
@0+0
*H
(0x	+71k0i0b10	UZA1%0#U
Thawte Consulting (Pty) Ltd.1,0*U#Thawte Personal Freemail Issuing CA0z*H
	1ki0b10	UZA1%0#U
Thawte Consulting (Pty) Ltd.1,0*U#Thawte Personal Freemail Issuing CA0
	*H
<Nw
8!
i|#"=<Y6)(thl$TeE։ZHRdxG[UlEA}=aq!e'΀Oplk>W4E~^^MP~mAǂ:ahEH}Pv]/ow]yw)('o7MHIC,xS[OSI(AMvlY
VUeWbM1QĒ//ɒ

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?40CDE026.3040502>