From: Kalle Valo <kalle.valo@iki.fi>
To: linux-wireless@vger.kernel.org
Cc: Kalle Valo <kalle.valo@nokia.com>
Subject: [PATCH] mac80211: fix ieee80211_change_mac() to use struct sockaddr
Date: Wed, 30 Dec 2009 15:54:03 +0200 [thread overview]
Message-ID: <20091230135403.30935.72535.stgit@tikku> (raw)
From: Kalle Valo <kalle.valo@nokia.com>
Setting the mac address from user space was buggy. For example, when
executing this command:
ip link set wlan0 address 00:1f:df:88:cd:55
mac80211 used the address 01:00:00:1f:df:88 instead. It was shifted two
bytes.
The reason was that the addr (type of void *) provided to
ieee80211_change_mac() is actually of type struct sockaddr, not just the
mac address array. Also the call to eth_mac_addr() expects the address to
be struct sockaddr.
Signed-off-by: Kalle Valo <kalle.valo@nokia.com>
---
net/mac80211/iface.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
index 00a1f4c..7218966 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -63,15 +63,16 @@ static int ieee80211_change_mtu(struct net_device *dev, int new_mtu)
static int ieee80211_change_mac(struct net_device *dev, void *addr)
{
struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
+ struct sockaddr *sa = addr;
int ret;
if (ieee80211_sdata_running(sdata))
return -EBUSY;
- ret = eth_mac_addr(dev, addr);
+ ret = eth_mac_addr(dev, sa);
if (ret == 0)
- memcpy(sdata->vif.addr, addr, ETH_ALEN);
+ memcpy(sdata->vif.addr, sa->sa_data, ETH_ALEN);
return ret;
}
reply other threads:[~2009-12-30 13:54 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20091230135403.30935.72535.stgit@tikku \
--to=kalle.valo@iki.fi \
--cc=kalle.valo@nokia.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