linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Alessandro Lannocca" <alessandro.lannocca@gmail.com>
To: "'Helmut Schaa'" <helmut.schaa@googlemail.com>
Cc: <linux-wireless@vger.kernel.org>
Subject: R: [PATCH] mac80211: Allow single vif mac address change with addr_mask
Date: Tue, 21 May 2013 17:51:38 +0200	[thread overview]
Message-ID: <000d01ce563b$15810800$40831800$@gmail.com> (raw)
In-Reply-To: <1369140893-22622-1-git-send-email-helmut.schaa@googlemail.com>

Tested right now against compat-drivers-2013-03-28-5-u and I can confirm it
works.

Thank you for your effort!

Alessandro Lannocca

-----Messaggio originale-----
Da: Helmut Schaa [mailto:helmut.schaa@googlemail.com] 
Inviato: martedì 21 maggio 2013 14.55
A: linux-wireless@vger.kernel.org
Cc: johannes@sipsolutions.net; IvDoorn@gmail.com; gwingerde@gmail.com;
stf_xl@wp.pl; Helmut Schaa; Alessandro Lannocca; Bruno Randolf
Oggetto: [PATCH] mac80211: Allow single vif mac address change with
addr_mask

When changing the MAC address of a single vif mac80211 will check if the new
address fits into the address mask specified by the driver. This only needs
to be done when using multiple BSSIDs. Hence, check the new address only
against all other vifs.

Resolves:
https://bugzilla.kernel.org/show_bug.cgi?id=57371

Reported-by: Alessandro Lannocca <alessandro.lannocca@gmail.com>
Cc: Alessandro Lannocca <alessandro.lannocca@gmail.com>
Cc: Bruno Randolf <br1@thinktube.com>
Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
---
 net/mac80211/iface.c |   16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c index
60f1ce5..c1a8c79 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -159,9 +159,10 @@ static int ieee80211_change_mtu(struct net_device *dev,
int new_mtu)
 	return 0;
 }
 
-static int ieee80211_verify_mac(struct ieee80211_local *local, u8 *addr)
+static int ieee80211_verify_mac(struct ieee80211_sub_if_data *sdata, u8 
+*addr)
 {
-	struct ieee80211_sub_if_data *sdata;
+	struct ieee80211_local *local = sdata->local;
+	struct ieee80211_sub_if_data *iter;
 	u64 new, mask, tmp;
 	u8 *m;
 	int ret = 0;
@@ -181,11 +182,14 @@ static int ieee80211_verify_mac(struct ieee80211_local
*local, u8 *addr)
 
 
 	mutex_lock(&local->iflist_mtx);
-	list_for_each_entry(sdata, &local->interfaces, list) {
-		if (sdata->vif.type == NL80211_IFTYPE_MONITOR)
+	list_for_each_entry(iter, &local->interfaces, list) {
+		if (iter == sdata)
+			continue;
+
+		if (iter->vif.type == NL80211_IFTYPE_MONITOR)
 			continue;
 
-		m = sdata->vif.addr;
+		m = iter->vif.addr;
 		tmp =	((u64)m[0] << 5*8) | ((u64)m[1] << 4*8) |
 			((u64)m[2] << 3*8) | ((u64)m[3] << 2*8) |
 			((u64)m[4] << 1*8) | ((u64)m[5] << 0*8); @@ -209,7
+213,7 @@ static int ieee80211_change_mac(struct net_device *dev, void
*addr)
 	if (ieee80211_sdata_running(sdata))
 		return -EBUSY;
 
-	ret = ieee80211_verify_mac(sdata->local, sa->sa_data);
+	ret = ieee80211_verify_mac(sdata, sa->sa_data);
 	if (ret)
 		return ret;
 
--
1.7.10.4



  parent reply	other threads:[~2013-05-21 15:51 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-21 12:54 [PATCH] mac80211: Allow single vif mac address change with addr_mask Helmut Schaa
2013-05-21 15:10 ` Jakub Kiciński
2013-05-22  8:06   ` Helmut Schaa
2013-05-22 12:42     ` Jakub Kiciński
2013-05-23 13:32       ` Helmut Schaa
2013-05-21 15:51 ` Alessandro Lannocca [this message]
2013-05-27  8:43 ` [PATCHv2] " Helmut Schaa
2013-05-27  8:55   ` 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='000d01ce563b$15810800$40831800$@gmail.com' \
    --to=alessandro.lannocca@gmail.com \
    --cc=helmut.schaa@googlemail.com \
    --cc=linux-wireless@vger.kernel.org \
    /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).