netdev
[Top] [All Lists]

Re: filtering packtes before OS takes care about them

To: Weber Matthias <weber@xxxxxxxxxxxxxxxxxxxx>
Subject: Re: filtering packtes before OS takes care about them
From: Asim Shankar <asimshankar@xxxxxxxxx>
Date: Mon, 28 Feb 2005 14:09:56 -0600
Cc: netdev@xxxxxxxxxxx
Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:references; b=WKTIBHeLkq+mIIiq8OcOxh3Ni2k6eaZvsz7BLjOTWNk+Cc2MnFWHyPOhKNrFkG//ioaTkTRSRjlH0Oxc4mzlgbGgtTEWaNVjcpXHixipD5zGSG/x6asH/BEhYCUqvcLicc8ES8ciSoj+CbpwdIQRdMHF05y/j3Ssmo6yUROjre0=
In-reply-to: <09766A6E64A068419B362367800D50C0B58A17@moritz.faps.uni-erlangen.de>
References: <09766A6E64A068419B362367800D50C0B58A17@moritz.faps.uni-erlangen.de>
Reply-to: Asim Shankar <asimshankar@xxxxxxxxx>
Sender: netdev-bounce@xxxxxxxxxxx
> i need a possibility to catch IP4 packets (from ethernet devices) before OS' 
> netmodules (IP, UDP, TCP, ICMP, ARP, ROUTE, NETFILTER ...) takes care about 
> them and
> * to delete them from input buffer such that OS' netmodules can't receive them
> * to modify packet headers and move packets to interface related output 
> buffers
> * to keep them in input buffers such that OS' netmodules can take care about 
> them.

You can process packets even before ip_rcv() gets them by registering
your own packet handler (struct packet_type) using dev_add_pack().  I
have a small sample at:
http://limnos.csrd.uiuc.edu/notes/code-samples/samples/kernel/packet_type/packet_type_test.c
This may not be the cleanest way, but it isn't that dirty either.

Also see:
http://www.phrack.org/show.php?p=55&a=12

-- Asim

<Prev in Thread] Current Thread [Next in Thread>