From nobody Wed Oct 23 07:24:28 2024 X-Original-To: dev-commits-src-branches@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 4XYLCK1P5Gz5ZxC5; Wed, 23 Oct 2024 07:24:29 +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 4XYLCK049dz477r; 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=yrzBSzjCoEBudgJwrxuqjybt/SzhedJI4C8f9Hu4vw8=; b=eUeJ2oS5enOfq0HN8NwgNiWwJwOFq5r9C7kY3SwKBBDyYOrkZxtrE90jbdQkv5xHvRDE+0 gjbWO9Hwo4ZWLa9hjrWcM+RiA0HSSulq9TBzyWMmGnoG/Tgr8UT81e9Rj8zw3+czyi333b ajmWLMRryjhl2OYz749I1KiZLd67iOYshOsiDkq0ABIYkCP4t+ls+pUqatyq5JMkr5pd59 vYZMMmfgDSb2q1br5Q7wNcXMv6N60BDNVuQkx5xpgpRTZYazQ/trQaUKkY6ufjf21aPB3k 0mdDB/OOmao7Z7RcTvuPwiZxtmSDOd+jxtLSMO5vfcR9+rL8YGLPv6lZ2N98qg== 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=yrzBSzjCoEBudgJwrxuqjybt/SzhedJI4C8f9Hu4vw8=; b=TnyxCkF5GViUJX6CCt5nmmt7HPLLdwNFkNoamUuF7GtiwwaaBMNkGFQ4AHf542ChNa/KKO kQ6aHAW6H+dwTTgliXW3KuouIbD4g3R3+wyLUVk5ayH3zTTFkTB4QGq4AN1/pRlkgddmBt YGW55blEsjldrv1v2MmwsJQcUbzj4ndTYsyfPdQddGuEwi6ahKI2vRcqskIuu+MvRgCIDE j9XtnBDusJLUX7Z/FH1anDT2YIN37MgNUN+13Plp1G2a49jsCG/OCQavUqc55lNZGJkTHA xkqI5PNPj1EkeMHUEFa8STgPW7S8utduemM4zCTFkYBDz1T8EQ0B9cG4APotyw== 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=SB6pC9DOuER9B1xtT/ubAhaGIcnjhpvK5x3UdKXn18LqVArvA5n6XK7tqEovY9RED6ZB/L tPi2F+8Gcfg+9HF19efaRCuvw564f7g8F9KkwZEH/JYo9JSlp5wCpSEIN7BsluCZrr9xN6 bPHMzXCeraVaWXx2MZGnPwU1YDnPdySHKOY0advbApwvpqguOBNCcXx6v2X6eOsouyHYSW 5SVVKnTgQ33vZI0KzOedB+bAh/kAMBjl7DM5wXG+MfkkUoRi6vdhTa8eVYRrVcUjye2x38 t/OGGRZrGIlnwR93Go6IFx/B752URBZnywFV1bnQHqqCOnThDVM2z9iDA9kYbg== 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 4XYLCJ6n51zpt1; Wed, 23 Oct 2024 07:24:28 +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 49N7OSFm036269; Wed, 23 Oct 2024 07:24:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 49N7OSu4036266; Wed, 23 Oct 2024 07:24:28 GMT (envelope-from git) Date: Wed, 23 Oct 2024 07:24:28 GMT Message-Id: <202410230724.49N7OSu4036266@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: eff7d958dda8 - stable/14 - genl: allow to monitor all know groups List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@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: eff7d958dda8542dc5be4ac6109d0da2055c0d02 Auto-Submitted: auto-generated The branch stable/14 has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=eff7d958dda8542dc5be4ac6109d0da2055c0d02 commit eff7d958dda8542dc5be4ac6109d0da2055c0d02 Author: Baptiste Daroussin AuthorDate: 2024-10-07 09:45:21 +0000 Commit: Baptiste Daroussin 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)