diff options
author | Miquel Raynal <miquel.raynal@bootlin.com> | 2023-09-27 21:12:07 +0300 |
---|---|---|
committer | Miquel Raynal <miquel.raynal@bootlin.com> | 2023-11-20 13:42:39 +0300 |
commit | fefd19807fe9c65002366c749e809996a1ca4e68 (patch) | |
tree | dd8047899c6d50583da8d0d0ae3e32f92c57f4c0 /net/ieee802154/core.c | |
parent | 05db59a0619969a47ab87050985344177c662cab (diff) | |
download | linux-fefd19807fe9c65002366c749e809996a1ca4e68.tar.xz |
mac802154: Handle associating
Joining a PAN officially goes by associating with a coordinator. This
coordinator may have been discovered thanks to the beacons it sent in
the past. Add support to the MAC layer for these associations, which
require:
- Sending an association request
- Receiving an association response
The association response contains the association status, eventually a
reason if the association was unsuccessful, and finally a short address
that we should use for intra-PAN communication from now on, if we
required one (which is the default, and not yet configurable).
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Acked-by: Stefan Schmidt <stefan@datenfreihafen.org>
Acked-by: Alexander Aring <aahringo@redhat.com>
Link: https://lore.kernel.org/linux-wpan/20230927181214.129346-5-miquel.raynal@bootlin.com
Diffstat (limited to 'net/ieee802154/core.c')
-rw-r--r-- | net/ieee802154/core.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/net/ieee802154/core.c b/net/ieee802154/core.c index cd69bdbfd59f..a08d75dd56ad 100644 --- a/net/ieee802154/core.c +++ b/net/ieee802154/core.c @@ -198,6 +198,16 @@ void wpan_phy_free(struct wpan_phy *phy) } EXPORT_SYMBOL(wpan_phy_free); +static void cfg802154_free_peer_structures(struct wpan_dev *wpan_dev) +{ + mutex_lock(&wpan_dev->association_lock); + + kfree(wpan_dev->parent); + wpan_dev->parent = NULL; + + mutex_unlock(&wpan_dev->association_lock); +} + int cfg802154_switch_netns(struct cfg802154_registered_device *rdev, struct net *net) { @@ -293,6 +303,8 @@ static int cfg802154_netdev_notifier_call(struct notifier_block *nb, rdev->opencount++; break; case NETDEV_UNREGISTER: + cfg802154_free_peer_structures(wpan_dev); + /* It is possible to get NETDEV_UNREGISTER * multiple times. To detect that, check * that the interface is still on the list |