summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormvs <mvs@openbsd.org>2021-01-21 13:17:13 +0000
committermvs <mvs@openbsd.org>2021-01-21 13:17:13 +0000
commit2512f120b4360b72c5c5fd8b0cc5e1cf6e18bb8e (patch)
tree893db33dbf5a91900f47066748ceb30750a3c268
parentremove an unneccessary escape; from martin vahlensieck (diff)
downloadwireguard-openbsd-2512f120b4360b72c5c5fd8b0cc5e1cf6e18bb8e.tar.xz
wireguard-openbsd-2512f120b4360b72c5c5fd8b0cc5e1cf6e18bb8e.zip
vlan(4): convert ifunit() to if_unit(9)
ok dlg@ kn@
-rw-r--r--sys/net/if_vlan.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/sys/net/if_vlan.c b/sys/net/if_vlan.c
index c5a08e63950..b0bf72d2cb6 100644
--- a/sys/net/if_vlan.c
+++ b/sys/net/if_vlan.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_vlan.c,v 1.204 2020/07/22 01:30:54 dlg Exp $ */
+/* $OpenBSD: if_vlan.c,v 1.205 2021/01/21 13:17:13 mvs Exp $ */
/*
* Copyright 1998 Massachusetts Institute of Technology
@@ -887,31 +887,37 @@ vlan_set_parent(struct vlan_softc *sc, const char *parent)
struct ifnet *ifp0;
int error = 0;
- ifp0 = ifunit(parent); /* doesn't need an if_put */
+ ifp0 = if_unit(parent);
if (ifp0 == NULL)
return (EINVAL);
- if (ifp0->if_type != IFT_ETHER)
- return (EPROTONOSUPPORT);
+ if (ifp0->if_type != IFT_ETHER) {
+ error = EPROTONOSUPPORT;
+ goto put;
+ }
if (sc->sc_ifidx0 == ifp0->if_index) {
/* nop */
- return (0);
+ goto put;
}
- if (ISSET(ifp->if_flags, IFF_RUNNING))
- return (EBUSY);
+ if (ISSET(ifp->if_flags, IFF_RUNNING)) {
+ error = EBUSY;
+ goto put;
+ }
error = vlan_inuse(sc->sc_type, ifp0->if_index, sc->sc_tag);
if (error != 0)
- return (error);
+ goto put;
/* commit */
sc->sc_ifidx0 = ifp0->if_index;
if (!ISSET(sc->sc_flags, IFVF_LLADDR))
if_setlladdr(ifp, LLADDR(ifp0->if_sadl));
- return (0);
+put:
+ if_put(ifp0);
+ return (error);
}
int