aboutsummaryrefslogtreecommitdiffstats
path: root/net/ieee802154/nl802154.c
diff options
context:
space:
mode:
authorAlexander Aring <alex.aring@gmail.com>2014-11-17 02:20:52 -0500
committerMarcel Holtmann <marcel@holtmann.org>2014-11-17 03:49:16 -0500
commit0e57547eb7f0aa99aba32b50c49dbd722a80d6fb (patch)
treeca66721d651bfa5ca441546976a83dc2b88af86b /net/ieee802154/nl802154.c
parentf3ea5e44231a88eaea69a13410d1b80c19cfa1df (diff)
ieee802154: setting extended address while iface add
This patch adds support for setting an extended address while registration a new interface. If ieee802154_is_valid_extended_addr getting as parameter and invalid extended address then the perm address is fallback. This is useful to make some default handling while for example default registration of a wpan interface while phy registration. Signed-off-by: Alexander Aring <alex.aring@gmail.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/ieee802154/nl802154.c')
-rw-r--r--net/ieee802154/nl802154.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/net/ieee802154/nl802154.c b/net/ieee802154/nl802154.c
index e7224f3c1584..49c4d8a5004a 100644
--- a/net/ieee802154/nl802154.c
+++ b/net/ieee802154/nl802154.c
@@ -555,6 +555,7 @@ static int nl802154_new_interface(struct sk_buff *skb, struct genl_info *info)
555{ 555{
556 struct cfg802154_registered_device *rdev = info->user_ptr[0]; 556 struct cfg802154_registered_device *rdev = info->user_ptr[0];
557 enum nl802154_iftype type = NL802154_IFTYPE_UNSPEC; 557 enum nl802154_iftype type = NL802154_IFTYPE_UNSPEC;
558 __le64 extended_addr = cpu_to_le64(0x0000000000000000ULL);
558 559
559 /* TODO avoid failing a new interface 560 /* TODO avoid failing a new interface
560 * creation due to pending removal? 561 * creation due to pending removal?
@@ -569,12 +570,17 @@ static int nl802154_new_interface(struct sk_buff *skb, struct genl_info *info)
569 return -EINVAL; 570 return -EINVAL;
570 } 571 }
571 572
573 /* TODO add nla_get_le64 to netlink */
574 if (info->attrs[NL802154_ATTR_EXTENDED_ADDR])
575 extended_addr = (__force __le64)nla_get_u64(
576 info->attrs[NL802154_ATTR_EXTENDED_ADDR]);
577
572 if (!rdev->ops->add_virtual_intf) 578 if (!rdev->ops->add_virtual_intf)
573 return -EOPNOTSUPP; 579 return -EOPNOTSUPP;
574 580
575 return rdev_add_virtual_intf(rdev, 581 return rdev_add_virtual_intf(rdev,
576 nla_data(info->attrs[NL802154_ATTR_IFNAME]), 582 nla_data(info->attrs[NL802154_ATTR_IFNAME]),
577 type); 583 type, extended_addr);
578} 584}
579 585
580static int nl802154_set_channel(struct sk_buff *skb, struct genl_info *info) 586static int nl802154_set_channel(struct sk_buff *skb, struct genl_info *info)