net: ieee802154: Handle disassocation notification from PAN coordinator
PAN coordinator can decide to eject a client device from the PAN by disassocating it. Change-Id: Ia868554d40a7aceb4c75a0b426db45f56003fbb7 Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
This commit is contained in:
parent
820713239a
commit
5d0503fa30
1 changed files with 25 additions and 9 deletions
|
@ -200,19 +200,35 @@ enum net_verdict ieee802154_handle_mac_command(struct net_if *iface,
|
||||||
{
|
{
|
||||||
struct ieee802154_context *ctx = net_if_l2_data(iface);
|
struct ieee802154_context *ctx = net_if_l2_data(iface);
|
||||||
|
|
||||||
if (mpdu->command->cfi != IEEE802154_CFI_ASSOCIATION_RESPONSE) {
|
if (mpdu->command->cfi == IEEE802154_CFI_ASSOCIATION_RESPONSE) {
|
||||||
return NET_DROP;
|
if (mpdu->command->assoc_res.status !=
|
||||||
|
IEEE802154_ASF_SUCCESSFUL) {
|
||||||
|
return NET_DROP;
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx->associated = true;
|
||||||
|
k_sem_give(&ctx->req_lock);
|
||||||
|
|
||||||
|
return NET_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mpdu->command->assoc_res.status != IEEE802154_ASF_SUCCESSFUL) {
|
if (mpdu->command->cfi == IEEE802154_CFI_DISASSOCIATION_NOTIFICATION) {
|
||||||
return NET_DROP;
|
if (mpdu->command->disassoc_note.reason !=
|
||||||
|
IEEE802154_DRF_COORDINATOR_WISH) {
|
||||||
|
return NET_DROP;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ctx->associated) {
|
||||||
|
/* ToDo: check src address vs coord ones and reject
|
||||||
|
* if they don't match
|
||||||
|
*/
|
||||||
|
ctx->associated = false;
|
||||||
|
|
||||||
|
return NET_OK;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx->associated = true;
|
return NET_DROP;
|
||||||
|
|
||||||
k_sem_give(&ctx->req_lock);
|
|
||||||
|
|
||||||
return NET_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ieee802154_associate(uint32_t mgmt_request, struct net_if *iface,
|
static int ieee802154_associate(uint32_t mgmt_request, struct net_if *iface,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue