diff mbox series

[net] tools: ynl: fix handling of multiple mcast groups

Message ID 20240226214019.1255242-1-kuba@kernel.org (mailing list archive)
State Accepted
Commit b6c65eb20ffa8e3bd89f551427dbeee2876d72ca
Delegated to: Netdev Maintainers
Headers show
Series [net] tools: ynl: fix handling of multiple mcast groups | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag present in non-next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 8 this patch: 8
netdev/build_tools success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers success CCed 6 of 6 maintainers
netdev/build_clang success Errors and warnings before: 8 this patch: 8
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 Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 8 this patch: 8
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 7 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-02-27--03-00 (tests: 1456)

Commit Message

Jakub Kicinski Feb. 26, 2024, 9:40 p.m. UTC
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")
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
CC: nicolas.dichtel@6wind.com
CC: willemb@google.com
---
 tools/net/ynl/lib/ynl.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Donald Hunter Feb. 27, 2024, 1:35 p.m. UTC | #1
Jakub Kicinski <kuba@kernel.org> writes:

> 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")
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Reviewed-by: Donald Hunter <donald.hunter@gmail.com>
Nicolas Dichtel Feb. 27, 2024, 4:41 p.m. UTC | #2
Le 26/02/2024 à 22:40, Jakub Kicinski a écrit :
> 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")
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Acked-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
patchwork-bot+netdevbpf@kernel.org Feb. 28, 2024, 11:50 p.m. UTC | #3
Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

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!
diff mbox series

Patch

diff --git a/tools/net/ynl/lib/ynl.c b/tools/net/ynl/lib/ynl.c
index c2ba72f68028..6bc95f07dc8f 100644
--- a/tools/net/ynl/lib/ynl.c
+++ b/tools/net/ynl/lib/ynl.c
@@ -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;