summaryrefslogtreecommitdiff
path: root/sys/net/if_mpw.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/net/if_mpw.c')
-rw-r--r--sys/net/if_mpw.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/sys/net/if_mpw.c b/sys/net/if_mpw.c
index f17693dc766..2106c3e6819 100644
--- a/sys/net/if_mpw.c
+++ b/sys/net/if_mpw.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_mpw.c,v 1.62 2021/03/26 19:00:21 kn Exp $ */
+/* $OpenBSD: if_mpw.c,v 1.63 2022/08/29 07:51:45 bluhm Exp $ */
/*
* Copyright (c) 2015 Rafael Zalamena <rzalamena@openbsd.org>
@@ -122,6 +122,7 @@ mpw_clone_create(struct if_clone *ifc, int unit)
sc->sc_txhprio = 0;
sc->sc_rxhprio = IF_HDRPRIO_PACKET;
sc->sc_rdomain = 0;
+ refcnt_init_trace(&sc->sc_ifa.ifa_refcnt, DT_REFCNT_IDX_IFADDR);
sc->sc_ifa.ifa_ifp = ifp;
sc->sc_ifa.ifa_addr = sdltosa(ifp->if_sadl);
sc->sc_smpls.smpls_len = sizeof(sc->sc_smpls);
@@ -149,7 +150,10 @@ mpw_clone_destroy(struct ifnet *ifp)
ether_ifdetach(ifp);
if_detach(ifp);
-
+ if (refcnt_rele(&sc->sc_ifa.ifa_refcnt) == 0) {
+ panic("%s: ifa refcnt has %u refs", __func__,
+ sc->sc_ifa.ifa_refcnt.r_refs);
+ }
free(sc->sc_neighbor, M_DEVBUF, sizeof(*sc->sc_neighbor));
free(sc, M_DEVBUF, sizeof(*sc));