-/* $OpenBSD: if_gre.c,v 1.163 2020/12/12 11:49:02 jan Exp $ */
+/* $OpenBSD: if_gre.c,v 1.164 2021/01/19 07:31:47 mvs Exp $ */
/* $NetBSD: if_gre.c,v 1.9 1999/10/25 19:18:11 drochner Exp $ */
/*
{
struct ifnet *ifp0;
- ifp0 = ifunit(parent); /* doesn't need an if_put */
+ ifp0 = if_unit(parent);
if (ifp0 == NULL)
return (EINVAL);
- if (!ISSET(ifp0->if_flags, IFF_MULTICAST))
+ if (!ISSET(ifp0->if_flags, IFF_MULTICAST)) {
+ if_put(ifp0);
return (EPROTONOSUPPORT);
+ }
/* commit */
sc->sc_ifp0 = ifp0->if_index;
+ if_put(ifp0);
return (0);
}