Skip to contentSkip to conversation

tools: ynl: fix handling of multiple mcast groups

PATCH Applied Jakub Kicinski 4 participants 4 messages Feb 26, 2024 – Feb 28, 2024

Subsystems (3)
lore
Share & tools
lore

Jakub Kicinski

author maintainer
#0 lore raw

PATCH 1/1 tools: ynl: fix handling of multiple mcast groups

We never increment the group number iterator, so all groups get recorded into index 0 of the mcast_groups[] array.

As a result YNL can only handle using the last group. For example using the "netdev" sample on kernel with page pool commands results in:

  $ ./samples/netdev
  YNL: Multicast group 'mgmt' not found

Most families have only one multicast group, so this hasn't been noticed. Plus perhaps developers usually test the last group which would have worked.

Fixes 86878f14d71a ("tools: ynl: user space helpers")

---
CC: [email protected]
CC: [email protected]

---
 tools/net/ynl/lib/ynl.c | 1 +
 1 file changed, 1 insertion(+)
tools/net/ynl/lib/ynl.c +1 -0
index c2ba72f68028..6bc95f07dc8f 100644
@@ -585,6 +585,7 @@ ynl_get_family_info_mcast(struct ynl_sock *ys, const struct nlattr *mcasts)
 				ys->mcast_groups[i].name[GENL_NAMSIZ - 1] = 0;
 			}
 		}
+		i++;
 	}
 
 	return 0;
Signature · 1 line
2.43.2
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines · Jakub Kicinski

We never increment the group number iterator, so all groups get recorded into index 0 of the mcast_groups[] array.

As a result YNL can only handle using the last group. For example using the "netdev" sample on kernel with page pool commands results in:

  $ ./samples/netdev
  YNL: Multicast group 'mgmt' not found
Quoted 6 lines

Most families have only one multicast group, so this hasn't been noticed. Plus perhaps developers usually test the last group which would have worked.

Fixes 86878f14d71a ("tools: ynl: user space helpers")
Acked-by on v1 1/1
#2 lore raw
In reply to Jakub Kicinski

Le 26/02/2024 à 22:40, Jakub Kicinski a écrit :

Quoted 10 lines

We never increment the group number iterator, so all groups get recorded into index 0 of the mcast_groups[] array.

As a result YNL can only handle using the last group. For example using the "netdev" sample on kernel with page pool commands results in:

  $ ./samples/netdev
  YNL: Multicast group 'mgmt' not found
Quoted 6 lines

Most families have only one multicast group, so this hasn't been noticed. Plus perhaps developers usually test the last group which would have worked.

Fixes 86878f14d71a ("tools: ynl: user space helpers")
#3 lore raw
In reply to Jakub Kicinski
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:

Quoted 8 lines · On Mon, 26 Feb 2024 13:40:18 -0800 you wrote:

We never increment the group number iterator, so all groups get recorded into index 0 of the mcast_groups[] array.

As a result YNL can only handle using the last group. For example using the "netdev" sample on kernel with page pool commands results in:

[...]

Here is the summary with links:
- [net] tools: ynl: fix handling of multiple mcast groups

    https://git.kernel.org/netdev/net/c/b6c65eb20ffa

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html