Catching packets before they are sent to upper layers

Gianni Costanzi gianni.costanzi
Mon Apr 24 08:17:09 PDT 2006


Hi,
I'd like to be able to look at the packets' header received by a station
(unicast or broadcast packets) 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)
|
|  Gentoo Documentation Project (GDP) Member - Italian Translator
|       (http://www.gentoo.org/proj/en/gdp/)
|       (http://ares.science.unitn.it/~gianni.costanzi/)
|
|  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/20060424/9a246c74/attachment.htm 



More information about the Hostap mailing list