-/* $OpenBSD: if.c,v 1.625 2021/01/18 09:55:43 mvs Exp $ */
+/* $OpenBSD: if.c,v 1.626 2021/02/01 07:43:33 mvs Exp $ */
/* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */
/*
}
/*
- * Map interface name to interface structure pointer (legacy).
+ * Map interface name to interface structure pointer.
*/
struct ifnet *
-ifunit(const char *name)
+if_unit(const char *name)
{
struct ifnet *ifp;
KERNEL_ASSERT_LOCKED();
TAILQ_FOREACH(ifp, &ifnet, if_list) {
- if (strcmp(ifp->if_xname, name) == 0)
+ if (strcmp(ifp->if_xname, name) == 0) {
+ if_ref(ifp);
return (ifp);
+ }
}
- return (NULL);
-}
-
-/*
- * Map interface name to interface structure pointer.
- */
-struct ifnet *
-if_unit(const char *name)
-{
- struct ifnet *ifp;
-
- if ((ifp = ifunit(name)) != NULL)
- if_ref(ifp);
- return (ifp);
+ return (NULL);
}
/*
-/* $OpenBSD: if.h,v 1.205 2021/01/18 09:55:43 mvs Exp $ */
+/* $OpenBSD: if.h,v 1.206 2021/02/01 07:43:33 mvs Exp $ */
/* $NetBSD: if.h,v 1.23 1996/05/07 02:40:27 thorpej Exp $ */
/*
int if_addgroup(struct ifnet *, const char *);
int if_delgroup(struct ifnet *, const char *);
void if_group_routechange(struct sockaddr *, struct sockaddr *);
-struct ifnet *ifunit(const char *);
struct ifnet *if_unit(const char *);
struct ifnet *if_get(unsigned int);
void if_put(struct ifnet *);