-/* $OpenBSD: dt_prov_static.c,v 1.18 2023/04/28 20:03:13 mvs Exp $ */
+/* $OpenBSD: dt_prov_static.c,v 1.19 2023/06/28 11:49:49 kn Exp $ */
/*
* Copyright (c) 2019 Martin Pieuchot <mpi@openbsd.org>
*/
DT_STATIC_PROBE0(refcnt, none);
DT_STATIC_PROBE3(refcnt, ifaddr, "void *", "int", "int");
+DT_STATIC_PROBE3(refcnt, ifmaddr, "void *", "int", "int");
DT_STATIC_PROBE3(refcnt, inpcb, "void *", "int", "int");
DT_STATIC_PROBE3(refcnt, rtentry, "void *", "int", "int");
DT_STATIC_PROBE3(refcnt, tdb, "void *", "int", "int");
/* refcnt */
&_DT_STATIC_P(refcnt, none),
&_DT_STATIC_P(refcnt, ifaddr),
+ &_DT_STATIC_P(refcnt, ifmaddr),
&_DT_STATIC_P(refcnt, inpcb),
&_DT_STATIC_P(refcnt, rtentry),
&_DT_STATIC_P(refcnt, tdb),
-/* $OpenBSD: if_var.h,v 1.127 2023/05/30 08:30:01 jsg Exp $ */
+/* $OpenBSD: if_var.h,v 1.128 2023/06/28 11:49:49 kn Exp $ */
/* $NetBSD: if.h,v 1.23 1996/05/07 02:40:27 thorpej Exp $ */
/*
struct ifmaddr {
struct sockaddr *ifma_addr; /* Protocol address */
unsigned int ifma_ifidx; /* Index of the interface */
- unsigned int ifma_refcnt; /* Count of references */
+ struct refcnt ifma_refcnt; /* Count of references */
TAILQ_ENTRY(ifmaddr) ifma_list; /* Per-interface list */
};
-/* $OpenBSD: in.c,v 1.184 2023/04/24 12:11:56 kn Exp $ */
+/* $OpenBSD: in.c,v 1.185 2023/06/28 11:49:49 kn Exp $ */
/* $NetBSD: in.c,v 1.26 1996/02/13 23:41:39 christos Exp $ */
/*
/*
* Found it; just increment the reference count.
*/
- ++inm->inm_refcnt;
+ refcnt_take(&inm->inm_refcnt);
} else {
/*
* New address; allocate a new multicast record
inm->inm_sin.sin_len = sizeof(struct sockaddr_in);
inm->inm_sin.sin_family = AF_INET;
inm->inm_sin.sin_addr = *ap;
- inm->inm_refcnt = 1;
+ refcnt_init_trace(&inm->inm_refcnt, DT_REFCNT_IDX_IFMADDR);
inm->inm_ifidx = ifp->if_index;
inm->inm_ifma.ifma_addr = sintosa(&inm->inm_sin);
NET_ASSERT_LOCKED();
- if (--inm->inm_refcnt != 0)
+ if (refcnt_rele(&inm->inm_refcnt) == 0)
return;
ifp = if_get(inm->inm_ifidx);
-/* $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 $ */
/*
/*
* Found it; just increment the reference count.
*/
- in6m->in6m_refcnt++;
+ refcnt_take(&in6m->in6m_refcnt);
} else {
/*
* New address; allocate a new multicast record
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);
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.
-/* $OpenBSD: refcnt.h,v 1.9 2023/04/28 20:03:14 mvs Exp $ */
+/* $OpenBSD: refcnt.h,v 1.10 2023/06/28 11:49:49 kn Exp $ */
/*
* Copyright (c) 2015 David Gwynne <dlg@openbsd.org>
/* sorted alphabetically, keep in sync with dev/dt/dt_prov_static.c */
#define DT_REFCNT_IDX_IFADDR 1
-#define DT_REFCNT_IDX_INPCB 2
-#define DT_REFCNT_IDX_RTENTRY 3
-#define DT_REFCNT_IDX_TDB 4
+#define DT_REFCNT_IDX_IFMADDR 2
+#define DT_REFCNT_IDX_INPCB 3
+#define DT_REFCNT_IDX_RTENTRY 4
+#define DT_REFCNT_IDX_TDB 5
#endif /* _KERNEL */