On Wednesday 02 January 2008, Chris Clayton wrote: > On Monday 31 December 2007, Ivo Van Doorn wrote: > > On Dec 31, 2007 8:27 AM, Kalle Valo <kalle.valo@xxxxxxxxx> wrote: > > > Ivo van Doorn <ivdoorn@xxxxxxxxx> writes: > > > > + /* > > > > + * Move entire frame 2 bytes to the front. > > > > + */ > > > > + skb_push(skb, 2); > > > > + memmove(skb->data, skb->data + 2, skb->len - 2); > > > > > > No skb_trim()? Shoudn't there be skb_trim(skb, 2) after memmove()? > > > > Good point, I completely forgot about that. :S > > Thanks. :) > > > > Ivo > > Ah, does the patch I have applied and am running need enhancement, please? --- diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c index ff399f8..3c10a68 100644 --- a/drivers/net/wireless/rt2x00/rt2x00dev.c +++ b/drivers/net/wireless/rt2x00/rt2x00dev.c @@ -386,6 +386,7 @@ void rt2x00lib_rxdone(struct data_entry *entry, struct sk_buff *skb, struct ieee80211_rx_status *rx_status = &rt2x00dev->rx_status; struct ieee80211_hw_mode *mode; struct ieee80211_rate *rate; + unsigned int header_size; unsigned int i; int val = 0; @@ -412,6 +413,27 @@ void rt2x00lib_rxdone(struct data_entry *entry, struct sk_buff *skb, } } + /* + * Properly align the ieee80211 frame and make sure the + * data behind the ieee80211 header is on a 4 byte boundrary. + */ + header_size = ieee80211_get_hdrlen_from_skb(skb); + if (!header_size) { + /* + * Frame is too short to contain a valid header, + * drop the entire frame since it is useless. + */ + kfree_skb(skb); + return; + } else if (header_size % 4 == 0) { + /* + * Move entire frame 2 bytes to the front. + */ + skb_push(skb, 2); + memmove(skb->data, skb->data + 2, skb->len - 2); + skb_trim(skb, skb->len - 2); + } + rt2x00_update_link_rssi(&rt2x00dev->link, desc->rssi); rt2x00dev->link.rx_success++; rx_status->rate = val; - To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html