netdev
[Top] [All Lists]

Re: filtering packtes before OS takes care about them

To: netdev@xxxxxxxxxxx
Subject: Re: filtering packtes before OS takes care about them
From: Pedro Fortuna <pedro.fortuna@xxxxxxxxx>
Date: Tue, 1 Mar 2005 16:33:49 +0000
Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:references; b=BX2/748sUtxErfiLSHAYUb/BgzmnZUJiOFdDGioSGC4OzaiNnGVjdSi9OWua/A1CIG764JFTcFxtMWXIprlTTY5vjWoCw4K8+9ZMFmONSQ+P3nekF6C/r2xZC8O2pPEPXLqIEj1lt40c0TFoSs6i3Xq0d2gy/6/Pr+WHtf/eCpo=
In-reply-to: <7bca1cb50502281935557b45cc@mail.gmail.com>
References: <09766A6E64A068419B362367800D50C0B58A17@moritz.faps.uni-erlangen.de> <7bca1cb50502281209798e8a00@mail.gmail.com> <db95d40c05022816301520b0a6@mail.gmail.com> <7bca1cb50502281935557b45cc@mail.gmail.com>
Reply-to: Pedro Fortuna <pedro.fortuna@xxxxxxxxx>
Sender: netdev-bounce@xxxxxxxxxxx
This subject is rather new to me. Is there some literature about linux
kernel networking API  that you would recommend?
thanks,
-Pedro Fortuna

On Mon, 28 Feb 2005 21:35:09 -0600, Asim Shankar <asimshankar@xxxxxxxxx> wrote:
> > In my case, I'll need to intercept all outgoing IP packets and change
> > them (including L2 frame) before they are passed to the network
> > interface driver.
> > The reverse operation is applied to incoming IP Packets in the destination 
> > host.
> > I didnt investigate the packet_type example you provided but I hope I
> > will be able to used for the purposes I explained.
> 
> If the type field of the struct packet_type you register ==
> htons(ETH_P_ALL), then your packet handling function will be added to
> the head of the ptype_all list.
> 
> As a result, it will see all incoming and outgoing packets - incoming
> will be delivered to your function from netif_receive_skb() before the
> IP/other packet handlers get to see it and outgoing packets will be
> delivered from dev_queue_xmit() (which calls dev_queue_xmit_nit())
> just before the packet is queued for sending by the NIC. This may work
> for you.
> 
> I'm assuming all outgoing packets go through dev_queue_xmit(), though
> that may not always be the case (someone more knowledgeable would have
> to explain this).
> 
> Regards,
> 
> -- Asim
>

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