| 350 | } |
| 351 | |
| 352 | struct ifnet * |
| 353 | ifnet_byindex_ref(u_short idx) |
| 354 | { |
| 355 | struct ifnet *ifp; |
| 356 | |
| 357 | NET_EPOCH_ASSERT(); |
| 358 | |
| 359 | ifp = ifnet_byindex(idx); |
| 360 | if (ifp == NULL || (ifp->if_flags & IFF_DYING)) |
| 361 | return (NULL); |
| 362 | if_ref(ifp); |
| 363 | return (ifp); |
| 364 | } |
| 365 | |
| 366 | /* |
| 367 | * Allocate an ifindex array entry; return 0 on success or an error on |
no test coverage detected