Linux IEEE 802.15.4 and 6LoWPAN development
 help / color / mirror / Atom feed
From: Alexander Aring <alex.aring@gmail.com>
To: linux-wpan@vger.kernel.org
Cc: Alexander Aring <alex.aring@gmail.com>
Subject: [PATCH bluetooth-next 2/2] mac802154: fix wpan mac setting while lowpan
Date: Fri, 24 Jul 2015 15:01:45 +0200	[thread overview]
Message-ID: <1437742905-5921-3-git-send-email-alex.aring@gmail.com> (raw)
In-Reply-To: <1437742905-5921-1-git-send-email-alex.aring@gmail.com>

If we currently change the mac address inside the wpan interface while
we have a lowpan interface on top of the wpan interface, the mac address
setting doesn't reach the lowpan interface. The effect would be that the
IPv6 lowpan interface has the old SLAAC address and isn't working
anymore because the lowpan interface use in internal mechanism sometimes
dev->addr which is the old mac address of the wpan interface.

This patch checks if a wpan interface belongs to lowpan interface, if
yes then we need to check if the lowpan interface is down and change the
mac address also at the lowpan interface. When the lowpan interface will
be set up afterwards, it will use the correct SLAAC address which based
on the updated mac address setting.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
---
 net/mac802154/iface.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/net/mac802154/iface.c b/net/mac802154/iface.c
index 416de90..346c160 100644
--- a/net/mac802154/iface.c
+++ b/net/mac802154/iface.c
@@ -132,6 +132,20 @@ static int mac802154_wpan_mac_addr(struct net_device *dev, void *p)
 	memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
 	sdata->wpan_dev.extended_addr = extended_addr;
 
+	/* update lowpan interface mac address when
+	 * wpan mac has been changed
+	 */
+	if (sdata->wpan_dev.lowpan_dev) {
+		/* lowpan need to be down for update
+		 * SLAAC address after ifup
+		 */
+		if (netif_running(sdata->wpan_dev.lowpan_dev))
+			return -EBUSY;
+
+		memcpy(sdata->wpan_dev.lowpan_dev->dev_addr, dev->dev_addr,
+		       dev->addr_len);
+	}
+
 	return mac802154_wpan_update_llsec(dev);
 }
 
-- 
2.4.6


  parent reply	other threads:[~2015-07-24 13:01 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-24 13:01 [PATCH bluetooth-next 0/2] ieee802154: multiple lowpan interface support and fix mac setting Alexander Aring
2015-07-24 13:01 ` [PATCH bluetooth-next 1/2] ieee802154: 6lowpan: remove multiple lowpan support Alexander Aring
2015-07-30 16:15   ` Stefan Schmidt
2015-07-30 22:53     ` Alexander Aring
2015-07-24 13:01 ` Alexander Aring [this message]
2015-07-30 16:17   ` [PATCH bluetooth-next 2/2] mac802154: fix wpan mac setting while lowpan Stefan Schmidt
2015-07-30 22:52     ` Alexander Aring
2015-07-31  8:54       ` Stefan Schmidt
2015-07-24 15:01 ` [PATCH bluetooth-next 0/2] ieee802154: multiple lowpan interface support and fix mac setting Stefan Schmidt
2015-07-24 15:10   ` Alexander Aring
2015-07-24 16:29     ` Stefan Schmidt

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=1437742905-5921-3-git-send-email-alex.aring@gmail.com \
    --to=alex.aring@gmail.com \
    --cc=linux-wpan@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