mac80211: pass in PS_POLL frames
PATCH 1/1 mac80211: pass in PS_POLL frames
This patch fixes should_drop_frame function to pass in ps poll control frames required for power save functioanlity. Interface types that do not have interest for PS POLL frames now drop it in handler.
--- net/mac80211/ieee80211_i.h | 5 +++++ net/mac80211/rx.c | 10 ++++++++-- net/mac80211/util.c | 6 +++++- 3 files changed, 18 insertions(+), 3 deletions(-)
net/mac80211/ieee80211_i.h +5 -0
@@ -58,6 +58,11 @@ struct ieee80211_local;* increased memory use (about 2 kB of RAM per entry). */ #define IEEE80211_FRAGMENT_MAX 4 +/* IEEE 80211.11 minimal headers length */ +#define IEEE80211_HDR_MIN_LEN_CTRL 16 +#define IEEE80211_HDR_MIN_LEN_DATA 24 +#define IEEE80211_HDR_MIN_LEN_MGMT 24 +struct ieee80211_fragment_entry {unsigned long first_frag_time;unsigned int seq;
net/mac80211/rx.c +8 -2
@@ -61,8 +61,10 @@ static inline int should_drop_frame(struct ieee80211_rx_status *status,return 1 ;if (unlikely (skb->len <16 + present_fcs_len + radiotap_len))return 1 ; -if ((hdr->frame_control &cpu_to_le16 (IEEE80211_FCTL_FTYPE )) == -cpu_to_le16 (IEEE80211_FTYPE_CTL )) +if (((hdr->frame_control &cpu_to_le16 (IEEE80211_FCTL_FTYPE )) == +cpu_to_le16 (IEEE80211_FTYPE_CTL )) && + ((hdr->frame_control &cpu_to_le16 (IEEE80211_FCTL_STYPE )) != +cpu_to_le16 (IEEE80211_STYPE_PSPOLL )))return 1 ;return 0 ; }
@@ -874,6 +876,7 @@ ieee80211_rx_h_defragment(struct ieee80211_txrx_data *rx)static ieee80211_txrx_result ieee80211_rx_h_ps_poll (struct ieee80211_txrx_data *rx) { +struct ieee80211_sub_if_data *sdata =IEEE80211_DEV_TO_SUB_IF (rx->dev);struct sk_buff *skb;int no_pending_pkts;DECLARE_MAC_BUF (mac);
@@ -884,6 +887,9 @@ ieee80211_rx_h_ps_poll(struct ieee80211_txrx_data *rx) !(rx->flags & IEEE80211_TXRXD_RXRA_MATCH)))return TXRX_CONTINUE ; +if (sdata->type ==IEEE80211_IF_TYPE_STA ) +return TXRX_DROP ; + skb =skb_dequeue (&rx->sta->tx_filtered);if (!skb) { skb =skb_dequeue (&rx->sta->ps_tx_buf);
net/mac80211/util.c +5 -1
@@ -134,13 +134,15 @@ u8 *ieee80211_get_bssid(struct ieee80211_hdr *hdr, size_t len) {u16 fc; -if (len <24 ) +if (len <IEEE80211_HDR_MIN_LEN_CTRL )return NULL ; fc =le16_to_cpu (hdr->frame_control);switch (fc &IEEE80211_FCTL_FTYPE ) {case IEEE80211_FTYPE_DATA : +if (len <IEEE80211_HDR_MIN_LEN_DATA ) +return NULL ;switch (fc & (IEEE80211_FCTL_TODS |IEEE80211_FCTL_FROMDS )) {case IEEE80211_FCTL_TODS :return hdr->addr1;
@@ -153,6 +155,8 @@ u8 *ieee80211_get_bssid(struct ieee80211_hdr *hdr, size_t len) }break ;case IEEE80211_FTYPE_MGMT : +if (len <IEEE80211_HDR_MIN_LEN_MGMT ) +return NULL ;return hdr->addr3;case IEEE80211_FTYPE_CTL :if ((fc &IEEE80211_FCTL_STYPE ) ==IEEE80211_STYPE_PSPOLL )
Signature · 8 lines
1.5.3.3 --------------------------------------------------------------------- Intel Israel (74) Limited This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.
Quoted 16 lines · On Sunday 09 December 2007 07:33:42 Ron Rindjunsky wrote:
This patch fixes
should_drop_framefunction to pass in ps poll control frames required for power save functioanlity. Interface types that do not have interest for PS POLL frames now drop it in handler.Signed-off-by Ron Rindjunsky <[email protected]>--- net/mac80211/ieee80211_i.h | 5 +++++ net/mac80211/rx.c | 10 ++++++++-- net/mac80211/util.c | 6 +++++- 3 files changed, 18 insertions(+), 3 deletions(-)net/mac80211/ieee80211_i.h +0
-0
net/mac80211/ieee80211_i.h struct ieee80211_local; · line 61
Quoted 4 lines
net/mac80211/ieee80211_i.h +1
-0@@ -58,6 +58,11 @@ struct ieee80211_local;* increased memory use (about 2 kB of RAM per entry). */ #define IEEE80211_FRAGMENT_MAX 4 +/* IEEE 80211.11 minimal headers length */
One too many '11's in there.
net/mac80211/ieee80211_i.h struct ieee80211_local; · line 65
Quoted 4 lines
net/mac80211/ieee80211_i.h +4
-0+#define IEEE80211_HDR_MIN_LEN_CTRL 16 +#define IEEE80211_HDR_MIN_LEN_DATA 24 +#define IEEE80211_HDR_MIN_LEN_MGMT 24 +
This isn't really related to fixing the PS_POLL frame passing. It's a good idea however - please put it in include/linux/ieee80211.h and follow the naming conventions there.
Otherwise looks fine.
Thanks,
-Michael Wu
net/mac80211/ieee80211_i.h struct ieee80211_local; · line 62
Quoted 2 lines · Ron Rindjunsky
net/mac80211/ieee80211_i.h +2
-0+/* IEEE 80211.11 minimal headers length */ +#define IEEE80211_HDR_MIN_LEN_CTRL 16
Where does this value 16 come from? It is likely the shortest length one would receive from hardware/firmware in normal mode, but it is not the shortest length for a valid IEEE 802.11 control frame. Both CTS and ACK frames have only 10 octets in the header (just one address). Having IEEE80211_HDR_MIN_LEN_CTRL defined to 16 would be a bit confusing.. CTS and ACK frames are received at least in monitor mode, so these frames with 10 octet headers will need to be processed in some cases.
Signature · 1 line
Jouni Malinen PGP id EFC895FA
Quoted 10 lines
net/mac80211/ieee80211_i.h struct ieee80211_local; · line 62
Quoted 2 lines
net/mac80211/ieee80211_i.h +2
-0+/* IEEE 80211.11 minimal headers length */ +#define IEEE80211_HDR_MIN_LEN_CTRL 16Where does this value 16 come from? It is likely the shortest length one would receive from hardware/firmware in normal mode, but it is not the shortest length for a valid IEEE 802.11 control frame. Both CTS and ACK frames have only 10 octets in the header (just one address). Having
IEEE80211_HDR_MIN_LEN_CTRLdefined to 16 would be a bit confusing.. CTS and ACK frames are received at least in monitor mode, so these frames with 10 octet headers will need to be processed in some cases.
this check comes after monitor interface has been fed, so it shouldn't damage it.
My intention in the name was "min length for a frame that i want to pass" so i see why it can cause confusion. As no good name for it comes to my mind i think i will drop the #defines , add remarks to explain length use, and will welcome any change for better naming convention.
ron
Quoted 3 lines
--
Jouni Malinen PGP id EFC895FA