aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorDmitry Baryshkov <dbaryshkov@gmail.com>2009-08-06 22:58:44 -0400
committerDavid S. Miller <davem@davemloft.net>2009-08-13 00:54:51 -0400
commitacb8aacda3f0bc3aeb652f4365c078a2b0adb0bf (patch)
tree1f80a689cce54e35bbecb807c3da8655e6c5f10b /net
parent99eb8558642b988055d2b8b16a334475550f78d3 (diff)
nl802154: support START-CONFIRM primitive
Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/ieee802154/netlink.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/net/ieee802154/netlink.c b/net/ieee802154/netlink.c
index 3fe02b394ad6..cd0567f06716 100644
--- a/net/ieee802154/netlink.c
+++ b/net/ieee802154/netlink.c
@@ -31,6 +31,7 @@
31#include <linux/nl802154.h> 31#include <linux/nl802154.h>
32#include <net/af_ieee802154.h> 32#include <net/af_ieee802154.h>
33#include <net/nl802154.h> 33#include <net/nl802154.h>
34#include <net/ieee802154.h>
34#include <net/ieee802154_netdev.h> 35#include <net/ieee802154_netdev.h>
35 36
36static unsigned int ieee802154_seq_num; 37static unsigned int ieee802154_seq_num;
@@ -262,6 +263,31 @@ nla_put_failure:
262} 263}
263EXPORT_SYMBOL(ieee802154_nl_scan_confirm); 264EXPORT_SYMBOL(ieee802154_nl_scan_confirm);
264 265
266int ieee802154_nl_start_confirm(struct net_device *dev, u8 status)
267{
268 struct sk_buff *msg;
269
270 pr_debug("%s\n", __func__);
271
272 msg = ieee802154_nl_create(0, IEEE802154_START_CONF);
273 if (!msg)
274 return -ENOBUFS;
275
276 NLA_PUT_STRING(msg, IEEE802154_ATTR_DEV_NAME, dev->name);
277 NLA_PUT_U32(msg, IEEE802154_ATTR_DEV_INDEX, dev->ifindex);
278 NLA_PUT(msg, IEEE802154_ATTR_HW_ADDR, IEEE802154_ADDR_LEN,
279 dev->dev_addr);
280
281 NLA_PUT_U8(msg, IEEE802154_ATTR_STATUS, status);
282
283 return ieee802154_nl_finish(msg);
284
285nla_put_failure:
286 nlmsg_free(msg);
287 return -ENOBUFS;
288}
289EXPORT_SYMBOL(ieee802154_nl_start_confirm);
290
265static int ieee802154_nl_fill_iface(struct sk_buff *msg, u32 pid, 291static int ieee802154_nl_fill_iface(struct sk_buff *msg, u32 pid,
266 u32 seq, int flags, struct net_device *dev) 292 u32 seq, int flags, struct net_device *dev)
267{ 293{
@@ -462,6 +488,12 @@ static int ieee802154_start_req(struct sk_buff *skb, struct genl_info *info)
462 blx = nla_get_u8(info->attrs[IEEE802154_ATTR_BAT_EXT]); 488 blx = nla_get_u8(info->attrs[IEEE802154_ATTR_BAT_EXT]);
463 coord_realign = nla_get_u8(info->attrs[IEEE802154_ATTR_COORD_REALIGN]); 489 coord_realign = nla_get_u8(info->attrs[IEEE802154_ATTR_COORD_REALIGN]);
464 490
491 if (addr.short_addr == IEEE802154_ADDR_BROADCAST) {
492 ieee802154_nl_start_confirm(dev, IEEE802154_NO_SHORT_ADDRESS);
493 dev_put(dev);
494 return -EINVAL;
495 }
496
465 ret = ieee802154_mlme_ops(dev)->start_req(dev, &addr, channel, 497 ret = ieee802154_mlme_ops(dev)->start_req(dev, &addr, channel,
466 bcn_ord, sf_ord, pan_coord, blx, coord_realign); 498 bcn_ord, sf_ord, pan_coord, blx, coord_realign);
467 499