From nobody Mon Oct 07 09:49:56 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 4XMZBX4K9bz5XckV; Mon, 07 Oct 2024 09:49:56 +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 4XMZBX3TRWz45PN; Mon, 7 Oct 2024 09:49:56 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1728294596; 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=dE655WIcVMi4DEGPWgFMu46zadqxIPzMVJO3PUDFQVo=; b=ArWy5AA0bPVanGVuZmSqWgHcUht0T8W5PJK5GjLTmnLl5PN0jpFOVLErOolZHoHgODNmLW +aIu9v3uRs5yZ90GpxWqSom+ERMmxFJe93kU+ZKyGKBSfQh0No/OsS7J1FpqbRc57H3tre PBOzGfZOtIjraIwkrqziqhHqulyv7prwh+mneQYI0+SMNHqM+7dRdZ/2plsrc68GlDtfPw ehdJcNiooMc3DXz0gY5XHeQWYYkflqF0KhNmowANXJr8EIypBZImHIJg0jn3qwTaiOO7SH aYH+iGXLJUHJvCbxz9U+TUjx4VYQrezdV99do52T5ukagjVpIj3tSOdVsiVs7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1728294596; 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=dE655WIcVMi4DEGPWgFMu46zadqxIPzMVJO3PUDFQVo=; b=Y5efqgQ40noxHa1zrxuoHw22kfizlZ37MXF5de3S8DfLE54r15+ARrcTOu1u3eIGmC6Xzt aUOW08Bre3auwTOQoQo3DuThcd4LQd4BJ+dBJfRtVgRA6NWICxg9yoVHo0qw4Hm3G36quF ZNb2JX5XCN/k3QdsIjYlQ0Mu0UPmdqixdk7pc43UabfXzCQhN8Txf2g9rWmOjo+vLKs+3i 0cEPlUDmRZcNB1KA2V0LxiNcVCz4NzUxEnayeOwfpmU5wiczKAZWrz76iwbPw5zvELbVSP RA2DQOkC1+qv0I5sAcu7L8Umh9NzfGk25lE5YaGHeNXLFdEh/oBANLycHr+g6A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1728294596; a=rsa-sha256; cv=none; b=b896ry4BL35pozq+zNsvxV7EHLllu8toofuaFv6uSJ8ESR3VhBKGB8zfEnMH5guuzxvU0e oLP/NwNGm65qxPSbdOzkoyYtxjvBguyMoqdmXB4bL+ZJb48VP7rlRTMJ9dzMsYMnoBWZ2T acCBaeM+H61Hledh+z0TqCBtBtq7g1ub9AKiCKyE6BljNNrOCrtjE0oFu/6h7wbDWufRkj VJ/PpECV0xpnrykZDB+H3NTPNd9Ghz8kog0/DNwqVW7Gi/4F3BzP0Y0lepDQlkWkPQqJ21 EWxn5UVi29p64phj2FEmJ0LQBnW6tYpDjZil/v3OBXBO3YODewg8y4Au+aemrA== 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 4XMZBX2yxYzhDK; Mon, 7 Oct 2024 09:49:56 +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 4979nuO0049220; Mon, 7 Oct 2024 09:49:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4979nuWN049218; Mon, 7 Oct 2024 09:49:56 GMT (envelope-from git) Date: Mon, 7 Oct 2024 09:49:56 GMT Message-Id: <202410070949.4979nuWN049218@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: 65e7a648693c - main - genl: allow to monitor all know groups 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: 65e7a648693cc151990688f48c190df1c1fc858b Auto-Submitted: auto-generated The branch main has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=65e7a648693cc151990688f48c190df1c1fc858b commit 65e7a648693cc151990688f48c190df1c1fc858b Author: Baptiste Daroussin AuthorDate: 2024-10-07 09:45:21 +0000 Commit: Baptiste Daroussin CommitDate: 2024-10-07 09:46:32 +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 --- 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)