summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/net/if.c58
-rw-r--r--sys/net/if_aggr.c3
-rw-r--r--sys/net/if_bpe.c3
-rw-r--r--sys/net/if_etherip.c3
-rw-r--r--sys/net/if_gif.c3
-rw-r--r--sys/net/if_gre.c7
-rw-r--r--sys/net/if_mpe.c3
-rw-r--r--sys/net/if_mpip.c3
-rw-r--r--sys/net/if_mpw.c3
-rw-r--r--sys/net/if_pflow.c3
-rw-r--r--sys/net/if_pfsync.c3
-rw-r--r--sys/net/if_pppx.c4
-rw-r--r--sys/net/if_sec.c3
-rw-r--r--sys/net/if_tpmr.c3
-rw-r--r--sys/net/if_trunk.c3
-rw-r--r--sys/net/if_tun.c4
-rw-r--r--sys/net/if_var.h5
-rw-r--r--sys/net/if_veb.c4
-rw-r--r--sys/net/if_vlan.c3
-rw-r--r--sys/net/if_vxlan.c3
-rw-r--r--sys/net/if_wg.c3
-rw-r--r--sys/netinet/ip_carp.c3
22 files changed, 90 insertions, 40 deletions
diff --git a/sys/net/if.c b/sys/net/if.c
index f205a6799f2..61c24afb31f 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if.c,v 1.712 2023/12/22 23:01:50 mvs Exp $ */
+/* $OpenBSD: if.c,v 1.713 2023/12/23 10:52:54 bluhm Exp $ */
/* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */
/*
@@ -645,8 +645,6 @@ if_attach_common(struct ifnet *ifp)
"%s: if_qstart not set with MPSAFE set", ifp->if_xname);
}
- ifp->if_counters = counters_alloc(ifc_ncounters);
-
if_idxmap_alloc(ifp);
ifq_init(&ifp->if_snd, ifp, 0);
@@ -1252,7 +1250,8 @@ if_detach(struct ifnet *ifp)
/* Announce that the interface is gone. */
rtm_ifannounce(ifp, IFAN_DEPARTURE);
- counters_free(ifp->if_counters, ifc_ncounters);
+ if (ifp->if_counters != NULL)
+ if_counters_free(ifp);
for (i = 0; i < ifp->if_nifqs; i++)
ifq_destroy(ifp->if_ifqs[i]);
@@ -2772,27 +2771,48 @@ ifconf(caddr_t data)
}
void
+if_counters_alloc(struct ifnet *ifp)
+{
+ KASSERT(ifp->if_counters == NULL);
+
+ ifp->if_counters = counters_alloc(ifc_ncounters);
+}
+
+void
+if_counters_free(struct ifnet *ifp)
+{
+ KASSERT(ifp->if_counters != NULL);
+
+ counters_free(ifp->if_counters, ifc_ncounters);
+ ifp->if_counters = NULL;
+}
+
+void
if_getdata(struct ifnet *ifp, struct if_data *data)
{
- uint64_t counters[ifc_ncounters];
unsigned int i;
*data = ifp->if_data;
- counters_read(ifp->if_counters, counters, nitems(counters), NULL);
-
- data->ifi_ipackets += counters[ifc_ipackets];
- data->ifi_ierrors += counters[ifc_ierrors];
- data->ifi_opackets += counters[ifc_opackets];
- data->ifi_oerrors += counters[ifc_oerrors];
- data->ifi_collisions += counters[ifc_collisions];
- data->ifi_ibytes += counters[ifc_ibytes];
- data->ifi_obytes += counters[ifc_obytes];
- data->ifi_imcasts += counters[ifc_imcasts];
- data->ifi_omcasts += counters[ifc_omcasts];
- data->ifi_iqdrops += counters[ifc_iqdrops];
- data->ifi_oqdrops += counters[ifc_oqdrops];
- data->ifi_noproto += counters[ifc_noproto];
+ if (ifp->if_counters != NULL) {
+ uint64_t counters[ifc_ncounters];
+
+ counters_read(ifp->if_counters, counters, nitems(counters),
+ NULL);
+
+ data->ifi_ipackets += counters[ifc_ipackets];
+ data->ifi_ierrors += counters[ifc_ierrors];
+ data->ifi_opackets += counters[ifc_opackets];
+ data->ifi_oerrors += counters[ifc_oerrors];
+ data->ifi_collisions += counters[ifc_collisions];
+ data->ifi_ibytes += counters[ifc_ibytes];
+ data->ifi_obytes += counters[ifc_obytes];
+ data->ifi_imcasts += counters[ifc_imcasts];
+ data->ifi_omcasts += counters[ifc_omcasts];
+ data->ifi_iqdrops += counters[ifc_iqdrops];
+ data->ifi_oqdrops += counters[ifc_oqdrops];
+ data->ifi_noproto += counters[ifc_noproto];
+ }
for (i = 0; i < ifp->if_nifqs; i++) {
struct ifqueue *ifq = ifp->if_ifqs[i];
diff --git a/sys/net/if_aggr.c b/sys/net/if_aggr.c
index 5536e07f577..8e961b423e7 100644
--- a/sys/net/if_aggr.c
+++ b/sys/net/if_aggr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_aggr.c,v 1.41 2023/12/22 23:01:50 mvs Exp $ */
+/* $OpenBSD: if_aggr.c,v 1.42 2023/12/23 10:52:54 bluhm Exp $ */
/*
* Copyright (c) 2019 The University of Queensland
@@ -562,6 +562,7 @@ aggr_clone_create(struct if_clone *ifc, int unit)
ifp->if_link_state = LINK_STATE_DOWN;
ether_fakeaddr(ifp);
+ if_counters_alloc(ifp);
if_attach(ifp);
ether_ifattach(ifp);
diff --git a/sys/net/if_bpe.c b/sys/net/if_bpe.c
index f5d4771273c..cee69c91016 100644
--- a/sys/net/if_bpe.c
+++ b/sys/net/if_bpe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_bpe.c,v 1.21 2023/12/22 23:01:50 mvs Exp $ */
+/* $OpenBSD: if_bpe.c,v 1.22 2023/12/23 10:52:54 bluhm Exp $ */
/*
* Copyright (c) 2018 David Gwynne <dlg@openbsd.org>
*
@@ -182,6 +182,7 @@ bpe_clone_create(struct if_clone *ifc, int unit)
ifp->if_xflags = IFXF_CLONED;
ether_fakeaddr(ifp);
+ if_counters_alloc(ifp);
if_attach(ifp);
ether_ifattach(ifp);
diff --git a/sys/net/if_etherip.c b/sys/net/if_etherip.c
index 2773685e372..653371f3e6e 100644
--- a/sys/net/if_etherip.c
+++ b/sys/net/if_etherip.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_etherip.c,v 1.53 2023/12/22 23:01:50 mvs Exp $ */
+/* $OpenBSD: if_etherip.c,v 1.54 2023/12/23 10:52:54 bluhm Exp $ */
/*
* Copyright (c) 2015 Kazuya GODA <goda@openbsd.org>
*
@@ -161,6 +161,7 @@ etherip_clone_create(struct if_clone *ifc, int unit)
ifmedia_add(&sc->sc_media, IFM_ETHER | IFM_AUTO, 0, NULL);
ifmedia_set(&sc->sc_media, IFM_ETHER | IFM_AUTO);
+ if_counters_alloc(ifp);
if_attach(ifp);
ether_ifattach(ifp);
diff --git a/sys/net/if_gif.c b/sys/net/if_gif.c
index 1051247ee0b..4aa1cc77ebc 100644
--- a/sys/net/if_gif.c
+++ b/sys/net/if_gif.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_gif.c,v 1.135 2023/12/22 23:01:50 mvs Exp $ */
+/* $OpenBSD: if_gif.c,v 1.136 2023/12/23 10:52:54 bluhm Exp $ */
/* $KAME: if_gif.c,v 1.43 2001/02/20 08:51:07 itojun Exp $ */
/*
@@ -176,6 +176,7 @@ gif_clone_create(struct if_clone *ifc, int unit)
if_attach(ifp);
if_alloc_sadl(ifp);
+ if_counters_alloc(ifp);
#if NBPFILTER > 0
bpfattach(&ifp->if_bpf, ifp, DLT_LOOP, sizeof(uint32_t));
diff --git a/sys/net/if_gre.c b/sys/net/if_gre.c
index 967cb75d160..94f3d89c536 100644
--- a/sys/net/if_gre.c
+++ b/sys/net/if_gre.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_gre.c,v 1.177 2023/12/22 23:01:50 mvs Exp $ */
+/* $OpenBSD: if_gre.c,v 1.178 2023/12/23 10:52:54 bluhm Exp $ */
/* $NetBSD: if_gre.c,v 1.9 1999/10/25 19:18:11 drochner Exp $ */
/*
@@ -592,6 +592,7 @@ gre_clone_create(struct if_clone *ifc, int unit)
timeout_set_proc(&sc->sc_ka_hold, gre_keepalive_hold, sc);
sc->sc_ka_state = GRE_KA_NONE;
+ if_counters_alloc(ifp);
if_attach(ifp);
if_alloc_sadl(ifp);
@@ -658,6 +659,7 @@ mgre_clone_create(struct if_clone *ifc, int unit)
sc->sc_tunnel.t_df = htons(0);
sc->sc_tunnel.t_ecn = ECN_ALLOWED;
+ if_counters_alloc(ifp);
if_attach(ifp);
if_alloc_sadl(ifp);
@@ -714,6 +716,7 @@ egre_clone_create(struct if_clone *ifc, int unit)
ifmedia_add(&sc->sc_media, IFM_ETHER | IFM_AUTO, 0, NULL);
ifmedia_set(&sc->sc_media, IFM_ETHER | IFM_AUTO);
+ if_counters_alloc(ifp);
if_attach(ifp);
ether_ifattach(ifp);
@@ -791,6 +794,7 @@ nvgre_clone_create(struct if_clone *ifc, int unit)
ifmedia_add(&sc->sc_media, IFM_ETHER | IFM_AUTO, 0, NULL);
ifmedia_set(&sc->sc_media, IFM_ETHER | IFM_AUTO);
+ if_counters_alloc(ifp);
if_attach(ifp);
ether_ifattach(ifp);
@@ -854,6 +858,7 @@ eoip_clone_create(struct if_clone *ifc, int unit)
ifmedia_add(&sc->sc_media, IFM_ETHER | IFM_AUTO, 0, NULL);
ifmedia_set(&sc->sc_media, IFM_ETHER | IFM_AUTO);
+ if_counters_alloc(ifp);
if_attach(ifp);
ether_ifattach(ifp);
diff --git a/sys/net/if_mpe.c b/sys/net/if_mpe.c
index 447570be717..a72347b4c3c 100644
--- a/sys/net/if_mpe.c
+++ b/sys/net/if_mpe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_mpe.c,v 1.103 2023/12/22 23:01:50 mvs Exp $ */
+/* $OpenBSD: if_mpe.c,v 1.104 2023/12/23 10:52:54 bluhm Exp $ */
/*
* Copyright (c) 2008 Pierre-Yves Ritschard <pyr@spootnik.org>
@@ -119,6 +119,7 @@ mpe_clone_create(struct if_clone *ifc, int unit)
if_attach(ifp);
if_alloc_sadl(ifp);
+ if_counters_alloc(ifp);
#if NBPFILTER > 0
bpfattach(&ifp->if_bpf, ifp, DLT_LOOP, sizeof(u_int32_t));
diff --git a/sys/net/if_mpip.c b/sys/net/if_mpip.c
index d0c39714342..8daac934664 100644
--- a/sys/net/if_mpip.c
+++ b/sys/net/if_mpip.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_mpip.c,v 1.17 2023/12/22 23:01:50 mvs Exp $ */
+/* $OpenBSD: if_mpip.c,v 1.18 2023/12/23 10:52:54 bluhm Exp $ */
/*
* Copyright (c) 2015 Rafael Zalamena <rzalamena@openbsd.org>
@@ -121,6 +121,7 @@ mpip_clone_create(struct if_clone *ifc, int unit)
ifp->if_hardmtu = 65535;
if_attach(ifp);
+ if_counters_alloc(ifp);
if_alloc_sadl(ifp);
#if NBPFILTER > 0
diff --git a/sys/net/if_mpw.c b/sys/net/if_mpw.c
index 2229bcf3c15..934a757bb41 100644
--- a/sys/net/if_mpw.c
+++ b/sys/net/if_mpw.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_mpw.c,v 1.64 2023/12/22 23:01:50 mvs Exp $ */
+/* $OpenBSD: if_mpw.c,v 1.65 2023/12/23 10:52:54 bluhm Exp $ */
/*
* Copyright (c) 2015 Rafael Zalamena <rzalamena@openbsd.org>
@@ -115,6 +115,7 @@ mpw_clone_create(struct if_clone *ifc, int unit)
sc->sc_dead = 0;
+ if_counters_alloc(ifp);
if_attach(ifp);
ether_ifattach(ifp);
diff --git a/sys/net/if_pflow.c b/sys/net/if_pflow.c
index 79c0f2f6aa0..09a2689ca04 100644
--- a/sys/net/if_pflow.c
+++ b/sys/net/if_pflow.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_pflow.c,v 1.108 2023/12/22 23:01:50 mvs Exp $ */
+/* $OpenBSD: if_pflow.c,v 1.109 2023/12/23 10:52:54 bluhm Exp $ */
/*
* Copyright (c) 2011 Florian Obser <florian@narrans.de>
@@ -279,6 +279,7 @@ pflow_clone_create(struct if_clone *ifc, int unit)
task_set(&pflowif->sc_outputtask, pflow_output_process, pflowif);
+ if_counters_alloc(ifp);
if_attach(ifp);
if_alloc_sadl(ifp);
diff --git a/sys/net/if_pfsync.c b/sys/net/if_pfsync.c
index 86664de08af..748020fe20f 100644
--- a/sys/net/if_pfsync.c
+++ b/sys/net/if_pfsync.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_pfsync.c,v 1.323 2023/12/22 23:01:50 mvs Exp $ */
+/* $OpenBSD: if_pfsync.c,v 1.324 2023/12/23 10:52:54 bluhm Exp $ */
/*
* Copyright (c) 2002 Michael Shalayeff
@@ -444,6 +444,7 @@ pfsync_clone_create(struct if_clone *ifc, int unit)
#endif
}
+ if_counters_alloc(ifp);
if_attach(ifp);
if_alloc_sadl(ifp);
diff --git a/sys/net/if_pppx.c b/sys/net/if_pppx.c
index 71d302d18f5..35dbec53d33 100644
--- a/sys/net/if_pppx.c
+++ b/sys/net/if_pppx.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_pppx.c,v 1.127 2023/12/22 23:01:50 mvs Exp $ */
+/* $OpenBSD: if_pppx.c,v 1.128 2023/12/23 10:52:54 bluhm Exp $ */
/*
* Copyright (c) 2010 Claudio Jeker <claudio@openbsd.org>
@@ -684,6 +684,7 @@ pppx_add_session(struct pppx_dev *pxd, struct pipex_session_req *req)
ifp->if_type = IFT_PPP;
ifp->if_softc = pxi;
/* ifp->if_rdomain = req->pr_rdomain; */
+ if_counters_alloc(ifp);
if_attach(ifp);
@@ -1079,6 +1080,7 @@ pppacopen(dev_t dev, int flags, int mode, struct proc *p)
ifp->if_qstart = pppac_qstart;
ifp->if_ioctl = pppac_ioctl;
+ if_counters_alloc(ifp);
if_attach(ifp);
if_alloc_sadl(ifp);
diff --git a/sys/net/if_sec.c b/sys/net/if_sec.c
index a7e85d915a4..99e79b56833 100644
--- a/sys/net/if_sec.c
+++ b/sys/net/if_sec.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_sec.c,v 1.8 2023/12/22 23:01:50 mvs Exp $ */
+/* $OpenBSD: if_sec.c,v 1.9 2023/12/23 10:52:54 bluhm Exp $ */
/*
* Copyright (c) 2022 The University of Queensland
@@ -147,6 +147,7 @@ sec_clone_create(struct if_clone *ifc, int unit)
ifp->if_ioctl = sec_ioctl;
ifp->if_rtrequest = p2p_rtrequest;
+ if_counters_alloc(ifp);
if_attach(ifp);
if_alloc_sadl(ifp);
diff --git a/sys/net/if_tpmr.c b/sys/net/if_tpmr.c
index 7794dfb830d..11f5634ac96 100644
--- a/sys/net/if_tpmr.c
+++ b/sys/net/if_tpmr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_tpmr.c,v 1.34 2023/12/22 23:01:50 mvs Exp $ */
+/* $OpenBSD: if_tpmr.c,v 1.35 2023/12/23 10:52:54 bluhm Exp $ */
/*
* Copyright (c) 2019 The University of Queensland
@@ -168,6 +168,7 @@ tpmr_clone_create(struct if_clone *ifc, int unit)
ifp->if_xflags = IFXF_CLONED | IFXF_MPSAFE;
ifp->if_link_state = LINK_STATE_DOWN;
+ if_counters_alloc(ifp);
if_attach(ifp);
if_alloc_sadl(ifp);
diff --git a/sys/net/if_trunk.c b/sys/net/if_trunk.c
index be43be66480..c1268f2d80d 100644
--- a/sys/net/if_trunk.c
+++ b/sys/net/if_trunk.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_trunk.c,v 1.153 2023/12/22 23:01:50 mvs Exp $ */
+/* $OpenBSD: if_trunk.c,v 1.154 2023/12/23 10:52:54 bluhm Exp $ */
/*
* Copyright (c) 2005, 2006, 2007 Reyk Floeter <reyk@openbsd.org>
@@ -193,6 +193,7 @@ trunk_clone_create(struct if_clone *ifc, int unit)
* Attach as an ordinary ethernet device, children will be attached
* as special device IFT_IEEE8023ADLAG.
*/
+ if_counters_alloc(ifp);
if_attach(ifp);
ether_ifattach(ifp);
diff --git a/sys/net/if_tun.c b/sys/net/if_tun.c
index b4780f14638..246a3009673 100644
--- a/sys/net/if_tun.c
+++ b/sys/net/if_tun.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_tun.c,v 1.239 2023/12/22 23:01:50 mvs Exp $ */
+/* $OpenBSD: if_tun.c,v 1.240 2023/12/23 10:52:54 bluhm Exp $ */
/* $NetBSD: if_tun.c,v 1.24 1996/05/07 02:40:48 thorpej Exp $ */
/*
@@ -246,6 +246,8 @@ tun_create(struct if_clone *ifc, int unit, int flags)
ifp->if_hardmtu = TUNMRU;
ifp->if_link_state = LINK_STATE_DOWN;
+ if_counters_alloc(ifp);
+
if ((flags & TUN_LAYER2) == 0) {
#if NBPFILTER > 0
ifp->if_bpf_mtap = bpf_mtap;
diff --git a/sys/net/if_var.h b/sys/net/if_var.h
index 38528b2f245..db48e5ff7ea 100644
--- a/sys/net/if_var.h
+++ b/sys/net/if_var.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_var.h,v 1.131 2023/12/22 23:01:50 mvs Exp $ */
+/* $OpenBSD: if_var.h,v 1.132 2023/12/23 10:52:54 bluhm Exp $ */
/* $NetBSD: if.h,v 1.23 1996/05/07 02:40:27 thorpej Exp $ */
/*
@@ -379,6 +379,9 @@ int if_rxr_info_ioctl(struct if_rxrinfo *, u_int, struct if_rxring_info *);
int if_rxr_ioctl(struct if_rxrinfo *, const char *, u_int,
struct if_rxring *);
+void if_counters_alloc(struct ifnet *);
+void if_counters_free(struct ifnet *);
+
int if_txhprio_l2_check(int);
int if_txhprio_l3_check(int);
int if_rxhprio_l2_check(int);
diff --git a/sys/net/if_veb.c b/sys/net/if_veb.c
index 6c1c5786465..e6cdf6bbe65 100644
--- a/sys/net/if_veb.c
+++ b/sys/net/if_veb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_veb.c,v 1.33 2023/12/22 23:01:50 mvs Exp $ */
+/* $OpenBSD: if_veb.c,v 1.34 2023/12/23 10:52:54 bluhm Exp $ */
/*
* Copyright (c) 2021 David Gwynne <dlg@openbsd.org>
@@ -314,6 +314,7 @@ veb_clone_create(struct if_clone *ifc, int unit)
ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
ifp->if_xflags = IFXF_CLONED | IFXF_MPSAFE;
+ if_counters_alloc(ifp);
if_attach(ifp);
if_alloc_sadl(ifp);
@@ -2347,6 +2348,7 @@ vport_clone_create(struct if_clone *ifc, int unit)
ifp->if_xflags = IFXF_CLONED | IFXF_MPSAFE;
ether_fakeaddr(ifp);
+ if_counters_alloc(ifp);
if_attach(ifp);
ether_ifattach(ifp);
diff --git a/sys/net/if_vlan.c b/sys/net/if_vlan.c
index 1246c8c024c..9915a94390c 100644
--- a/sys/net/if_vlan.c
+++ b/sys/net/if_vlan.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_vlan.c,v 1.217 2023/12/22 23:01:50 mvs Exp $ */
+/* $OpenBSD: if_vlan.c,v 1.218 2023/12/23 10:52:54 bluhm Exp $ */
/*
* Copyright 1998 Massachusetts Institute of Technology
@@ -215,6 +215,7 @@ vlan_clone_create(struct if_clone *ifc, int unit)
ifp->if_hardmtu = 0xffff;
ifp->if_link_state = LINK_STATE_DOWN;
+ if_counters_alloc(ifp);
if_attach(ifp);
ether_ifattach(ifp);
ifp->if_hdrlen = EVL_ENCAPLEN;
diff --git a/sys/net/if_vxlan.c b/sys/net/if_vxlan.c
index 2889dceb08b..ec9339deb47 100644
--- a/sys/net/if_vxlan.c
+++ b/sys/net/if_vxlan.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_vxlan.c,v 1.98 2023/12/22 23:01:50 mvs Exp $ */
+/* $OpenBSD: if_vxlan.c,v 1.99 2023/12/23 10:52:54 bluhm Exp $ */
/*
* Copyright (c) 2021 David Gwynne <dlg@openbsd.org>
@@ -275,6 +275,7 @@ vxlan_clone_create(struct if_clone *ifc, int unit)
ifp->if_xflags = IFXF_CLONED | IFXF_MPSAFE;
ether_fakeaddr(ifp);
+ if_counters_alloc(ifp);
if_attach(ifp);
ether_ifattach(ifp);
diff --git a/sys/net/if_wg.c b/sys/net/if_wg.c
index 5752aa426d7..a55fba2afde 100644
--- a/sys/net/if_wg.c
+++ b/sys/net/if_wg.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_wg.c,v 1.33 2023/12/22 23:01:50 mvs Exp $ */
+/* $OpenBSD: if_wg.c,v 1.34 2023/12/23 10:52:54 bluhm Exp $ */
/*
* Copyright (C) 2015-2020 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved.
@@ -2693,6 +2693,7 @@ wg_clone_create(struct if_clone *ifc, int unit)
if_attach(ifp);
if_alloc_sadl(ifp);
+ if_counters_alloc(ifp);
#if NBPFILTER > 0
bpfattach(&ifp->if_bpf, ifp, DLT_LOOP, sizeof(uint32_t));
diff --git a/sys/netinet/ip_carp.c b/sys/netinet/ip_carp.c
index 4a843fee883..f2aee3e422b 100644
--- a/sys/netinet/ip_carp.c
+++ b/sys/netinet/ip_carp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_carp.c,v 1.359 2023/12/22 23:01:50 mvs Exp $ */
+/* $OpenBSD: ip_carp.c,v 1.360 2023/12/23 10:52:54 bluhm Exp $ */
/*
* Copyright (c) 2002 Michael Shalayeff. All rights reserved.
@@ -831,6 +831,7 @@ carp_clone_create(struct if_clone *ifc, int unit)
ifp->if_start = carp_start;
ifp->if_enqueue = carp_enqueue;
ifp->if_xflags = IFXF_CLONED;
+ if_counters_alloc(ifp);
if_attach(ifp);
ether_ifattach(ifp);
ifp->if_type = IFT_CARP;