From nobody Sat Jan 11 05:00:25 2025 X-Original-To: dev-commits-src-main@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 4YVRDB1tBKz5lG4w; Sat, 11 Jan 2025 05:00:26 +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 4YVRDB0Sgjz4cRc; Sat, 11 Jan 2025 05:00:26 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736571626; 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=OoSBCvQkkgw62K6TOUp96rhBRI/yKOOxRpBUzMyORmw=; b=Tcp2kSYAj4/15tkKjJ3twQu3XP9uc3sKtSe84IZ5VdaCiL3OKw7vq7zPMUeN/0Vue1byGe dzEPWyVUIQ4L+vqZqhFZqf/5xjMqG84yX5ni5cRZ4tAb7gi3WQ1n7prjwFywfGwH5uQaaa EyojzxsSR/6eK3hgv+6BDlfvShqUzedYUAQgaVNZ6FhbjeRPCpasL8PwWuDbP35CDT/794 dZd8alSLweve6jKpmmThCwhrljoCrV9d8XiR3XshlyS45ssFc4oXSeQ4q0ekoYcyqfBxzV 1a0K5darFAaehuQF6kIQ7iyEI2Qa7KAiHWkf4gwoqmSTI0rSyOpXaF/iuE6Gdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736571626; 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=OoSBCvQkkgw62K6TOUp96rhBRI/yKOOxRpBUzMyORmw=; b=hrLl3JnQSHe9LDNj3VzB4s8ldMUhgk7d3Bx4mz4conMOyhNdGFGCapiCT01doHP92OWK4Y Vv2EVcOSsRjJWxinFhaL5Ymo6HtLQdnGsj4LC5uBGnglI1wXAvItrYeGcFOZFH4L5GvNH7 YDvqM/iKOKWLwuac1q/BfIliEg0Ayvc1p1cRcqZPDtySWsh+6DFG86Uo4R9I6M8MREWsxG M/1B/9OD9b4mM54INnEXX3hTSbP//3tLBRVDkB39rLwWDlvHVqgTCfk9gFp9/icSOfE3+I W6H640/miucqeKKr2ekDN3gAey6FiZ2bmtsZCXg2tWOPTSQ2B3J6+FBpLEXPXg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736571626; a=rsa-sha256; cv=none; b=OpCnP++10j/ZiYnDTNr2ftLsuKVPJtUEP47RDsNWnA1/HE770RnVQt3zCDK1rBtUaQbIvW LglvIbV+RGeHIujG20oJ4OEjo+PdD0mVG62Em5USNr2J4dGwEjou7ZHQbhMSmg+o+ocbhV jIWIBqeWX7Pl4V2nWj55KVQGDsWySgUXabDTxeryXRhukkZgD5XoArAhM8MGY+BnQmgaFy hs+jbH7I4nUSK8nQoP6qcC63iQfw/0keXD0UHY1RxI9GdWwLP4TcW4CRpWrg0lgk1jPqBO zdYjdkjPY8shx7QeDbcU/skrmIy478u7l6D8wOXvyE8PL2Pd8Xmg4SxfzmgfWw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YVRD96vHWzksT; Sat, 11 Jan 2025 05:00:25 +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 50B50PTR022468; Sat, 11 Jan 2025 05:00:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50B50PNR022465; Sat, 11 Jan 2025 05:00:25 GMT (envelope-from git) Date: Sat, 11 Jan 2025 05:00:25 GMT Message-Id: <202501110500.50B50PNR022465@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: 8a8d095718cb - main - netlink: add snl(3) primitive to obtain group ID List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8a8d095718cb4e3ce84bef1cd61c20b518b8d047 Auto-Submitted: auto-generated The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=8a8d095718cb4e3ce84bef1cd61c20b518b8d047 commit 8a8d095718cb4e3ce84bef1cd61c20b518b8d047 Author: Gleb Smirnoff AuthorDate: 2025-01-11 04:55:50 +0000 Commit: Gleb Smirnoff CommitDate: 2025-01-11 04:55:50 +0000 netlink: add snl(3) primitive to obtain group ID using the family name and the group name as lookup arguments. Reviewed by: melifaro Differential Revision: https://reviews.freebsd.org/D48308 --- sys/netlink/netlink_snl_generic.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/sys/netlink/netlink_snl_generic.h b/sys/netlink/netlink_snl_generic.h index 0a2913c9155e..32b460c612bd 100644 --- a/sys/netlink/netlink_snl_generic.h +++ b/sys/netlink/netlink_snl_generic.h @@ -127,6 +127,24 @@ snl_get_genl_family(struct snl_state *ss, const char *family_name) return (attrs.family_id); } +static inline uint16_t +snl_get_genl_mcast_group(struct snl_state *ss, const char *family_name, + const char *group_name, uint16_t *family_id) +{ + struct _getfamily_attrs attrs = {}; + + snl_get_genl_family_info(ss, family_name, &attrs); + if (attrs.family_id == 0) + return (0); + if (family_id != NULL) + *family_id = attrs.family_id; + for (u_int i = 0; i < attrs.mcast_groups.num_groups; i++) + if (strcmp(attrs.mcast_groups.groups[i]->mcast_grp_name, + group_name) == 0) + return (attrs.mcast_groups.groups[i]->mcast_grp_id); + return (0); +} + static const struct snl_hdr_parser *snl_all_genl_parsers[] = { &_genl_ctrl_getfam_parser, &_genl_ctrl_mc_parser, };