Catching packets before they are sent to upper layers

Gianni Costanzi gianni.costanzi at
Mon Apr 24 11:17:09 EDT 2006

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) {
        skb->protocol = eth_type_trans(skb, dev);
        memset(skb->cb, 0, sizeof(skb->cb));
        skb->dev = dev;


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 Costanzi (gianni.costanzi at
|  Gentoo Documentation Project (GDP) Member - Italian Translator
|       (
|       (
|  Free Software Foundation Member #3844 (
|  Why GNU/Linux? (
-------------- next part --------------
An HTML attachment was scrubbed...

More information about the HostAP mailing list