2013-10-06 03:15:31

by Alan Ott

[permalink] [raw]
Subject: [PATCH v2 0/2] 6lowpan default hardware address

Alexander Aring suggested that devices desired to be linked to 6lowpan
be checked for actually being of type IEEE802154, since IEEE802154 devices
are all that are supported by 6lowpan at present.

Alan Ott (2):
6lowpan: Only make 6lowpan links to IEEE802154 devices
6lowpan: Sync default hardware address of lowpan links to their wpan

net/ieee802154/6lowpan.c | 5 +++++
1 file changed, 5 insertions(+)

--
1.8.1.2


2013-10-06 03:15:54

by Alan Ott

[permalink] [raw]
Subject: [PATCH v2 1/2] 6lowpan: Only make 6lowpan links to IEEE802154 devices

Refuse to create 6lowpan links if the actual hardware interface is
of any type other than ARPHRD_IEEE802154.

Signed-off-by: Alan Ott <[email protected]>
Suggested-by: Alexander Aring <[email protected]>
---
net/ieee802154/6lowpan.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/net/ieee802154/6lowpan.c b/net/ieee802154/6lowpan.c
index c85e71e..8f56b2b 100644
--- a/net/ieee802154/6lowpan.c
+++ b/net/ieee802154/6lowpan.c
@@ -1372,6 +1372,8 @@ static int lowpan_newlink(struct net *src_net, struct net_device *dev,
real_dev = dev_get_by_index(src_net, nla_get_u32(tb[IFLA_LINK]));
if (!real_dev)
return -ENODEV;
+ if (real_dev->type != ARPHRD_IEEE802154)
+ return -EINVAL;

lowpan_dev_info(dev)->real_dev = real_dev;
lowpan_dev_info(dev)->fragment_tag = 0;
--
1.8.1.2

2013-10-06 03:16:00

by Alan Ott

[permalink] [raw]
Subject: [PATCH v2 2/2] 6lowpan: Sync default hardware address of lowpan links to their wpan

When a lowpan link to a wpan device is created, set the hardware address
of the lowpan link to that of the wpan device.

Signed-off-by: Alan Ott <[email protected]>
---
net/ieee802154/6lowpan.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/net/ieee802154/6lowpan.c b/net/ieee802154/6lowpan.c
index 8f56b2b..ff41b4d 100644
--- a/net/ieee802154/6lowpan.c
+++ b/net/ieee802154/6lowpan.c
@@ -1388,6 +1388,9 @@ static int lowpan_newlink(struct net *src_net, struct net_device *dev,

entry->ldev = dev;

+ /* Set the lowpan harware address to the wpan hardware address. */
+ memcpy(dev->dev_addr, real_dev->dev_addr, IEEE802154_ADDR_LEN);
+
mutex_lock(&lowpan_dev_info(dev)->dev_list_mtx);
INIT_LIST_HEAD(&entry->list);
list_add_tail(&entry->list, &lowpan_devices);
--
1.8.1.2

2013-10-08 19:29:16

by David Miller

[permalink] [raw]
Subject: Re: [PATCH v2 0/2] 6lowpan default hardware address

From: Alan Ott <[email protected]>
Date: Sat, 5 Oct 2013 23:15:17 -0400

> Alexander Aring suggested that devices desired to be linked to 6lowpan
> be checked for actually being of type IEEE802154, since IEEE802154 devices
> are all that are supported by 6lowpan at present.
>
> Alan Ott (2):
> 6lowpan: Only make 6lowpan links to IEEE802154 devices
> 6lowpan: Sync default hardware address of lowpan links to their wpan

Series applied, thanks Alan.