-/* $OpenBSD: if_tpmr.c,v 1.21 2020/12/12 00:39:07 dlg Exp $ */
+/* $OpenBSD: if_tpmr.c,v 1.22 2021/01/19 07:31:05 mvs Exp $ */
/*
* Copyright (c) 2019 The University of Queensland
if (sc->sc_nports >= nitems(sc->sc_ports))
return (ENOSPC);
- ifp0 = ifunit(req->ifbr_ifsname);
+ ifp0 = if_unit(req->ifbr_ifsname);
if (ifp0 == NULL)
return (EINVAL);
- if (ifp0->if_type != IFT_ETHER)
- return (EPROTONOSUPPORT);
+ if (ifp0->if_type != IFT_ETHER) {
+ error = EPROTONOSUPPORT;
+ goto put;
+ }
error = ether_brport_isset(ifp0);
if (error != 0)
- return (error);
+ goto put;
/* let's try */
- ifp0 = if_get(ifp0->if_index); /* get an actual reference */
- if (ifp0 == NULL) {
- /* XXX this should never happen */
- return (EINVAL);
- }
-
p = malloc(sizeof(*p), M_DEVBUF, M_WAITOK|M_ZERO|M_CANFAIL);
if (p == NULL) {
error = ENOMEM;