summaryrefslogtreecommitdiff
path: root/sys/netinet6/in6.c
diff options
context:
space:
mode:
authorKlemens Nanni <kn@cvs.openbsd.org>2023-06-28 11:49:50 +0000
committerKlemens Nanni <kn@cvs.openbsd.org>2023-06-28 11:49:50 +0000
commit812b56460473ca2f4b3f38cd0ff1e9c8e7a3bae6 (patch)
tree8d8a6967d2941c25ea991ce9d7fb614743345cc8 /sys/netinet6/in6.c
parent552589a2e6e87e68d0bb6e929b8053561289de19 (diff)
use refcnt API for multicast addresses, add tracepoint:refcnt:ifmaddr probe
Replace hand-rolled reference counting with refcnt_init(9) and hook it up with a new dt(4) probe. OK bluhm mvs
Diffstat (limited to 'sys/netinet6/in6.c')
-rw-r--r--sys/netinet6/in6.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c
index 3651a5f23f6..1266354e202 100644
--- a/sys/netinet6/in6.c
+++ b/sys/netinet6/in6.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: in6.c,v 1.261 2023/04/21 00:41:13 kn Exp $ */
+/* $OpenBSD: in6.c,v 1.262 2023/06/28 11:49:49 kn Exp $ */
/* $KAME: in6.c,v 1.372 2004/06/14 08:14:21 itojun Exp $ */
/*
@@ -1032,7 +1032,7 @@ in6_addmulti(struct in6_addr *maddr6, struct ifnet *ifp, int *errorp)
/*
* Found it; just increment the reference count.
*/
- in6m->in6m_refcnt++;
+ refcnt_take(&in6m->in6m_refcnt);
} else {
/*
* New address; allocate a new multicast record
@@ -1047,7 +1047,7 @@ in6_addmulti(struct in6_addr *maddr6, struct ifnet *ifp, int *errorp)
in6m->in6m_sin.sin6_len = sizeof(struct sockaddr_in6);
in6m->in6m_sin.sin6_family = AF_INET6;
in6m->in6m_sin.sin6_addr = *maddr6;
- in6m->in6m_refcnt = 1;
+ refcnt_init_trace(&in6m->in6m_refcnt, DT_REFCNT_IDX_IFMADDR);
in6m->in6m_ifidx = ifp->if_index;
in6m->in6m_ifma.ifma_addr = sin6tosa(&in6m->in6m_sin);
@@ -1088,7 +1088,7 @@ in6_delmulti(struct in6_multi *in6m)
NET_ASSERT_LOCKED();
- if (--in6m->in6m_refcnt == 0) {
+ if (refcnt_rele(&in6m->in6m_refcnt) != 0) {
/*
* No remaining claims to this record; let MLD6 know
* that we are leaving the multicast group.