diff --git a/drivers/ieee802154/Makefile b/drivers/ieee802154/Makefile index 68999137dedfe24cb7044d6de38b6e4f6f8193c5..800a3894af0dd72190f5ad0e3bdadc32111219a3 100644 --- a/drivers/ieee802154/Makefile +++ b/drivers/ieee802154/Makefile @@ -1,3 +1 @@ obj-$(CONFIG_IEEE802154_FAKEHARD) += fakehard.o - -ccflags-y := -DDEBUG -DCONFIG_FFD diff --git a/drivers/ieee802154/fakehard.c b/drivers/ieee802154/fakehard.c index a5a49a1baae7227ce754a9a10806fa61e1262346..eb0e2ccc79ae6c3098cdb065511b047218b0c6a0 100644 --- a/drivers/ieee802154/fakehard.c +++ b/drivers/ieee802154/fakehard.c @@ -370,8 +370,6 @@ static int __devinit ieee802154fake_probe(struct platform_device *pdev) return -ENOMEM; } - phy->dev.platform_data = dev; - memcpy(dev->dev_addr, "\xba\xbe\xca\xfe\xde\xad\xbe\xef", dev->addr_len); memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len); diff --git a/net/ieee802154/af_ieee802154.c b/net/ieee802154/af_ieee802154.c index 6df6ecf4970876b54ef16acac3a971fdaf1d333c..40e606f3788f11f5dcdeb59420ff18a4ec24eab1 100644 --- a/net/ieee802154/af_ieee802154.c +++ b/net/ieee802154/af_ieee802154.c @@ -302,7 +302,7 @@ static int ieee802154_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt, struct net_device *orig_dev) { if (!netif_running(dev)) - return -ENODEV; + goto drop; pr_debug("got frame, type %d, dev %p\n", dev->type, dev); #ifdef DEBUG print_hex_dump_bytes("ieee802154_rcv ", DUMP_PREFIX_NONE, skb->data, skb->len); diff --git a/net/ieee802154/dgram.c b/net/ieee802154/dgram.c index 1a3334c2609a194015eec5b6b85c943fccc1ca92..faecf648123f7bc9bf5ae7a3913c737a89ea4841 100644 --- a/net/ieee802154/dgram.c +++ b/net/ieee802154/dgram.c @@ -1,5 +1,5 @@ /* - * ZigBee socket interface + * IEEE 802.15.4 dgram socket interface * * Copyright 2007, 2008 Siemens AG * diff --git a/net/ieee802154/nl-phy.c b/net/ieee802154/nl-phy.c index 02548b292b53bf416f4e0ced8daeeb9e842666e3..c64a38d57aa36c4b521fd06c7a9c8c46bd0f337b 100644 --- a/net/ieee802154/nl-phy.c +++ b/net/ieee802154/nl-phy.c @@ -24,6 +24,7 @@ #include #include +#include #include #include #include @@ -213,12 +214,37 @@ static int ieee802154_add_iface(struct sk_buff *skb, goto nla_put_failure; } + if (info->attrs[IEEE802154_ATTR_HW_ADDR] && + nla_len(info->attrs[IEEE802154_ATTR_HW_ADDR]) != + IEEE802154_ADDR_LEN) { + rc = -EINVAL; + goto nla_put_failure; + } + dev = phy->add_iface(phy, devname); if (IS_ERR(dev)) { rc = PTR_ERR(dev); goto nla_put_failure; } + if (info->attrs[IEEE802154_ATTR_HW_ADDR]) { + struct sockaddr addr; + + addr.sa_family = ARPHRD_IEEE802154; + nla_memcpy(&addr.sa_data, info->attrs[IEEE802154_ATTR_HW_ADDR], + IEEE802154_ADDR_LEN); + + /* + * strangely enough, some callbacks (inetdev_event) from + * dev_set_mac_address require RTNL_LOCK + */ + rtnl_lock(); + rc = dev_set_mac_address(dev, &addr); + rtnl_unlock(); + if (rc) + goto dev_unregister; + } + NLA_PUT_STRING(msg, IEEE802154_ATTR_PHY_NAME, wpan_phy_name(phy)); NLA_PUT_STRING(msg, IEEE802154_ATTR_DEV_NAME, dev->name); @@ -228,6 +254,11 @@ static int ieee802154_add_iface(struct sk_buff *skb, return ieee802154_nl_reply(msg, info); +dev_unregister: + rtnl_lock(); /* del_iface must be called with RTNL lock */ + phy->del_iface(phy, dev); + dev_put(dev); + rtnl_unlock(); nla_put_failure: nlmsg_free(msg); out_dev: