summaryrefslogtreecommitdiff
path: root/sys/net
diff options
context:
space:
mode:
authorriastradh <riastradh@NetBSD.org>2021-06-16 00:21:17 +0000
committerriastradh <riastradh@NetBSD.org>2021-06-16 00:21:17 +0000
commitbbdda93be2f0bfefe91466b398fe42700a6ea284 (patch)
treee75e77046575209dbb21f73d0bc44c61ec0ec6c0 /sys/net
parent5a96957fa793651c8e7093a5a4c2fcae87232af2 (diff)
if_attach and if_initialize cannot fail, don't test return value
These were originally made failable back in 2017 when if_initialize allocated a softint in every interface for link state changes, so that it could fail gracefully instead of panicking: https://mail-index.NetBSD.org/source-changes/2017/10/23/msg089053.html However, this spawned many seldom- or never-tested error branches, which are risky to have around. And that softint in every interface has since been replaced by a single global workqueue, because link state changes require thread context but not low latency or high throughput: https://mail-index.NetBSD.org/source-changes/2020/02/06/msg113759.html So there is no longer any reason for if_initialize to fail. (The subroutine if_stats_init can't fail because percpu_alloc can't fail either.) There is a snag: the softint_establish in if_percpuq_create could fail, potentially leading to bad consequences later on trying to use the softint. This change doesn't introduce any new bugs because of the snag -- if_percpuq_attach was already broken. However, the snag can be better addressed without spawning error branches, either by using a single softint or making softints less scarce. (Separate commit will change the signatures of if_attach and if_initialize to return void, scheduled to ride whatever is the next convenient kernel bump.) Patch and testing on amd64 and evbmips64-eb by maya@; commit message soliloquy, and compile-testing on evbppc/i386/earmv7hf, by me.
Diffstat (limited to 'sys/net')
-rw-r--r--sys/net/if_arcsubr.c9
-rw-r--r--sys/net/if_bridge.c18
-rw-r--r--sys/net/if_faith.c11
-rw-r--r--sys/net/if_gif.c9
-rw-r--r--sys/net/if_l2tp.c9
-rw-r--r--sys/net/if_loop.c11
-rw-r--r--sys/net/if_mpls.c12
-rw-r--r--sys/net/if_pppoe.c11
-rw-r--r--sys/net/if_srt.c13
-rw-r--r--sys/net/if_stf.c15
-rw-r--r--sys/net/if_tap.c14
-rw-r--r--sys/net/if_vlan.c26
-rw-r--r--sys/net/if_wg.c10
-rw-r--r--sys/net/lagg/if_lagg.c11
14 files changed, 42 insertions, 137 deletions
diff --git a/sys/net/if_arcsubr.c b/sys/net/if_arcsubr.c
index 6bad98eff19..80f4b7e5563 100644
--- a/sys/net/if_arcsubr.c
+++ b/sys/net/if_arcsubr.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_arcsubr.c,v 1.82 2020/08/28 06:23:42 ozaki-r Exp $ */
+/* $NetBSD: if_arcsubr.c,v 1.83 2021/06/16 00:21:19 riastradh Exp $ */
/*
* Copyright (c) 1994, 1995 Ignatios Souvatzis
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_arcsubr.c,v 1.82 2020/08/28 06:23:42 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_arcsubr.c,v 1.83 2021/06/16 00:21:19 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -605,7 +605,6 @@ int
arc_ifattach(struct ifnet *ifp, uint8_t lla)
{
struct arccom *ac;
- int rv;
ifp->if_type = IFT_ARCNET;
ifp->if_addrlen = 1;
@@ -627,9 +626,7 @@ arc_ifattach(struct ifnet *ifp, uint8_t lla)
log(LOG_ERR,"%s: link address 0 reserved for broadcasts. Please change it and ifconfig %s down up\n",
ifp->if_xname, ifp->if_xname);
}
- rv = if_attach(ifp);
- if (rv != 0)
- return rv;
+ if_attach(ifp);
if_set_sadl(ifp, &lla, sizeof(lla), true);
diff --git a/sys/net/if_bridge.c b/sys/net/if_bridge.c
index 54c9a34e23f..8d639221dae 100644
--- a/sys/net/if_bridge.c
+++ b/sys/net/if_bridge.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_bridge.c,v 1.179 2021/02/19 14:51:59 christos Exp $ */
+/* $NetBSD: if_bridge.c,v 1.180 2021/06/16 00:21:19 riastradh Exp $ */
/*
* Copyright 2001 Wasabi Systems, Inc.
@@ -80,7 +80,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_bridge.c,v 1.179 2021/02/19 14:51:59 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bridge.c,v 1.180 2021/06/16 00:21:19 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -451,19 +451,7 @@ bridge_clone_create(struct if_clone *ifc, int unit)
ifp->if_addrlen = 0;
ifp->if_dlt = DLT_EN10MB;
ifp->if_hdrlen = ETHER_HDR_LEN;
-
- error = if_initialize(ifp);
- if (error != 0) {
- pserialize_destroy(sc->sc_iflist_psref.bip_psz);
- mutex_destroy(&sc->sc_iflist_psref.bip_lock);
- callout_destroy(&sc->sc_brcallout);
- callout_destroy(&sc->sc_bstpcallout);
- workqueue_destroy(sc->sc_rtage_wq);
- bridge_rtable_fini(sc);
- kmem_free(sc, sizeof(*sc));
-
- return error;
- }
+ if_initialize(ifp);
/*
* Set the link state to down.
diff --git a/sys/net/if_faith.c b/sys/net/if_faith.c
index 3159fcf5904..2590bb2f76a 100644
--- a/sys/net/if_faith.c
+++ b/sys/net/if_faith.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_faith.c,v 1.61 2020/01/29 04:18:34 thorpej Exp $ */
+/* $NetBSD: if_faith.c,v 1.62 2021/06/16 00:21:19 riastradh Exp $ */
/* $KAME: if_faith.c,v 1.21 2001/02/20 07:59:26 itojun Exp $ */
/*
@@ -40,7 +40,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_faith.c,v 1.61 2020/01/29 04:18:34 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_faith.c,v 1.62 2021/06/16 00:21:19 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -137,7 +137,6 @@ static int
faith_clone_create(struct if_clone *ifc, int unit)
{
struct ifnet *ifp;
- int rv;
ifp = if_alloc(IFT_FAITH);
@@ -152,11 +151,7 @@ faith_clone_create(struct if_clone *ifc, int unit)
ifp->if_hdrlen = 0;
ifp->if_addrlen = 0;
ifp->if_dlt = DLT_NULL;
- rv = if_attach(ifp);
- if (rv != 0) {
- if_free(ifp);
- return rv;
- }
+ if_attach(ifp);
if_alloc_sadl(ifp);
bpf_attach(ifp, DLT_NULL, sizeof(u_int));
atomic_inc_uint(&faith_count);
diff --git a/sys/net/if_gif.c b/sys/net/if_gif.c
index f346da1fea1..e71b37034e9 100644
--- a/sys/net/if_gif.c
+++ b/sys/net/if_gif.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_gif.c,v 1.154 2020/10/14 15:22:17 roy Exp $ */
+/* $NetBSD: if_gif.c,v 1.155 2021/06/16 00:21:19 riastradh Exp $ */
/* $KAME: if_gif.c,v 1.76 2001/08/20 02:01:02 kjc Exp $ */
/*
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_gif.c,v 1.154 2020/10/14 15:22:17 roy Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_gif.c,v 1.155 2021/06/16 00:21:19 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -379,7 +379,6 @@ gif_clone_create(struct if_clone *ifc, int unit)
static int
gifattach0(struct gif_softc *sc)
{
- int rv;
sc->gif_if.if_addrlen = 0;
sc->gif_if.if_mtu = GIF_MTU;
@@ -395,9 +394,7 @@ gifattach0(struct gif_softc *sc)
sc->gif_if.if_dlt = DLT_NULL;
sc->gif_if.if_softc = sc;
IFQ_SET_READY(&sc->gif_if.if_snd);
- rv = if_initialize(&sc->gif_if);
- if (rv != 0)
- return rv;
+ if_initialize(&sc->gif_if);
sc->gif_if.if_link_state = LINK_STATE_DOWN;
if_alloc_sadl(&sc->gif_if);
diff --git a/sys/net/if_l2tp.c b/sys/net/if_l2tp.c
index aa3c10be429..af2ce9baec4 100644
--- a/sys/net/if_l2tp.c
+++ b/sys/net/if_l2tp.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_l2tp.c,v 1.46 2020/10/25 08:18:39 roy Exp $ */
+/* $NetBSD: if_l2tp.c,v 1.47 2021/06/16 00:21:19 riastradh Exp $ */
/*
* Copyright (c) 2017 Internet Initiative Japan Inc.
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_l2tp.c,v 1.46 2020/10/25 08:18:39 roy Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_l2tp.c,v 1.47 2021/06/16 00:21:19 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -281,7 +281,6 @@ l2tp_clone_create(struct if_clone *ifc, int unit)
int
l2tpattach0(struct l2tp_softc *sc)
{
- int rv;
sc->l2tp_ec.ec_if.if_addrlen = 0;
sc->l2tp_ec.ec_if.if_mtu = L2TP_MTU;
@@ -321,9 +320,7 @@ l2tpattach0(struct l2tp_softc *sc)
* if_percpuq_enqueue(). However, that causes recursive softnet_lock
* when NET_MPSAFE is not set.
*/
- rv = if_attach(&sc->l2tp_ec.ec_if);
- if (rv != 0)
- return rv;
+ if_attach(&sc->l2tp_ec.ec_if);
if_link_state_change(&sc->l2tp_ec.ec_if, LINK_STATE_DOWN);
if_alloc_sadl(&sc->l2tp_ec.ec_if);
bpf_attach(&sc->l2tp_ec.ec_if, DLT_EN10MB, sizeof(struct ether_header));
diff --git a/sys/net/if_loop.c b/sys/net/if_loop.c
index 6e4c8dcf484..ff2a401d53a 100644
--- a/sys/net/if_loop.c
+++ b/sys/net/if_loop.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_loop.c,v 1.112 2020/10/14 16:10:32 roy Exp $ */
+/* $NetBSD: if_loop.c,v 1.113 2021/06/16 00:21:19 riastradh Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -65,7 +65,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_loop.c,v 1.112 2020/10/14 16:10:32 roy Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_loop.c,v 1.113 2021/06/16 00:21:19 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -175,7 +175,6 @@ static int
loop_clone_create(struct if_clone *ifc, int unit)
{
struct ifnet *ifp;
- int rv;
ifp = if_alloc(IFT_LOOP);
@@ -198,11 +197,7 @@ loop_clone_create(struct if_clone *ifc, int unit)
IFQ_SET_READY(&ifp->if_snd);
if (unit == 0)
lo0ifp = ifp;
- rv = if_initialize(ifp);
- if (rv != 0) {
- if_free(ifp);
- return rv;
- }
+ if_initialize(ifp);
ifp->if_link_state = LINK_STATE_UP;
if_alloc_sadl(ifp);
bpf_attach(ifp, DLT_NULL, sizeof(u_int));
diff --git a/sys/net/if_mpls.c b/sys/net/if_mpls.c
index 849402cbea6..a6fbc6957ae 100644
--- a/sys/net/if_mpls.c
+++ b/sys/net/if_mpls.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_mpls.c,v 1.36 2020/01/29 04:18:34 thorpej Exp $ */
+/* $NetBSD: if_mpls.c,v 1.37 2021/06/16 00:21:19 riastradh Exp $ */
/*
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_mpls.c,v 1.36 2020/01/29 04:18:34 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mpls.c,v 1.37 2021/06/16 00:21:19 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -139,7 +139,6 @@ static int
mpls_clone_create(struct if_clone *ifc, int unit)
{
struct mpls_softc *sc;
- int rv;
atomic_inc_uint(&mpls_count);
sc = malloc(sizeof(*sc), M_DEVBUF, M_WAITOK | M_ZERO);
@@ -156,12 +155,7 @@ mpls_clone_create(struct if_clone *ifc, int unit)
sc->sc_if.if_output = mpls_output;
sc->sc_if.if_ioctl = mpls_ioctl;
- rv = if_attach(&sc->sc_if);
- if (rv != 0) {
- free(sc, M_DEVBUF);
- atomic_dec_uint(&mpls_count);
- return rv;
- }
+ if_attach(&sc->sc_if);
if_alloc_sadl(&sc->sc_if);
bpf_attach(&sc->sc_if, DLT_NULL, sizeof(uint32_t));
return 0;
diff --git a/sys/net/if_pppoe.c b/sys/net/if_pppoe.c
index 4f5769a6108..98c8e64c046 100644
--- a/sys/net/if_pppoe.c
+++ b/sys/net/if_pppoe.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_pppoe.c,v 1.176 2021/05/19 03:44:46 yamaguchi Exp $ */
+/* $NetBSD: if_pppoe.c,v 1.177 2021/06/16 00:21:19 riastradh Exp $ */
/*
* Copyright (c) 2002, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_pppoe.c,v 1.176 2021/05/19 03:44:46 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_pppoe.c,v 1.177 2021/06/16 00:21:19 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "pppoe.h"
@@ -389,9 +389,7 @@ pppoe_clone_create(struct if_clone *ifc, int unit)
callout_init(&sc->sc_timeout, CALLOUT_MPSAFE);
callout_setfunc(&sc->sc_timeout, pppoe_timeout_co, sc);
- rv = if_initialize(ifp);
- if (rv != 0)
- goto destroy_timeout;
+ if_initialize(ifp);
ifp->if_percpuq = if_percpuq_create(ifp);
@@ -408,9 +406,6 @@ pppoe_clone_create(struct if_clone *ifc, int unit)
return 0;
-destroy_timeout:
- callout_destroy(&sc->sc_timeout);
- workqueue_destroy(sc->sc_timeout_wq);
destroy_sclock:
rw_destroy(&sc->sc_lock);
kmem_free(sc, sizeof(*sc));
diff --git a/sys/net/if_srt.c b/sys/net/if_srt.c
index a1719532b3a..edff0d9987c 100644
--- a/sys/net/if_srt.c
+++ b/sys/net/if_srt.c
@@ -1,8 +1,8 @@
-/* $NetBSD: if_srt.c,v 1.31 2020/01/29 04:28:27 thorpej Exp $ */
+/* $NetBSD: if_srt.c,v 1.32 2021/06/16 00:21:19 riastradh Exp $ */
/* This file is in the public domain. */
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_srt.c,v 1.31 2020/01/29 04:28:27 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_srt.c,v 1.32 2021/06/16 00:21:19 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -272,7 +272,6 @@ static int
srt_clone_create(struct if_clone *cl, int unit)
{
struct srt_softc *sc;
- int rv;
if (unit < 0 || unit > SRT_MAXUNIT)
return ENXIO;
@@ -292,13 +291,7 @@ srt_clone_create(struct if_clone *cl, int unit)
sc->intf.if_ioctl = &srt_if_ioctl;
sc->intf.if_output = &srt_if_output;
sc->intf.if_dlt = DLT_RAW;
- rv = if_attach(&sc->intf);
- if (rv != 0) {
- aprint_error("%s: if_initialize failed(%d)\n",
- sc->intf.if_xname, rv);
- free(sc, M_DEVBUF);
- return rv;
- }
+ if_attach(&sc->intf);
if_alloc_sadl(&sc->intf);
#ifdef BPFILTER_NOW_AVAILABLE
bpf_attach(&sc->intf, 0, 0);
diff --git a/sys/net/if_stf.c b/sys/net/if_stf.c
index 5e9d824d741..9f70db8e9da 100644
--- a/sys/net/if_stf.c
+++ b/sys/net/if_stf.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_stf.c,v 1.107 2020/01/29 04:28:27 thorpej Exp $ */
+/* $NetBSD: if_stf.c,v 1.108 2021/06/16 00:21:19 riastradh Exp $ */
/* $KAME: if_stf.c,v 1.62 2001/06/07 22:32:16 itojun Exp $ */
/*
@@ -75,7 +75,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_stf.c,v 1.107 2020/01/29 04:28:27 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_stf.c,v 1.108 2021/06/16 00:21:19 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -236,16 +236,7 @@ stf_clone_create(struct if_clone *ifc, int unit)
sc->sc_if.if_output = stf_output;
sc->sc_if.if_type = IFT_STF;
sc->sc_if.if_dlt = DLT_NULL;
- error = if_attach(&sc->sc_if);
- if (error != 0) {
- aprint_error("%s: if_initialize failed(%d)\n",
- if_name(&sc->sc_if), error);
- encap_lock_enter();
- encap_detach(sc->encap_cookie);
- encap_lock_exit();
- free(sc, M_DEVBUF);
- return error;
- }
+ if_attach(&sc->sc_if);
if_alloc_sadl(&sc->sc_if);
bpf_attach(&sc->sc_if, DLT_NULL, sizeof(u_int));
LIST_INSERT_HEAD(&stf_softc_list, sc, sc_list);
diff --git a/sys/net/if_tap.c b/sys/net/if_tap.c
index ce947c469e6..a97010c9ecf 100644
--- a/sys/net/if_tap.c
+++ b/sys/net/if_tap.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_tap.c,v 1.121 2020/12/18 01:31:49 thorpej Exp $ */
+/* $NetBSD: if_tap.c,v 1.122 2021/06/16 00:21:19 riastradh Exp $ */
/*
* Copyright (c) 2003, 2004, 2008, 2009 The NetBSD Foundation.
@@ -33,7 +33,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_tap.c,v 1.121 2020/12/18 01:31:49 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_tap.c,v 1.122 2021/06/16 00:21:19 riastradh Exp $");
#if defined(_KERNEL_OPT)
@@ -346,15 +346,7 @@ tap_attach(device_t parent, device_t self, void *aux)
sc->sc_ec.ec_capabilities = ETHERCAP_VLAN_MTU | ETHERCAP_JUMBO_MTU;
/* Those steps are mandatory for an Ethernet driver. */
- error = if_initialize(ifp);
- if (error != 0) {
- aprint_error_dev(self, "if_initialize failed(%d)\n", error);
- pmf_device_deregister(self);
- mutex_destroy(&sc->sc_lock);
- seldestroy(&sc->sc_rsel);
-
- return; /* Error */
- }
+ if_initialize(ifp);
ifp->if_percpuq = if_percpuq_create(ifp);
ether_ifattach(ifp, enaddr);
/* Opening the device will bring the link state up. */
diff --git a/sys/net/if_vlan.c b/sys/net/if_vlan.c
index 7901267f805..33eabe4a6f4 100644
--- a/sys/net/if_vlan.c
+++ b/sys/net/if_vlan.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_vlan.c,v 1.153 2020/09/26 18:38:09 roy Exp $ */
+/* $NetBSD: if_vlan.c,v 1.154 2021/06/16 00:21:19 riastradh Exp $ */
/*
* Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
@@ -78,7 +78,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_vlan.c,v 1.153 2020/09/26 18:38:09 roy Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vlan.c,v 1.154 2021/06/16 00:21:19 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -333,7 +333,6 @@ vlan_clone_create(struct if_clone *ifc, int unit)
struct ifvlan *ifv;
struct ifnet *ifp;
struct ifvlan_linkmib *mib;
- int rv;
ifv = malloc(sizeof(struct ifvlan), M_DEVBUF, M_WAITOK | M_ZERO);
mib = kmem_zalloc(sizeof(struct ifvlan_linkmib), KM_SLEEP);
@@ -362,14 +361,7 @@ vlan_clone_create(struct if_clone *ifc, int unit)
ifp->if_transmit = vlan_transmit;
ifp->if_ioctl = vlan_ioctl;
IFQ_SET_READY(&ifp->if_snd);
-
- rv = if_initialize(ifp);
- if (rv != 0) {
- aprint_error("%s: if_initialize failed(%d)\n", ifp->if_xname,
- rv);
- goto fail;
- }
-
+ if_initialize(ifp);
/*
* Set the link state to down.
* When the parent interface attaches we will use that link state.
@@ -380,18 +372,6 @@ vlan_clone_create(struct if_clone *ifc, int unit)
vlan_reset_linkname(ifp);
if_register(ifp);
return 0;
-
-fail:
- mutex_enter(&ifv_list.lock);
- LIST_REMOVE(ifv, ifv_list);
- mutex_exit(&ifv_list.lock);
-
- mutex_destroy(&ifv->ifv_lock);
- psref_target_destroy(&ifv->ifv_mib->ifvm_psref, ifvm_psref_class);
- kmem_free(ifv->ifv_mib, sizeof(struct ifvlan_linkmib));
- free(ifv, M_DEVBUF);
-
- return rv;
}
static int
diff --git a/sys/net/if_wg.c b/sys/net/if_wg.c
index f4b256c6fa1..58745d78ff5 100644
--- a/sys/net/if_wg.c
+++ b/sys/net/if_wg.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_wg.c,v 1.63 2021/04/29 17:55:51 riastradh Exp $ */
+/* $NetBSD: if_wg.c,v 1.64 2021/06/16 00:21:19 riastradh Exp $ */
/*
* Copyright (C) Ryota Ozaki <ozaki.ryota@gmail.com>
@@ -41,7 +41,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_wg.c,v 1.63 2021/04/29 17:55:51 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wg.c,v 1.64 2021/06/16 00:21:19 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_altq_enabled.h"
@@ -3558,7 +3558,6 @@ wg_destroy_peer_name(struct wg_softc *wg, const char *name)
static int
wg_if_attach(struct wg_softc *wg)
{
- int error;
wg->wg_if.if_addrlen = 0;
wg->wg_if.if_mtu = WG_MTU;
@@ -3577,10 +3576,7 @@ wg_if_attach(struct wg_softc *wg)
#ifdef ALTQ
IFQ_SET_READY(&wg->wg_if.if_snd);
#endif
-
- error = if_initialize(&wg->wg_if);
- if (error != 0)
- return error;
+ if_initialize(&wg->wg_if);
wg->wg_if.if_link_state = LINK_STATE_DOWN;
if_alloc_sadl(&wg->wg_if);
diff --git a/sys/net/lagg/if_lagg.c b/sys/net/lagg/if_lagg.c
index 586b0ed1626..2e3073e96f3 100644
--- a/sys/net/lagg/if_lagg.c
+++ b/sys/net/lagg/if_lagg.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_lagg.c,v 1.4 2021/05/24 13:42:58 thorpej Exp $ */
+/* $NetBSD: if_lagg.c,v 1.5 2021/06/16 00:21:19 riastradh Exp $ */
/*
* Copyright (c) 2005, 2006 Reyk Floeter <reyk@openbsd.org>
@@ -20,7 +20,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_lagg.c,v 1.4 2021/05/24 13:42:58 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_lagg.c,v 1.5 2021/06/16 00:21:19 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -381,9 +381,7 @@ lagg_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);
- error = if_initialize(ifp);
- if (error != 0)
- goto cleanup_ifmedia;
+ if_initialize(ifp);
switch (lagg_iftype) {
case LAGG_IF_TYPE_ETHERNET:
@@ -406,9 +404,6 @@ lagg_clone_create(struct if_clone *ifc, int unit)
return 0;
-cleanup_ifmedia:
- ifmedia_fini(&sc->sc_media);
- lagg_teardown_sysctls(sc);
destroy_psz:
pserialize_destroy(sc->sc_psz);
mutex_destroy(&sc->sc_lock);