Catching packets before they are sent to upper layers [hostap_80211_rx.c]

Gianni Costanzi gianni.costanzi at gmail.com
Sun Apr 30 05:33:19 EDT 2006


Hi,
I'd like to be able to look at the packets' header received by a station
(unicast or broadcast packets) which is using the hostap driver before they
are passed to the upper layers with netif_rx and I noticed that there are
different points in which netif_rx is used.. Now I'm looking at the packets'
header in the function hostap_80211_rx (hostap_80211_rx.c) here (line 1064):


    if (skb) {
        [EXAMINE ETHERNET HEADER HERE - DO SOMETHING WITH SKB]
        skb->protocol = eth_type_trans(skb, dev);
        memset(skb->cb, 0, sizeof(skb->cb));
        skb->dev = dev;

        netif_rx(skb);
    }

What I want to do is look at the ETHERTYPE field and if the protocol number
is the one identifying my protocol, do something with the skb without
passing it to upper layers. Is it sufficient for my purposes to take into
consideration only this netif_rx call or could I miss some packets? What is
the purpose of the other netif_rx calls in the rest of the code?
Let me ask you also another question, not related to hostap but to kernel
development: what's the difference between htons and __constant_htons calls?
Should I simply use __constant_htons when I'm "converting" a constant?

Thank you in advance for any help :)
Gianni

--
--------------------------------------------------------------------------------------------------------------
|  Gianni Costanzi (gianni.costanzi at gmail.com)
|       (http://ares.science.unitn.it/~gianni.costanzi/)
|
|  Gentoo Documentation Project (GDP) Member - Italian Translator
|       (http://www.gentoo.org/proj/en/gdp/)
|
|  Free Software Foundation Member #3844 (www.fsf.org)
|
|  Why GNU/Linux? (http://www.gnu.org/gnu/why-gnu-linux.html)
--------------------------------------------------------------------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.shmoo.com/pipermail/hostap/attachments/20060430/29bf4df9/attachment.htm 


More information about the HostAP mailing list