From b5b8bc53ca00dc14cccb11ede4abd86818e9a05b Mon Sep 17 00:00:00 2001 From: mvs Date: Mon, 1 Jan 2024 18:47:02 +0000 Subject: [PATCH] Call if_counters_alloc() before if_attach(). ok bluhm sashan --- sys/net/if_gif.c | 4 ++-- sys/net/if_mpe.c | 4 ++-- sys/net/if_mpip.c | 4 ++-- sys/net/if_wg.c | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/sys/net/if_gif.c b/sys/net/if_gif.c index 4aa1cc77ebc..ebaa30e7806 100644 --- a/sys/net/if_gif.c +++ b/sys/net/if_gif.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_gif.c,v 1.136 2023/12/23 10:52:54 bluhm Exp $ */ +/* $OpenBSD: if_gif.c,v 1.137 2024/01/01 18:47:02 mvs Exp $ */ /* $KAME: if_gif.c,v 1.43 2001/02/20 08:51:07 itojun Exp $ */ /* @@ -174,9 +174,9 @@ gif_clone_create(struct if_clone *ifc, int unit) ifp->if_type = IFT_GIF; ifp->if_softc = sc; + if_counters_alloc(ifp); 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_mpe.c b/sys/net/if_mpe.c index a72347b4c3c..9f26a901188 100644 --- a/sys/net/if_mpe.c +++ b/sys/net/if_mpe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_mpe.c,v 1.104 2023/12/23 10:52:54 bluhm Exp $ */ +/* $OpenBSD: if_mpe.c,v 1.105 2024/01/01 18:47:02 mvs Exp $ */ /* * Copyright (c) 2008 Pierre-Yves Ritschard @@ -117,9 +117,9 @@ mpe_clone_create(struct if_clone *ifc, int unit) sc->sc_dead = 0; + if_counters_alloc(ifp); 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 8daac934664..761a1fe5a20 100644 --- a/sys/net/if_mpip.c +++ b/sys/net/if_mpip.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_mpip.c,v 1.18 2023/12/23 10:52:54 bluhm Exp $ */ +/* $OpenBSD: if_mpip.c,v 1.19 2024/01/01 18:47:02 mvs Exp $ */ /* * Copyright (c) 2015 Rafael Zalamena @@ -120,8 +120,8 @@ mpip_clone_create(struct if_clone *ifc, int unit) ifp->if_mtu = 1500; ifp->if_hardmtu = 65535; - if_attach(ifp); if_counters_alloc(ifp); + if_attach(ifp); if_alloc_sadl(ifp); #if NBPFILTER > 0 diff --git a/sys/net/if_wg.c b/sys/net/if_wg.c index a55fba2afde..dcd50255fad 100644 --- a/sys/net/if_wg.c +++ b/sys/net/if_wg.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_wg.c,v 1.34 2023/12/23 10:52:54 bluhm Exp $ */ +/* $OpenBSD: if_wg.c,v 1.35 2024/01/01 18:47:02 mvs Exp $ */ /* * Copyright (C) 2015-2020 Jason A. Donenfeld . All Rights Reserved. @@ -2691,9 +2691,9 @@ wg_clone_create(struct if_clone *ifc, int unit) ifp->if_type = IFT_WIREGUARD; ifp->if_rtrequest = p2p_rtrequest; + if_counters_alloc(ifp); if_attach(ifp); if_alloc_sadl(ifp); - if_counters_alloc(ifp); #if NBPFILTER > 0 bpfattach(&ifp->if_bpf, ifp, DLT_LOOP, sizeof(uint32_t)); -- 2.20.1