From 31b35973e3811e5bef46374fc37e7c279ec1c2aa Mon Sep 17 00:00:00 2001 From: Miquel Raynal Date: Sun, 4 Sep 2022 16:06:50 +0200 Subject: [PATCH] net: l2: ieee802154: Change the hardware filters while associating During an association, the peer we are trying to connect to will send us an association response frame with the destination PAN ID set to the PAN ID we try to join. If we do not update the hardware address filters beforehands, it is likely that the hardware will just discard the response and the association will fail. Signed-off-by: Miquel Raynal --- subsys/net/l2/ieee802154/ieee802154_mgmt.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/subsys/net/l2/ieee802154/ieee802154_mgmt.c b/subsys/net/l2/ieee802154/ieee802154_mgmt.c index 51746a14b52..8915b738cd1 100644 --- a/subsys/net/l2/ieee802154/ieee802154_mgmt.c +++ b/subsys/net/l2/ieee802154/ieee802154_mgmt.c @@ -381,6 +381,8 @@ static int ieee802154_associate(uint32_t mgmt_request, struct net_if *iface, ieee802154_mac_cmd_finalize(pkt, IEEE802154_CFI_ASSOCIATION_REQUEST); + ieee802154_filter_pan_id(iface, req->pan_id); + if (net_if_send_data(iface, pkt)) { net_pkt_unref(pkt); ret = -EIO; @@ -432,6 +434,10 @@ static int ieee802154_associate(uint32_t mgmt_request, struct net_if *iface, } out: + if (ret < 0) { + ieee802154_filter_pan_id(iface, 0); + } + k_sem_give(&ctx->ctx_lock); return ret; }