From nobody Mon Oct 07 10:12:10 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 4XMZhB2SWTz5Xg9g; Mon, 07 Oct 2024 10:12:10 +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 4XMZhB1x7Fz46rM; Mon, 7 Oct 2024 10:12:10 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1728295930; 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=rtsS/a9EgY/pA90T3eoLXjtSePLiGtSvpvUFw24DEsI=; b=ubAmA8X8ug6anqYzJyq7l1VQG/Dx5AltPRBp6+2VTv4h+GJwCYAKrpth6IZY7EkT82pdYm bYViKPNOs6VRyZfJSPUMe//xD+OVmv2idRR9mvu0PEiVaF8vu3n6UzPomYOWVhK7QfhrbL yoSMiLeFwUqtSLVee86hj/BTsyV+9dWWnw9gBkznfNFWhVKm/bzRGBBABT3W1SrEwg/ORQ Exk95bhFGlTcW1Ve1I37eA9WSZAsbpcAN9WxPwX7WREa/6YP/Nco9Qv7NgTldZHrDo9uup QHsp5hmrFE4v3MC1I1LpVlKat43VWbfuU0oIqpQJnQesLD8KG86jJI+W/dVsBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1728295930; 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=rtsS/a9EgY/pA90T3eoLXjtSePLiGtSvpvUFw24DEsI=; b=OO7wnqhBIC32a59BP0eL9kYJmiOPL1Tu/sUhE2ZDQjI2sbQIIB6/fb8sf1DpEwvCy+e2Vz 7wADeTIPwHePJyQVbeKenMxKwHY68pMzSUxbvb68Z8Zrlcpe377BonApvUe5VAzBV5rTL2 xO5WgpsURjGKCB+XQHT7L+dx7PuaSbTaOCWI6WUZov2EahnQa+2Bcv1xWOmVRcBbtFzYkV k9UdhoXcDNDt6HsRwnOQdxiML1xYOZnAmbInsdfCG47ZF2//g90JykVrCw7bY6tq2m2SJ1 1kbCDjZsssTuTRD5YWxisi1bSXPTzjBDBcBTuI06FBayBofvkBe/5V0v+so1OQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1728295930; a=rsa-sha256; cv=none; b=ODb4sUSKkU6ovCN7DVIHNy2Cg87tZ/aQq7ne2WErlBUEcHCjKkHKYIsyx3V1j6NOOauuQ9 BpBX49fS+e9fUa7zv/EmTy6CEz40OvrPYPLDhVBduBr1AXiitqWEewHPJ4cnaQ0+6IZ5sx ukc7dHLg5ZSP7SBOnaaxP7gxJwCVr1Jx/E8HLzqjQKUcM4lBAAp+R/2IMI7bYYQ8G2a5VV BbBIrWzmPyeYpUMu7W+MVpRvPndzsJDPQuq05ZExH52OX2nJMrMsS4gQbUGvukZ5LT0ZjN HlnMoekn62AXb5KgowGFqN3Lp6rH47b1IMwaRGu+LFjhB1kr3bCOf1+WBgCsog== 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 4XMZhB1XzkzjKD; Mon, 7 Oct 2024 10:12:10 +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 497ACAa8098985; Mon, 7 Oct 2024 10:12:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 497ACA7T098982; Mon, 7 Oct 2024 10:12:10 GMT (envelope-from git) Date: Mon, 7 Oct 2024 10:12:10 GMT Message-Id: <202410071012.497ACA7T098982@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Baptiste Daroussin Subject: git: f45132db215b - main - 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/main X-Git-Reftype: branch X-Git-Commit: f45132db215be4d811e0efa0d01bcab72e4d0a59 Auto-Submitted: auto-generated The branch main has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=f45132db215be4d811e0efa0d01bcab72e4d0a59 commit f45132db215be4d811e0efa0d01bcab72e4d0a59 Author: Baptiste Daroussin AuthorDate: 2024-10-07 10:07:07 +0000 Commit: Baptiste Daroussin CommitDate: 2024-10-07 10:07:07 +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" --- 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,