Commit 9b0bb4a8 authored by Phoebe Buckheister's avatar Phoebe Buckheister Committed by David S. Miller

mac802154: propagate device address changes to llsec

Signed-off-by: default avatarPhoebe Buckheister <phoebe.buckheister@itwm.fraunhofer.de>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 29e02374
...@@ -40,6 +40,9 @@ static int mac802154_mlme_start_req(struct net_device *dev, ...@@ -40,6 +40,9 @@ static int mac802154_mlme_start_req(struct net_device *dev,
u8 pan_coord, u8 blx, u8 pan_coord, u8 blx,
u8 coord_realign) u8 coord_realign)
{ {
struct ieee802154_mlme_ops *ops = ieee802154_mlme_ops(dev);
int rc = 0;
BUG_ON(addr->mode != IEEE802154_ADDR_SHORT); BUG_ON(addr->mode != IEEE802154_ADDR_SHORT);
mac802154_dev_set_pan_id(dev, addr->pan_id); mac802154_dev_set_pan_id(dev, addr->pan_id);
...@@ -47,12 +50,31 @@ static int mac802154_mlme_start_req(struct net_device *dev, ...@@ -47,12 +50,31 @@ static int mac802154_mlme_start_req(struct net_device *dev,
mac802154_dev_set_ieee_addr(dev); mac802154_dev_set_ieee_addr(dev);
mac802154_dev_set_page_channel(dev, page, channel); mac802154_dev_set_page_channel(dev, page, channel);
if (ops->llsec) {
struct ieee802154_llsec_params params;
int changed = 0;
params.coord_shortaddr = addr->short_addr;
changed |= IEEE802154_LLSEC_PARAM_COORD_SHORTADDR;
params.pan_id = addr->pan_id;
changed |= IEEE802154_LLSEC_PARAM_PAN_ID;
params.hwaddr = ieee802154_devaddr_from_raw(dev->dev_addr);
changed |= IEEE802154_LLSEC_PARAM_HWADDR;
params.coord_hwaddr = params.hwaddr;
changed |= IEEE802154_LLSEC_PARAM_COORD_HWADDR;
rc = ops->llsec->set_params(dev, &params, changed);
}
/* FIXME: add validation for unused parameters to be sane /* FIXME: add validation for unused parameters to be sane
* for SoftMAC * for SoftMAC
*/ */
ieee802154_nl_start_confirm(dev, IEEE802154_SUCCESS); ieee802154_nl_start_confirm(dev, IEEE802154_SUCCESS);
return 0; return rc;
} }
static struct wpan_phy *mac802154_get_phy(const struct net_device *dev) static struct wpan_phy *mac802154_get_phy(const struct net_device *dev)
......
...@@ -35,6 +35,28 @@ ...@@ -35,6 +35,28 @@
#include "mac802154.h" #include "mac802154.h"
static int mac802154_wpan_update_llsec(struct net_device *dev)
{
struct mac802154_sub_if_data *priv = netdev_priv(dev);
struct ieee802154_mlme_ops *ops = ieee802154_mlme_ops(dev);
int rc = 0;
if (ops->llsec) {
struct ieee802154_llsec_params params;
int changed = 0;
params.pan_id = priv->pan_id;
changed |= IEEE802154_LLSEC_PARAM_PAN_ID;
params.hwaddr = priv->extended_addr;
changed |= IEEE802154_LLSEC_PARAM_HWADDR;
rc = ops->llsec->set_params(dev, &params, changed);
}
return rc;
}
static int static int
mac802154_wpan_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) mac802154_wpan_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
{ {
...@@ -81,7 +103,7 @@ mac802154_wpan_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) ...@@ -81,7 +103,7 @@ mac802154_wpan_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
priv->pan_id = cpu_to_le16(sa->addr.pan_id); priv->pan_id = cpu_to_le16(sa->addr.pan_id);
priv->short_addr = cpu_to_le16(sa->addr.short_addr); priv->short_addr = cpu_to_le16(sa->addr.short_addr);
err = 0; err = mac802154_wpan_update_llsec(dev);
break; break;
} }
...@@ -99,7 +121,7 @@ static int mac802154_wpan_mac_addr(struct net_device *dev, void *p) ...@@ -99,7 +121,7 @@ static int mac802154_wpan_mac_addr(struct net_device *dev, void *p)
/* FIXME: validate addr */ /* FIXME: validate addr */
memcpy(dev->dev_addr, addr->sa_data, dev->addr_len); memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
mac802154_dev_set_ieee_addr(dev); mac802154_dev_set_ieee_addr(dev);
return 0; return mac802154_wpan_update_llsec(dev);
} }
int mac802154_set_mac_params(struct net_device *dev, int mac802154_set_mac_params(struct net_device *dev,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment