From mboxrd@z Thu Jan 1 00:00:00 1970 From: Pedro Fortuna Subject: Re: filtering packtes before OS takes care about them Date: Tue, 1 Mar 2005 16:33:49 +0000 Message-ID: References: <09766A6E64A068419B362367800D50C0B58A17@moritz.faps.uni-erlangen.de> <7bca1cb50502281209798e8a00@mail.gmail.com> <7bca1cb50502281935557b45cc@mail.gmail.com> Reply-To: Pedro Fortuna Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit To: netdev@oss.sgi.com In-Reply-To: <7bca1cb50502281935557b45cc@mail.gmail.com> Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com List-Id: netdev.vger.kernel.org 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 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 >