linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: John Linville <linville@tuxdriver.com>
Cc: linux-wireless@vger.kernel.org, "Blaž Bačnik" <bacnik@gmail.com>
Subject: [PATCH v2 2.6.32] mac80211: fix vlan and optimise RX
Date: Thu, 01 Oct 2009 22:06:29 +0200	[thread overview]
Message-ID: <1254427589.3959.38.camel@johannes.local> (raw)
In-Reply-To: <1254341893.3959.13.camel@johannes.local>

When receiving data frames, we can send them only to
the interface they belong to based on transmitting
station (this doesn't work for probe requests). Also,
don't try to handle other frames for AP_VLAN at all
since those interface should only receive data.

Additionally, the transmit side must check that the
station we're sending a frame to is actually on the
interface we're transmitting on, and not transmit
packets to functions that live on other interfaces,
so validate that as well.

Another bug fix is needed in sta_info.c where in the
VLAN case when adding/removing stations we overwrite
the sdata variable we still need.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Cc: stable@kernel.org
---
 net/mac80211/rx.c       |   10 ++++++++--
 net/mac80211/sta_info.c |    2 ++
 net/mac80211/tx.c       |    3 ++-
 3 files changed, 12 insertions(+), 3 deletions(-)

--- wireless-testing.orig/net/mac80211/rx.c	2009-09-30 21:38:59.000000000 +0200
+++ wireless-testing/net/mac80211/rx.c	2009-09-30 22:09:54.000000000 +0200
@@ -2164,11 +2164,17 @@ static void __ieee80211_rx_handle_packet
 
 	skb = rx.skb;
 
-	list_for_each_entry_rcu(sdata, &local->interfaces, list) {
+	if (rx.sdata && ieee80211_is_data(hdr->frame_control)) {
+		rx.flags |= IEEE80211_RX_RA_MATCH;
+		prepares = prepare_for_handlers(rx.sdata, &rx, hdr);
+		if (prepares)
+			prev = rx.sdata;
+	} else list_for_each_entry_rcu(sdata, &local->interfaces, list) {
 		if (!netif_running(sdata->dev))
 			continue;
 
-		if (sdata->vif.type == NL80211_IFTYPE_MONITOR)
+		if (sdata->vif.type == NL80211_IFTYPE_MONITOR ||
+		    sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
 			continue;
 
 		rx.flags |= IEEE80211_RX_RA_MATCH;
--- wireless-testing.orig/net/mac80211/tx.c	2009-09-30 21:49:34.000000000 +0200
+++ wireless-testing/net/mac80211/tx.c	2009-09-30 22:04:25.000000000 +0200
@@ -1704,7 +1704,8 @@ netdev_tx_t ieee80211_subif_start_xmit(s
 	if (!is_multicast_ether_addr(hdr.addr1)) {
 		rcu_read_lock();
 		sta = sta_info_get(local, hdr.addr1);
-		if (sta)
+		/* XXX: in the future, use sdata to look up the sta */
+		if (sta && sta->sdata == sdata)
 			sta_flags = get_sta_flags(sta);
 		rcu_read_unlock();
 	}
--- wireless-testing.orig/net/mac80211/sta_info.c	2009-10-01 21:59:00.000000000 +0200
+++ wireless-testing/net/mac80211/sta_info.c	2009-10-01 22:05:00.000000000 +0200
@@ -361,6 +361,7 @@ int sta_info_insert(struct sta_info *sta
 					     u.ap);
 
 		drv_sta_notify(local, &sdata->vif, STA_NOTIFY_ADD, &sta->sta);
+		sdata = sta->sdata;
 	}
 
 #ifdef CONFIG_MAC80211_VERBOSE_DEBUG
@@ -496,6 +497,7 @@ static void __sta_info_unlink(struct sta
 
 		drv_sta_notify(local, &sdata->vif, STA_NOTIFY_REMOVE,
 			       &(*sta)->sta);
+		sdata = (*sta)->sdata;
 	}
 
 	if (ieee80211_vif_is_mesh(&sdata->vif)) {



  reply	other threads:[~2009-10-01 20:06 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-30  0:54 VLAN traffic appearing on the wrong iface Blaž Bačnik
2009-09-30 17:51 ` Jouni Malinen
2009-09-30 20:16 ` Johannes Berg
2009-09-30 20:18   ` [PATCH 2.6.32] mac80211: fix vlan and optimise RX Johannes Berg
2009-10-01 20:06     ` Johannes Berg [this message]
2009-10-01 14:32   ` VLAN traffic appearing on the wrong iface Blaž Bačnik
2009-10-01 14:40     ` Blaž Bačnik
2009-10-01 18:39       ` Johannes Berg
2009-10-01 19:55         ` Blaž Bačnik
2009-10-01 20:02           ` Johannes Berg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1254427589.3959.38.camel@johannes.local \
    --to=johannes@sipsolutions.net \
    --cc=bacnik@gmail.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).