2012-03-08 10:24:59

by Claudio Rossi

[permalink] [raw]
Subject: Accessing PROTOCOL TYPE FILES from rx.c in mac80211

Dear all,
I would like to inspect the protocol type field from mac802.11, and
specifically in rx.c in the function

static ieee80211_rx_result debug_noinline
ieee80211_rx_h_sta_process(struct ieee80211_rx_data *rx)

I was trying to do:

struct iphdr * network_header;
skb_set_network_header(skb,ieee80211_get_hdrlen_from_skb(skb));
network_header = (struct iphdr *)skb_network_header(skb);

if (network_header->protocol==IPPROTO_TCP){
...
}
but it does not seams to work....

In status.c everything works fine when I do:

struct iphdr * network_header;

network_header = (struct iphdr *)skb_network_header(skb);

if (network_header->protocol==IPPROTO_TCP){
...
}

the problem is how to correctly set the network header pointer in the
skb in rx.c
can somebody give me an hint?


Thank you

--
Claudio Rossi
-------------------
Office @ PoliTO: +39 011 5644194


2012-03-08 11:33:06

by Mohammed Shafi

[permalink] [raw]
Subject: Re: Accessing PROTOCOL TYPE FILES from rx.c in mac80211

On Thu, Mar 8, 2012 at 3:54 PM, Claudio Rossi
<[email protected]> wrote:
> Dear all,
> ?I would like to inspect the protocol type field from mac802.11, and
> specifically in rx.c in the function
>
> static ieee80211_rx_result debug_noinline
> ieee80211_rx_h_sta_process(struct ieee80211_rx_data *rx)

may be you should do this stuff after ieee80211_deliver_skb in 1740, rx.c

if (skb) {
/* deliver to local stack */
skb->protocol = eth_type_trans(skb, dev);
memset(skb->cb, 0, sizeof(skb->cb));
netif_receive_skb(skb);
}
}


>
> I was trying to do:
>
> struct iphdr * network_header;
> skb_set_network_header(skb,ieee80211_get_hdrlen_from_skb(skb));
> network_header = (struct iphdr *)skb_network_header(skb);
>
> ?if (network_header->protocol==IPPROTO_TCP){
> ...
> }
> but it does not seams to work....
>
> In status.c everything works fine when I do:
>
> struct iphdr * network_header;
>
> network_header = (struct iphdr *)skb_network_header(skb);
>
> ?if (network_header->protocol==IPPROTO_TCP){
> ...
> }
>
> the problem is how to correctly set the network header pointer in the
> skb in rx.c
> can somebody give me an hint?
>
>
> Thank you
>
> --
> Claudio Rossi
> -------------------
> Office @ PoliTO: +39 011 5644194
> --
> To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
> the body of a message to [email protected]
> More majordomo info at ?http://vger.kernel.org/majordomo-info.html



--
thanks,
shafi

2012-03-08 14:53:29

by Claudio Rossi

[permalink] [raw]
Subject: Re: Accessing PROTOCOL TYPE FILES from rx.c in mac80211

Dear Mohammed,
I need to work inside ieee80211_rx_h_sta_process as I have to
perform stationwise stats and I have to catch all packets, also the
ones that will be redirected to the BSS.
I think that the problem arise because the pointer of the
network_header is not correctly set.
If I am not wrong, at this point of the receive path the skb should
contain the 802.11 header as a first element, so I did
skb_set_nework_header(skb,ieee80211_get_hdrlen_from_skb(skb)))
I was supposing that after the MAC header there is the IP header... no
ethernet header in between. Is this the case?
Also doing
skb_set_nework_header(skb,ieee80211_get_hdrlen_from_skb(skb)+sizeof(struct(ethhdr)))
does not work
Does somebody have any hint?
thank you

Claudio


2012/3/8 Mohammed Shafi <[email protected]>:
> On Thu, Mar 8, 2012 at 3:54 PM, Claudio Rossi
> <[email protected]> wrote:
>> Dear all,
>> ?I would like to inspect the protocol type field from mac802.11, and
>> specifically in rx.c in the function
>>
>> static ieee80211_rx_result debug_noinline
>> ieee80211_rx_h_sta_process(struct ieee80211_rx_data *rx)
>
> may be you should do this stuff after ieee80211_deliver_skb in 1740, rx.c
>
> if (skb) {
> ? ? ? ? ? ? ? ? ? ? ? ?/* deliver to local stack */
> ? ? ? ? ? ? ? ? ? ? ? ?skb->protocol = eth_type_trans(skb, dev);
> ? ? ? ? ? ? ? ? ? ? ? ?memset(skb->cb, 0, sizeof(skb->cb));
> ? ? ? ? ? ? ? ? ? ? ? ?netif_receive_skb(skb);
> ? ? ? ? ? ? ? ?}
> ? ? ? ?}
>
>
>>
>> I was trying to do:
>>
>> struct iphdr * network_header;
>> skb_set_network_header(skb,ieee80211_get_hdrlen_from_skb(skb));
>> network_header = (struct iphdr *)skb_network_header(skb);
>>
>> ?if (network_header->protocol==IPPROTO_TCP){
>> ...
>> }
>> but it does not seams to work....
>>
>> In status.c everything works fine when I do:
>>
>> struct iphdr * network_header;
>>
>> network_header = (struct iphdr *)skb_network_header(skb);
>>
>> ?if (network_header->protocol==IPPROTO_TCP){
>> ...
>> }
>>
>> the problem is how to correctly set the network header pointer in the
>> skb in rx.c
>> can somebody give me an hint?
>>
>>
>> Thank you
>>
>> --
>> Claudio Rossi
>> -------------------
>> Office @ PoliTO: +39 011 5644194
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
>> the body of a message to [email protected]
>> More majordomo info at ?http://vger.kernel.org/majordomo-info.html
>
>
>
> --
> thanks,
> shafi



--
Claudio Rossi
-------------------
Office @ PoliTO: +39 011 5644194

2012-03-10 11:02:12

by Mohammed Shafi

[permalink] [raw]
Subject: Re: Accessing PROTOCOL TYPE FILES from rx.c in mac80211

Hi Claudio,

> ?I need to work inside ?ieee80211_rx_h_sta_process as I have to
> perform stationwise stats and I have to catch all packets, also the
> ones that will be redirected to the BSS.
> I think that the problem arise because the pointer of the
> network_header is not correctly set.
> If I am not wrong, at this point of the receive path the skb should
> contain the 802.11 header as a first element, so I did
> skb_set_nework_header(skb,ieee80211_get_hdrlen_from_skb(skb)))
> I was supposing that after the MAC header there is the IP header... no
> ethernet header in between. Is this the case?
> Also doing

currently don't have much idea, need to poke into the code

> skb_set_nework_header(skb,ieee80211_get_hdrlen_from_skb(skb)+sizeof(struct(ethhdr)))
> does not work
> Does somebody have any hint?
> thank you
>
> Claudio
>
>
> 2012/3/8 Mohammed Shafi <[email protected]>:
>> On Thu, Mar 8, 2012 at 3:54 PM, Claudio Rossi
>> <[email protected]> wrote:
>>> Dear all,
>>> ?I would like to inspect the protocol type field from mac802.11, and
>>> specifically in rx.c in the function
>>>
>>> static ieee80211_rx_result debug_noinline
>>> ieee80211_rx_h_sta_process(struct ieee80211_rx_data *rx)
>>
>> may be you should do this stuff after ieee80211_deliver_skb in 1740, rx.c
>>
>> if (skb) {
>> ? ? ? ? ? ? ? ? ? ? ? ?/* deliver to local stack */
>> ? ? ? ? ? ? ? ? ? ? ? ?skb->protocol = eth_type_trans(skb, dev);
>> ? ? ? ? ? ? ? ? ? ? ? ?memset(skb->cb, 0, sizeof(skb->cb));
>> ? ? ? ? ? ? ? ? ? ? ? ?netif_receive_skb(skb);
>> ? ? ? ? ? ? ? ?}
>> ? ? ? ?}
>>
>>
>>>
>>> I was trying to do:
>>>
>>> struct iphdr * network_header;
>>> skb_set_network_header(skb,ieee80211_get_hdrlen_from_skb(skb));
>>> network_header = (struct iphdr *)skb_network_header(skb);
>>>
>>> ?if (network_header->protocol==IPPROTO_TCP){
>>> ...
>>> }
>>> but it does not seams to work....
>>>
>>> In status.c everything works fine when I do:
>>>
>>> struct iphdr * network_header;
>>>
>>> network_header = (struct iphdr *)skb_network_header(skb);
>>>
>>> ?if (network_header->protocol==IPPROTO_TCP){
>>> ...
>>> }
>>>
>>> the problem is how to correctly set the network header pointer in the
>>> skb in rx.c
>>> can somebody give me an hint?
>>>
>>>
>>> Thank you
>>>
>>> --
>>> Claudio Rossi
>>> -------------------
>>> Office @ PoliTO: +39 011 5644194
>>> --
>>> To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
>>> the body of a message to [email protected]
>>> More majordomo info at ?http://vger.kernel.org/majordomo-info.html
>>
>>
>>
>> --
>> thanks,
>> shafi
>
>
>
> --
> Claudio Rossi
> -------------------
> Office @ PoliTO: +39 011 5644194



--
thanks,
shafi