Search Linux Wireless

Re: [PATCH] mac80211: Add radiotap support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Friday 06 April 2007 04:11, Johannes Berg wrote:
> On Fri, 2007-04-06 at 00:48 -0400, Michael Wu wrote:
> > @@ -3756,6 +3802,12 @@ void __ieee80211_rx(struct ieee80211_hw *hw,
> > struct sk_buff *skb, struct ieee80211_txrx_data rx;
> >  	u16 type;
> >  	int multicast;
> > +	int radiotap_len = 0;
> > +
> > +	if (status->flag & RX_FLAG_RADIOTAP) {
> > +		radiotap_len = ieee80211_get_radiotap_len(skb);
> > +		skb_pull(skb, radiotap_len);
> > +	}
> >
> >  	hdr = (struct ieee80211_hdr *) skb->data;
> >  	memset(&rx, 0, sizeof(rx));
> > @@ -3792,6 +3844,7 @@ void __ieee80211_rx(struct ieee80211_hw *hw, struct
> > sk_buff *skb, goto end;
> >  	skb = rx.skb;
> >
> > +	skb_push(skb, radiotap_len);
>
> I don't like this trick. It's so non-obvious. And inbetween, the only
> thing we ever use is skb->data (once, to get hdr assigned) and skb->len
> (which we could also load into a local variable.
>
This is actually being done to avoid modifying rx_pre_handlers.

> > @@ -3800,7 +3853,7 @@ void __ieee80211_rx(struct ieee80211_hw *hw, struct
> > sk_buff *skb, } else {
> >  		struct ieee80211_sub_if_data *prev = NULL;
> >  		struct sk_buff *skb_new;
> > -		u8 *bssid = ieee80211_get_bssid(hdr, skb->len);
> > +		u8 *bssid = ieee80211_get_bssid(hdr, skb->len - radiotap_len);
>
> and here you still need to do the subtraction. If you had the local
> variable, then you could just write frame_len or something.
>
But calling the rx_pre_handlers still requires the skb_pull and skb_push so 
this is the only point where we need to calculate the frame length ourselves.

-Michael Wu

Attachment: pgpMLtzM2sQK0.pgp
Description: PGP signature


[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux