aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander V. Chernikov <melifaro@FreeBSD.org>2023-03-18 11:44:29 +0000
committerAlexander V. Chernikov <melifaro@FreeBSD.org>2023-03-18 11:44:29 +0000
commit046acc2bfd13f0caaf5132c1ad34877917db1a38 (patch)
tree6938b0b5d76bab2c28246a609f503267289ee60e
parent568a645ba55a1c3fc4fc74735cb0fab08bfe4cbf (diff)
downloadsrc-046acc2bfd13f0caaf5132c1ad34877917db1a38.tar.gz
src-046acc2bfd13f0caaf5132c1ad34877917db1a38.zip
netlink: add public ucred accessor for nlp.
MFC after: 2 weeks
-rw-r--r--sys/netlink/netlink_ctl.h1
-rw-r--r--sys/netlink/netlink_domain.c6
2 files changed, 7 insertions, 0 deletions
diff --git a/sys/netlink/netlink_ctl.h b/sys/netlink/netlink_ctl.h
index 1310a5a5493a..8cd29cf56d10 100644
--- a/sys/netlink/netlink_ctl.h
+++ b/sys/netlink/netlink_ctl.h
@@ -80,6 +80,7 @@ bool netlink_unregister_proto(int proto);
/* Common helpers */
bool nl_has_listeners(int netlink_family, uint32_t groups_mask);
bool nlp_has_priv(struct nlpcb *nlp, int priv);
+struct ucred *nlp_get_cred(struct nlpcb *nlp);
/* netlink_generic.c */
struct genl_cmd {
diff --git a/sys/netlink/netlink_domain.c b/sys/netlink/netlink_domain.c
index 01023f7244b6..2704974173b4 100644
--- a/sys/netlink/netlink_domain.c
+++ b/sys/netlink/netlink_domain.c
@@ -212,6 +212,12 @@ nlp_has_priv(struct nlpcb *nlp, int priv)
return (priv_check_cred(nlp->nl_cred, priv) == 0);
}
+struct ucred *
+nlp_get_cred(struct nlpcb *nlp)
+{
+ return (nlp->nl_cred);
+}
+
static uint32_t
nl_find_port(void)
{