Date: Wed, 23 Oct 2024 07:24:28 GMT From: Baptiste Daroussin <bapt@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: eff7d958dda8 - stable/14 - genl: allow to monitor all know groups Message-ID: <202410230724.49N7OSu4036266@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/14 has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=eff7d958dda8542dc5be4ac6109d0da2055c0d02 commit eff7d958dda8542dc5be4ac6109d0da2055c0d02 Author: Baptiste Daroussin <bapt@FreeBSD.org> AuthorDate: 2024-10-07 09:45:21 +0000 Commit: Baptiste Daroussin <bapt@FreeBSD.org> CommitDate: 2024-10-23 07:24:09 +0000 genl: allow to monitor all know groups Add a special keyword "all" for the group name, which allows genl to monitor all groups in an existing family (cherry picked from commit 65e7a648693cc151990688f48c190df1c1fc858b) --- usr.bin/genl/genl.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/usr.bin/genl/genl.c b/usr.bin/genl/genl.c index e3acb872a39e..eaf20d20e890 100644 --- a/usr.bin/genl/genl.c +++ b/usr.bin/genl/genl.c @@ -197,6 +197,7 @@ monitor_mcast(int argc __unused, char **argv) struct _getfamily_attrs attrs; struct pollfd pfd; bool found = false; + bool all = false; void (*parser)(struct snl_state *ss, struct nlmsghdr *hdr); parser = parser_fallback; @@ -210,8 +211,10 @@ monitor_mcast(int argc __unused, char **argv) } if (!snl_get_genl_family_info(&ss, argv[0], &attrs)) errx(EXIT_FAILURE, "Unknown family '%s'", argv[0]); + if (strcmp(argv[1], "all") == 0) + all = true; for (uint32_t i = 0; i < attrs.mcast_groups.num_groups; i++) { - if (strcmp(attrs.mcast_groups.groups[i]->mcast_grp_name, + if (all || strcmp(attrs.mcast_groups.groups[i]->mcast_grp_name, argv[1]) == 0) { found = true; if (setsockopt(ss.fd, SOL_NETLINK, @@ -221,7 +224,8 @@ monitor_mcast(int argc __unused, char **argv) == -1) err(EXIT_FAILURE, "Cannot subscribe to command " "notify"); - break; + if (!all) + break; } } if (!found)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202410230724.49N7OSu4036266>