linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] mac80211: pass in PS_POLL frames
@ 2007-12-09 12:33 Ron Rindjunsky
  2007-12-10  4:05 ` Michael Wu
  2007-12-10  4:59 ` Jouni Malinen
  0 siblings, 2 replies; 14+ messages in thread
From: Ron Rindjunsky @ 2007-12-09 12:33 UTC (permalink / raw)
  To: linville
  Cc: johannes, linux-wireless, flamingice, tomas.winkler, yi.zhu,
	Ron Rindjunsky

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.

Signed-off-by: Ron Rindjunsky <ron.rindjunsky@intel.com>
---
 net/mac80211/ieee80211_i.h |    5 +++++
 net/mac80211/rx.c          |   10 ++++++++--
 net/mac80211/util.c        |    6 +++++-
 3 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index 2476cc5..a7746da 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -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;
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 9009444..3bd9edc 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -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);
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index f90287a..b53644c 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -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)
-- 
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.

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/1] mac80211: pass in PS_POLL frames
  2007-12-09 12:33 [PATCH 1/1] mac80211: pass in PS_POLL frames Ron Rindjunsky
@ 2007-12-10  4:05 ` Michael Wu
  2007-12-10  4:59 ` Jouni Malinen
  1 sibling, 0 replies; 14+ messages in thread
From: Michael Wu @ 2007-12-10  4:05 UTC (permalink / raw)
  To: Ron Rindjunsky; +Cc: linville, johannes, linux-wireless, tomas.winkler, yi.zhu

[-- Attachment #1: Type: text/plain, Size: 1298 bytes --]

On Sunday 09 December 2007 07:33:42 Ron Rindjunsky wrote:
> 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.
>
> Signed-off-by: Ron Rindjunsky <ron.rindjunsky@intel.com>
> ---
>  net/mac80211/ieee80211_i.h |    5 +++++
>  net/mac80211/rx.c          |   10 ++++++++--
>  net/mac80211/util.c        |    6 +++++-
>  3 files changed, 18 insertions(+), 3 deletions(-)
>
> diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
> index 2476cc5..a7746da 100644
> --- a/net/mac80211/ieee80211_i.h
> +++ b/net/mac80211/ieee80211_i.h
> @@ -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.

> +#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

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 194 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/1] mac80211: pass in PS_POLL frames
  2007-12-09 12:33 [PATCH 1/1] mac80211: pass in PS_POLL frames Ron Rindjunsky
  2007-12-10  4:05 ` Michael Wu
@ 2007-12-10  4:59 ` Jouni Malinen
  2007-12-10  8:19   ` Ron Rindjunsky
  1 sibling, 1 reply; 14+ messages in thread
From: Jouni Malinen @ 2007-12-10  4:59 UTC (permalink / raw)
  To: Ron Rindjunsky
  Cc: linville, johannes, linux-wireless, flamingice, tomas.winkler,
	yi.zhu

On Sun, Dec 09, 2007 at 02:33:42PM +0200, Ron Rindjunsky wrote:

> +/* 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.

-- 
Jouni Malinen                                            PGP id EFC895FA

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/1] mac80211: pass in PS_POLL frames
  2007-12-10  4:59 ` Jouni Malinen
@ 2007-12-10  8:19   ` Ron Rindjunsky
  0 siblings, 0 replies; 14+ messages in thread
From: Ron Rindjunsky @ 2007-12-10  8:19 UTC (permalink / raw)
  To: Jouni Malinen
  Cc: linville, johannes, linux-wireless, flamingice, tomas.winkler,
	yi.zhu

> > +/* 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.

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

>
> --
> Jouni Malinen                                            PGP id EFC895FA

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 1/1] mac80211: pass in PS_POLL frames
@ 2007-12-10  9:16 Ron Rindjunsky
  2007-12-10 12:08 ` Johannes Berg
                   ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: Ron Rindjunsky @ 2007-12-10  9:16 UTC (permalink / raw)
  To: linville
  Cc: johannes, linux-wireless, flamingice, tomas.winkler, yi.zhu,
	Ron Rindjunsky

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.

Signed-off-by: Ron Rindjunsky <ron.rindjunsky@intel.com>
---
 net/mac80211/rx.c   |   10 ++++++++--
 net/mac80211/util.c |    7 ++++++-
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 50f99e7..5dbf5d6 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -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;
 }
@@ -880,6 +882,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);
@@ -890,6 +893,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);
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index 7b278e9..fb7fd89 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -135,13 +135,16 @@ u8 *ieee80211_get_bssid(struct ieee80211_hdr *hdr, size_t len)
 {
 	u16 fc;
 
-	if (len < 24)
+	 /* drop ACK/CTS frames and incorrect hdr len (ctrl) */
+	if (len < 16)
 		return NULL;
 
 	fc = le16_to_cpu(hdr->frame_control);
 
 	switch (fc & IEEE80211_FCTL_FTYPE) {
 	case IEEE80211_FTYPE_DATA:
+		if (len < 24) /* drop incorrect hdr len (data) */
+			return NULL;
 		switch (fc & (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) {
 		case IEEE80211_FCTL_TODS:
 			return hdr->addr1;
@@ -154,6 +157,8 @@ u8 *ieee80211_get_bssid(struct ieee80211_hdr *hdr, size_t len)
 		}
 		break;
 	case IEEE80211_FTYPE_MGMT:
+		if (len < 24) /* drop incorrect hdr len (mgmt) */
+			return NULL;
 		return hdr->addr3;
 	case IEEE80211_FTYPE_CTL:
 		if ((fc & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_PSPOLL)
-- 
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.

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/1] mac80211: pass in PS_POLL frames
  2007-12-10  9:16 Ron Rindjunsky
@ 2007-12-10 12:08 ` Johannes Berg
  2007-12-10 12:17   ` Tomas Winkler
  2007-12-17 15:00 ` Ron Rindjunsky
  2007-12-17 17:46 ` Johannes Berg
  2 siblings, 1 reply; 14+ messages in thread
From: Johannes Berg @ 2007-12-10 12:08 UTC (permalink / raw)
  To: Ron Rindjunsky
  Cc: linville, linux-wireless, flamingice, tomas.winkler, yi.zhu

[-- Attachment #1: Type: text/plain, Size: 391 bytes --]


> -	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)))

Hm. Don't we have macros for this?

johannes

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/1] mac80211: pass in PS_POLL frames
  2007-12-10 12:08 ` Johannes Berg
@ 2007-12-10 12:17   ` Tomas Winkler
  0 siblings, 0 replies; 14+ messages in thread
From: Tomas Winkler @ 2007-12-10 12:17 UTC (permalink / raw)
  To: Johannes Berg
  Cc: Ron Rindjunsky, linville, linux-wireless, flamingice, yi.zhu

On Dec 10, 2007 2:08 PM, Johannes Berg <johannes@sipsolutions.net> wrote:
>
> > -     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)))
>
> Hm. Don't we have macros for this?
>
Not in mac80211 as far as I know. There were some in ieee80211.
Iwlwifi have them in iwl-helpers.h  as inline functions
Tomas

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/1] mac80211: pass in PS_POLL frames
  2007-12-10  9:16 Ron Rindjunsky
  2007-12-10 12:08 ` Johannes Berg
@ 2007-12-17 15:00 ` Ron Rindjunsky
  2007-12-17 17:46 ` Johannes Berg
  2 siblings, 0 replies; 14+ messages in thread
From: Ron Rindjunsky @ 2007-12-17 15:00 UTC (permalink / raw)
  To: linville, johannes, flamingice, tomas.winkler
  Cc: linux-wireless, yi.zhu, Ron Rindjunsky

Hi folks, this patch is a V2 with fixes, and i haven't received any
new comments nor Ack for it. I have another patch that depends on this
one so i need to know the status for it.
thanks
ron

> 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.
>
> Signed-off-by: Ron Rindjunsky <ron.rindjunsky@intel.com>
> ---
>  net/mac80211/rx.c   |   10 ++++++++--
>  net/mac80211/util.c |    7 ++++++-
>  2 files changed, 14 insertions(+), 3 deletions(-)
>
> diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
> index 50f99e7..5dbf5d6 100644
> --- a/net/mac80211/rx.c
> +++ b/net/mac80211/rx.c
> @@ -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;
>  }
> @@ -880,6 +882,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);
> @@ -890,6 +893,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);
> diff --git a/net/mac80211/util.c b/net/mac80211/util.c
> index 7b278e9..fb7fd89 100644
> --- a/net/mac80211/util.c
> +++ b/net/mac80211/util.c
> @@ -135,13 +135,16 @@ u8 *ieee80211_get_bssid(struct ieee80211_hdr *hdr, size_t len)
>  {
>        u16 fc;
>
> -       if (len < 24)
> +        /* drop ACK/CTS frames and incorrect hdr len (ctrl) */
> +       if (len < 16)
>                return NULL;
>
>        fc = le16_to_cpu(hdr->frame_control);
>
>        switch (fc & IEEE80211_FCTL_FTYPE) {
>        case IEEE80211_FTYPE_DATA:
> +               if (len < 24) /* drop incorrect hdr len (data) */
> +                       return NULL;
>                switch (fc & (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) {
>                case IEEE80211_FCTL_TODS:
>                        return hdr->addr1;
> @@ -154,6 +157,8 @@ u8 *ieee80211_get_bssid(struct ieee80211_hdr *hdr, size_t len)
>                }
>                break;
>        case IEEE80211_FTYPE_MGMT:
> +               if (len < 24) /* drop incorrect hdr len (mgmt) */
> +                       return NULL;
>                return hdr->addr3;
>        case IEEE80211_FTYPE_CTL:
>                if ((fc & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_PSPOLL)

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/1] mac80211: pass in PS_POLL frames
  2007-12-10  9:16 Ron Rindjunsky
  2007-12-10 12:08 ` Johannes Berg
  2007-12-17 15:00 ` Ron Rindjunsky
@ 2007-12-17 17:46 ` Johannes Berg
  2007-12-18  9:24   ` Ron Rindjunsky
  2 siblings, 1 reply; 14+ messages in thread
From: Johannes Berg @ 2007-12-17 17:46 UTC (permalink / raw)
  To: Ron Rindjunsky
  Cc: linville, linux-wireless, flamingice, tomas.winkler, yi.zhu

[-- Attachment #1: Type: text/plain, Size: 688 bytes --]

Ron, sorry, totally forgot about this patch after asking about the macro
that doesn't seem to exist after all.

On Mon, 2007-12-10 at 11:16 +0200, Ron Rindjunsky wrote:
> 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.

Taking a closer look...

> +	if (sdata->type == IEEE80211_IF_TYPE_STA)
> +		return TXRX_DROP;

Should we maybe do the test explicitly for when we want it, i.e.
AP/VLAN/IBSS cases? Just thinking of the mesh networking stuff etc.
that's being added...

Other than that, looks fine.

johannes

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/1] mac80211: pass in PS_POLL frames
  2007-12-17 17:46 ` Johannes Berg
@ 2007-12-18  9:24   ` Ron Rindjunsky
  2007-12-18 12:39     ` Johannes Berg
  0 siblings, 1 reply; 14+ messages in thread
From: Ron Rindjunsky @ 2007-12-18  9:24 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linville, linux-wireless, flamingice, tomas.winkler, yi.zhu

> > +     if (sdata->type == IEEE80211_IF_TYPE_STA)
> > +             return TXRX_DROP;
>
> Should we maybe do the test explicitly for when we want it, i.e.
> AP/VLAN/IBSS cases? Just thinking of the mesh networking stuff etc.
> that's being added...

no problem, i'll send it over. currently i see only AP mode as relevant.

>
> Other than that, looks fine.
>
> johannes
>
>

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/1] mac80211: pass in PS_POLL frames
  2007-12-18  9:24   ` Ron Rindjunsky
@ 2007-12-18 12:39     ` Johannes Berg
  2007-12-18 15:00       ` Rindjunsky, Ron
  0 siblings, 1 reply; 14+ messages in thread
From: Johannes Berg @ 2007-12-18 12:39 UTC (permalink / raw)
  To: Ron Rindjunsky
  Cc: linville, linux-wireless, flamingice, tomas.winkler, yi.zhu

[-- Attachment #1: Type: text/plain, Size: 618 bytes --]


On Tue, 2007-12-18 at 11:24 +0200, Ron Rindjunsky wrote:
> > > +     if (sdata->type == IEEE80211_IF_TYPE_STA)
> > > +             return TXRX_DROP;
> >
> > Should we maybe do the test explicitly for when we want it, i.e.
> > AP/VLAN/IBSS cases? Just thinking of the mesh networking stuff etc.
> > that's being added...
> 
> no problem, i'll send it over. currently i see only AP mode as relevant.

But I think that if we have a station in a VLAN then we'll have the VLAN
interface at this point, no? I guess we really need to test that anyway,
I wish hostapd could do VLANs without RADIUS.

johannes

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* RE: [PATCH 1/1] mac80211: pass in PS_POLL frames
  2007-12-18 12:39     ` Johannes Berg
@ 2007-12-18 15:00       ` Rindjunsky, Ron
  0 siblings, 0 replies; 14+ messages in thread
From: Rindjunsky, Ron @ 2007-12-18 15:00 UTC (permalink / raw)
  To: Johannes Berg
  Cc: linville, linux-wireless, flamingice, Winkler, Tomas, Zhu, Yi


>>>> +     if (sdata->type == IEEE80211_IF_TYPE_STA)
>>>> +             return TXRX_DROP;
>>>
>>> Should we maybe do the test explicitly for when we want it, i.e.
>>> AP/VLAN/IBSS cases? Just thinking of the mesh networking stuff etc.
>>> that's being added...
>> 
>> no problem, i'll send it over. currently i see only AP mode as
relevant.

> But I think that if we have a station in a VLAN then we'll have the
VLAN
> interface at this point, no? I guess we really need to test that
anyway,
> I wish hostapd could do VLANs without RADIUS.

Agree, I will add the VLAN as well.

---------------------------------------------------------------------
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.


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 1/1] mac80211: pass in PS_POLL frames
@ 2007-12-18 15:23 Ron Rindjunsky
  2007-12-18 15:26 ` Johannes Berg
  0 siblings, 1 reply; 14+ messages in thread
From: Ron Rindjunsky @ 2007-12-18 15:23 UTC (permalink / raw)
  To: linville
  Cc: johannes, linux-wireless, flamingice, tomas.winkler, yi.zhu,
	Ron Rindjunsky

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.

Signed-off-by: Ron Rindjunsky <ron.rindjunsky@intel.com>
---
 net/mac80211/rx.c   |   11 +++++++++--
 net/mac80211/util.c |    7 ++++++-
 2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 50f99e7..e94cf30 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -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;
 }
@@ -880,6 +882,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);
@@ -890,6 +893,10 @@ 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_AP) &&
+	    (sdata->type != IEEE80211_IF_TYPE_VLAN))
+		return TXRX_DROP;
+
 	skb = skb_dequeue(&rx->sta->tx_filtered);
 	if (!skb) {
 		skb = skb_dequeue(&rx->sta->ps_tx_buf);
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index 7b278e9..fb7fd89 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -135,13 +135,16 @@ u8 *ieee80211_get_bssid(struct ieee80211_hdr *hdr, size_t len)
 {
 	u16 fc;
 
-	if (len < 24)
+	 /* drop ACK/CTS frames and incorrect hdr len (ctrl) */
+	if (len < 16)
 		return NULL;
 
 	fc = le16_to_cpu(hdr->frame_control);
 
 	switch (fc & IEEE80211_FCTL_FTYPE) {
 	case IEEE80211_FTYPE_DATA:
+		if (len < 24) /* drop incorrect hdr len (data) */
+			return NULL;
 		switch (fc & (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) {
 		case IEEE80211_FCTL_TODS:
 			return hdr->addr1;
@@ -154,6 +157,8 @@ u8 *ieee80211_get_bssid(struct ieee80211_hdr *hdr, size_t len)
 		}
 		break;
 	case IEEE80211_FTYPE_MGMT:
+		if (len < 24) /* drop incorrect hdr len (mgmt) */
+			return NULL;
 		return hdr->addr3;
 	case IEEE80211_FTYPE_CTL:
 		if ((fc & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_PSPOLL)
-- 
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.


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/1] mac80211: pass in PS_POLL frames
  2007-12-18 15:23 Ron Rindjunsky
@ 2007-12-18 15:26 ` Johannes Berg
  0 siblings, 0 replies; 14+ messages in thread
From: Johannes Berg @ 2007-12-18 15:26 UTC (permalink / raw)
  To: Ron Rindjunsky
  Cc: linville, linux-wireless, flamingice, tomas.winkler, yi.zhu

[-- Attachment #1: Type: text/plain, Size: 3051 bytes --]


On Tue, 2007-12-18 at 17:23 +0200, Ron Rindjunsky wrote:
> 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.
> 
> Signed-off-by: Ron Rindjunsky <ron.rindjunsky@intel.com>

Looks good to me.
Acked-by: Johannes Berg <johannes@sipsolutions.net>

> ---
>  net/mac80211/rx.c   |   11 +++++++++--
>  net/mac80211/util.c |    7 ++++++-
>  2 files changed, 15 insertions(+), 3 deletions(-)
> 
> diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
> index 50f99e7..e94cf30 100644
> --- a/net/mac80211/rx.c
> +++ b/net/mac80211/rx.c
> @@ -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;
>  }
> @@ -880,6 +882,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);
> @@ -890,6 +893,10 @@ 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_AP) &&
> +	    (sdata->type != IEEE80211_IF_TYPE_VLAN))
> +		return TXRX_DROP;
> +
>  	skb = skb_dequeue(&rx->sta->tx_filtered);
>  	if (!skb) {
>  		skb = skb_dequeue(&rx->sta->ps_tx_buf);
> diff --git a/net/mac80211/util.c b/net/mac80211/util.c
> index 7b278e9..fb7fd89 100644
> --- a/net/mac80211/util.c
> +++ b/net/mac80211/util.c
> @@ -135,13 +135,16 @@ u8 *ieee80211_get_bssid(struct ieee80211_hdr *hdr, size_t len)
>  {
>  	u16 fc;
>  
> -	if (len < 24)
> +	 /* drop ACK/CTS frames and incorrect hdr len (ctrl) */
> +	if (len < 16)
>  		return NULL;
>  
>  	fc = le16_to_cpu(hdr->frame_control);
>  
>  	switch (fc & IEEE80211_FCTL_FTYPE) {
>  	case IEEE80211_FTYPE_DATA:
> +		if (len < 24) /* drop incorrect hdr len (data) */
> +			return NULL;
>  		switch (fc & (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) {
>  		case IEEE80211_FCTL_TODS:
>  			return hdr->addr1;
> @@ -154,6 +157,8 @@ u8 *ieee80211_get_bssid(struct ieee80211_hdr *hdr, size_t len)
>  		}
>  		break;
>  	case IEEE80211_FTYPE_MGMT:
> +		if (len < 24) /* drop incorrect hdr len (mgmt) */
> +			return NULL;
>  		return hdr->addr3;
>  	case IEEE80211_FTYPE_CTL:
>  		if ((fc & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_PSPOLL)

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2007-12-18 15:26 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-09 12:33 [PATCH 1/1] mac80211: pass in PS_POLL frames Ron Rindjunsky
2007-12-10  4:05 ` Michael Wu
2007-12-10  4:59 ` Jouni Malinen
2007-12-10  8:19   ` Ron Rindjunsky
  -- strict thread matches above, loose matches on Subject: below --
2007-12-10  9:16 Ron Rindjunsky
2007-12-10 12:08 ` Johannes Berg
2007-12-10 12:17   ` Tomas Winkler
2007-12-17 15:00 ` Ron Rindjunsky
2007-12-17 17:46 ` Johannes Berg
2007-12-18  9:24   ` Ron Rindjunsky
2007-12-18 12:39     ` Johannes Berg
2007-12-18 15:00       ` Rindjunsky, Ron
2007-12-18 15:23 Ron Rindjunsky
2007-12-18 15:26 ` Johannes Berg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).