* Map interface name to interface structure pointer, with or without * returning a reference. */
| 2354 | * returning a reference. |
| 2355 | */ |
| 2356 | struct ifnet * |
| 2357 | ifunit_ref(const char *name) |
| 2358 | { |
| 2359 | struct epoch_tracker et; |
| 2360 | struct ifnet *ifp; |
| 2361 | |
| 2362 | NET_EPOCH_ENTER(et); |
| 2363 | CK_STAILQ_FOREACH(ifp, &V_ifnet, if_link) { |
| 2364 | if (strncmp(name, ifp->if_xname, IFNAMSIZ) == 0 && |
| 2365 | !(ifp->if_flags & IFF_DYING)) |
| 2366 | break; |
| 2367 | } |
| 2368 | if (ifp != NULL) |
| 2369 | if_ref(ifp); |
| 2370 | NET_EPOCH_EXIT(et); |
| 2371 | return (ifp); |
| 2372 | } |
| 2373 | |
| 2374 | struct ifnet * |
| 2375 | ifunit(const char *name) |
no test coverage detected