diff mbox series

[wpan-next,3/5] mac802154: Only allow PAN controllers to process association requests

Message ID 20231128111655.507479-4-miquel.raynal@bootlin.com (mailing list archive)
State Accepted
Headers show
Series ieee802154: Association tweaks | expand

Commit Message

Miquel Raynal Nov. 28, 2023, 11:16 a.m. UTC
It is not very clear in the specification whether simple coordinators
are allowed or not to answer to association requests themselves. As
there is no synchronization mechanism, it is probably best to rely on
the relay feature of these coordinators and avoid processing them in
this case.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
 net/mac802154/scan.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Stefan Schmidt Dec. 7, 2023, 8:45 p.m. UTC | #1
Hello.

On 28.11.23 12:16, Miquel Raynal wrote:
> It is not very clear in the specification whether simple coordinators
> are allowed or not to answer to association requests themselves. As
> there is no synchronization mechanism, it is probably best to rely on
> the relay feature of these coordinators and avoid processing them in
> this case.
> 
> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
> ---
>   net/mac802154/scan.c | 6 ++++++
>   1 file changed, 6 insertions(+)
> 
> diff --git a/net/mac802154/scan.c b/net/mac802154/scan.c
> index 5873da634fb4..1c0eeaa76560 100644
> --- a/net/mac802154/scan.c
> +++ b/net/mac802154/scan.c
> @@ -781,6 +781,12 @@ int mac802154_process_association_req(struct ieee802154_sub_if_data *sdata,
>   		 unlikely(dest->short_addr != wpan_dev->short_addr))
>   		return -ENODEV;
>   
> +	if (wpan_dev->parent) {
> +		dev_dbg(&sdata->dev->dev,
> +			"Ignoring ASSOC REQ, not the PAN coordinator\n");
> +		return -ENODEV;
> +	}
> +
>   	mutex_lock(&wpan_dev->association_lock);
>   
>   	memcpy(&assoc_req_pl, skb->data, sizeof(assoc_req_pl));

Acked-by: Stefan Schmidt <stefan@datenfreihafen.org>

regards
Stefan Schmidt
Alexander Aring Dec. 15, 2023, 3:17 a.m. UTC | #2
Hi,

On Tue, Nov 28, 2023 at 6:17 AM Miquel Raynal <miquel.raynal@bootlin.com> wrote:
>
> It is not very clear in the specification whether simple coordinators
> are allowed or not to answer to association requests themselves. As
> there is no synchronization mechanism, it is probably best to rely on
> the relay feature of these coordinators and avoid processing them in
> this case.
>
> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>

Acked-by: Alexander Aring <aahringo@redhat.com>

- Alex
Miquel Raynal Dec. 20, 2023, 7:32 a.m. UTC | #3
On Tue, 2023-11-28 at 11:16:53 UTC, Miquel Raynal wrote:
> It is not very clear in the specification whether simple coordinators
> are allowed or not to answer to association requests themselves. As
> there is no synchronization mechanism, it is probably best to rely on
> the relay feature of these coordinators and avoid processing them in
> this case.
> 
> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
> Acked-by: Stefan Schmidt <stefan@datenfreihafen.org>
> Acked-by: Alexander Aring <aahringo@redhat.com>

Applied to https://git.kernel.org/pub/scm/linux/kernel/git/wpan/wpan-next.git master.

Miquel
diff mbox series

Patch

diff --git a/net/mac802154/scan.c b/net/mac802154/scan.c
index 5873da634fb4..1c0eeaa76560 100644
--- a/net/mac802154/scan.c
+++ b/net/mac802154/scan.c
@@ -781,6 +781,12 @@  int mac802154_process_association_req(struct ieee802154_sub_if_data *sdata,
 		 unlikely(dest->short_addr != wpan_dev->short_addr))
 		return -ENODEV;
 
+	if (wpan_dev->parent) {
+		dev_dbg(&sdata->dev->dev,
+			"Ignoring ASSOC REQ, not the PAN coordinator\n");
+		return -ENODEV;
+	}
+
 	mutex_lock(&wpan_dev->association_lock);
 
 	memcpy(&assoc_req_pl, skb->data, sizeof(assoc_req_pl));