[Top] [All Lists]

Re: filtering packtes before OS takes care about them

To: Pedro Fortuna <pedro.fortuna@xxxxxxxxx>
Subject: Re: filtering packtes before OS takes care about them
From: Asim Shankar <asimshankar@xxxxxxxxx>
Date: Mon, 28 Feb 2005 21:35:09 -0600
Cc: netdev@xxxxxxxxxxx
Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta;; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:references; b=hbdK8xUSw5LGtosZzJrGX9c0kU8R0zqzSoC8/CeMuGcc0gdwWssAyiV91xw/jJWtFb0FwlWKBkLUw+WCcS3DqIegDR8qmXRuibGXF8LLM/LSmTDFrcAUNdLOC2W2bAiqS9GCKFeOrHbpxrhOEFF98TRCZVzMUp0edvZCUceet5s=
In-reply-to: <>
References: <> <> <>
Reply-to: Asim Shankar <asimshankar@xxxxxxxxx>
Sender: netdev-bounce@xxxxxxxxxxx
> 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).


-- Asim

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