diff mbox series

[wpan-next,v4,01/11] ieee802154: Let PAN IDs be reset

Message ID 20230922155029.592018-2-miquel.raynal@bootlin.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series ieee802154: Associations between devices | expand

Checks

Context Check Description
netdev/series_format warning Target tree name not specified in the subject
netdev/tree_selection success Guessed tree name to be net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 1340 this patch: 1340
netdev/cc_maintainers success CCed 9 of 9 maintainers
netdev/build_clang success Errors and warnings before: 1363 this patch: 1363
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 1363 this patch: 1363
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 16 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Miquel Raynal Sept. 22, 2023, 3:50 p.m. UTC
Soon association and disassociation will be implemented, which will
require to be able to either change the PAN ID from 0xFFFF to a real
value when association succeeded, or to reset the PAN ID to 0xFFFF upon
disassociation. Let's allow to do that manually for now.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
 net/ieee802154/nl802154.c | 10 ----------
 1 file changed, 10 deletions(-)

Comments

Alexander Aring Sept. 24, 2023, 8:42 p.m. UTC | #1
Hi,

On Fri, Sep 22, 2023 at 11:50 AM Miquel Raynal
<miquel.raynal@bootlin.com> wrote:
>
> Soon association and disassociation will be implemented, which will
> require to be able to either change the PAN ID from 0xFFFF to a real
> value when association succeeded, or to reset the PAN ID to 0xFFFF upon
> disassociation. Let's allow to do that manually for now.
>

ok. But keep in mind what happens when a device is associated and the
user sets a short address manually to 0xFFFF?

It should be a kind of forced mode of disassociation?

- Alex
Miquel Raynal Sept. 25, 2023, 7:34 a.m. UTC | #2
Hi Alexander,

aahringo@redhat.com wrote on Sun, 24 Sep 2023 16:42:31 -0400:

> Hi,
> 
> On Fri, Sep 22, 2023 at 11:50 AM Miquel Raynal
> <miquel.raynal@bootlin.com> wrote:
> >
> > Soon association and disassociation will be implemented, which will
> > require to be able to either change the PAN ID from 0xFFFF to a real
> > value when association succeeded, or to reset the PAN ID to 0xFFFF upon
> > disassociation. Let's allow to do that manually for now.
> >  
> 
> ok. But keep in mind what happens when a device is associated and the
> user sets a short address manually to 0xFFFF?
> 
> It should be a kind of forced mode of disassociation?

I believe once you start interacting with other devices with proper
associations, random user requests cannot all be addressed, in
particular once you are officially associated with another device, you
cannot change your own short address or PAN ID like that. So in the
right next series (after this one) I have a couple of small
additions through the tree to handle this kind of corner case. Here
is how it will look like in nl802154.c:

nl802154_set_short_addr():

        /* The short address only has a meaning when part of a PAN, after a
         * proper association procedure. However, we want to still offer the
         * possibility to create static networks so changing the short address
         * is only allowed when not already associated to other devices with
         * the official handshake.
         */
        if (cfg802154_device_is_associated(wpan_dev)) {
                NL_SET_ERR_MSG(info->extack,
                               "Existing associations, changing short address forbidden");
                return -EINVAL;
        }

nl802154_set_pan_id():

        /* Only allow changing the PAN ID when the device has no more
         * associations ongoing to avoid confusing peers.
         */
        if (cfg802154_device_is_associated(wpan_dev)) {
                NL_SET_ERR_MSG(info->extack,
                               "Existing associations, changing PAN ID forbidden");
                return -EINVAL;
        }

I did not want to bloat this series with too much corner case handling,
so there are a couple of "misc additions" in the next series to handle
exactly that.

Thanks,
Miquèl
diff mbox series

Patch

diff --git a/net/ieee802154/nl802154.c b/net/ieee802154/nl802154.c
index d610c1886160..46ac6f599fe1 100644
--- a/net/ieee802154/nl802154.c
+++ b/net/ieee802154/nl802154.c
@@ -1087,16 +1087,6 @@  static int nl802154_set_pan_id(struct sk_buff *skb, struct genl_info *info)
 
 	pan_id = nla_get_le16(info->attrs[NL802154_ATTR_PAN_ID]);
 
-	/* TODO
-	 * I am not sure about to check here on broadcast pan_id.
-	 * Broadcast is a valid setting, comment from 802.15.4:
-	 * If this value is 0xffff, the device is not associated.
-	 *
-	 * This could useful to simple deassociate an device.
-	 */
-	if (pan_id == cpu_to_le16(IEEE802154_PAN_ID_BROADCAST))
-		return -EINVAL;
-
 	return rdev_set_pan_id(rdev, wpan_dev, pan_id);
 }