From nobody Wed Oct 23 07:24:29 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4XYLCL1Gydz5Zwrh; Wed, 23 Oct 2024 07:24:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XYLCK6PH0z46qM; Wed, 23 Oct 2024 07:24:29 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1729668269; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=68yMCiMWEevwY7yBR7ng0h6nBKSnslXEJ4gBXtiYCUw=; b=oVjlouJr1DxxVpWnLvmISPLQO3a5fM5ctEhfPymgPp6pCmrab9bjCzmu6Clrma4diac+2A 81el2dX0+6ZaVEYeHm/CVDo35w392V3K4t/nNIaG58070x8efr5Z/d99wA3c/KVa0Qao8Y 0WGtJ8jBK2uiiD94vCmxoPIzWWwo954ftsFemBy7HHJN7sqWhk6wvzKzkM63mHXzX4vA3+ /sz7IKT2gdSfNIwYLWNI5wgBr0e8nbHiR63bEbMfIwoT5OdTFsmkRdBuE7ZEyTpUWquIGD womQaPIf4bY4XZtXA+jcI4sjgyn7duTMgBRIcZm73BmTqBhg8eaWSo/04GFnSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1729668269; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=68yMCiMWEevwY7yBR7ng0h6nBKSnslXEJ4gBXtiYCUw=; b=AE4g4UuLaB6yTvOU1phh2M/euZ8oDNFrODRKB5wr5F6Dxd94dDQ8wWa6NvU5Ub4GUTyHw0 7stxpv2V3TdYG8PGfjQler4ujfbZsFz3U2TyB/BOOWCcBhlvpJw/8EHs2JhIvxT+xBGf1I oNN/lwUrmNTzHxoRn0/vO/XEGKrEQr9j6L5pkMf631wHpCeKCw55M7n2AcDtIKrtg7AP2k Tk/311JnRrlRBq57Xoq8YdoZbbHDuJOAlSvGDPc1TI/jgGjFKO7oSLqlI9f/4sAI0R+U5u X2AvRFYN8+LM8vKdKHyn8B9emJpGUzjWYfoxwZTKbIxpXy/EmP5PUZFr274QpQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1729668269; a=rsa-sha256; cv=none; b=Gb/l3mlaUphAAB7nOz48VoficoSfgG5dSTdRqRkcbZdy4gimMtF6dZWzztq4u3xAzjafBt KMprKEuCOGWNNfyEXvW5jlz1VnJimc8gLQb0nYqanRs5uXO4P3evepKq7ZDgI9lpSJuOw0 pHB8CqKJlyTpvJzfKtyFyF8kCzNEf0e14bvDWBYAW6lyraRnfYM2yfqiWw5zjiI7ArCSqA MxVy4Xu3l4ixtAJjRdom3yKAVb36a7HyKoAMtdptzNyy4+FuJ0fV0ZhSPl63ryYm4ZWfYt QeZDJnvIB1Sgri8p1WQm6+84EVnYTVZt5oReJHbhAgvag6mjy9IdkMOIqIJePQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4XYLCK5hlczpgL; Wed, 23 Oct 2024 07:24:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 49N7OTDI036341; Wed, 23 Oct 2024 07:24:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 49N7OT9o036338; Wed, 23 Oct 2024 07:24:29 GMT (envelope-from git) Date: Wed, 23 Oct 2024 07:24:29 GMT Message-Id: <202410230724.49N7OT9o036338@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Baptiste Daroussin Subject: git: c116dea0be45 - stable/14 - genl: subscribe to all if no group is provided List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: c116dea0be45de2ebc7c7f519bdfc33c69571054 Auto-Submitted: auto-generated The branch stable/14 has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=c116dea0be45de2ebc7c7f519bdfc33c69571054 commit c116dea0be45de2ebc7c7f519bdfc33c69571054 Author: Baptiste Daroussin AuthorDate: 2024-10-07 10:07:07 +0000 Commit: Baptiste Daroussin CommitDate: 2024-10-23 07:24:09 +0000 genl: subscribe to all if no group is provided the monitor command now subscribes too all groups if no "multicast group" is provided, this avoid potential collision with a group that could be named "all" (cherry picked from commit f45132db215be4d811e0efa0d01bcab72e4d0a59) --- usr.bin/genl/genl.1 | 13 +++++++++---- usr.bin/genl/genl.c | 6 +++--- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/usr.bin/genl/genl.1 b/usr.bin/genl/genl.1 index b3d66298eb00..8aafd24dd6f3 100644 --- a/usr.bin/genl/genl.1 +++ b/usr.bin/genl/genl.1 @@ -24,7 +24,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd Oct 5, 2023 +.Dd Oct 5, 2024 .Dt GENL 1 .Os .Sh NAME @@ -35,7 +35,8 @@ .Pp .Nm Cm list .Pp -.Nm Cm monitor Ao family Ac Ao multicast group Ac +.Nm Cm monitor Ao family Ac +.Op multicast group .Sh DESCRIPTION The .Nm @@ -52,7 +53,7 @@ Id of the operation if any and associated capabilities .It multicast groups If of the available multicast group if any and it associated name .El -.It Cm monitor Ao family Ac Ao multicast group Ac +.It Cm monitor Ao family Ac Oo multicast group Oc Connect to the .Ar family protocol and subscribe to the @@ -60,7 +61,11 @@ protocol and subscribe to the then print the received messages in a readable format if the protocol is known. So far only .Qq nlctrl -is known. +and +.Qq nlsysevent +are known. If no +.Ar multicast group +are provided then all the groups are subsribed to. .El .Sh SEE ALSO .Xr genetlink 4 , diff --git a/usr.bin/genl/genl.c b/usr.bin/genl/genl.c index eaf20d20e890..88880c4bacbd 100644 --- a/usr.bin/genl/genl.c +++ b/usr.bin/genl/genl.c @@ -51,7 +51,7 @@ static struct commands { const char *usage; int (*cmd)(int argc, char **argv); } cmds[] = { - { "monitor", "monitor ", monitor_mcast }, + { "monitor", "monitor [multicast group]", monitor_mcast }, { "list", "list", list_families }, }; @@ -205,13 +205,13 @@ monitor_mcast(int argc __unused, char **argv) if (!snl_init(&ss, NETLINK_GENERIC)) err(EXIT_FAILURE, "snl_init()"); - if (argc != 2) { + if (argc < 1 || argc > 2) { usage(); return (EXIT_FAILURE); } if (!snl_get_genl_family_info(&ss, argv[0], &attrs)) errx(EXIT_FAILURE, "Unknown family '%s'", argv[0]); - if (strcmp(argv[1], "all") == 0) + if (argc == 1) all = true; for (uint32_t i = 0; i < attrs.mcast_groups.num_groups; i++) { if (all || strcmp(attrs.mcast_groups.groups[i]->mcast_grp_name,