* Detach an interface, removing it from the list of "active" interfaces. * If vmove flag is set on entry to if_detach_internal(), perform only a * limited subset of cleanup tasks, given that we are moving an ifnet from * one vnet to another, where it must be fully operational. * * XXXRW: There are some significant questions about event ordering, and * how to prevent things from starting to u
| 1116 | * how to prevent things from starting to use the interface during detach. |
| 1117 | */ |
| 1118 | void |
| 1119 | if_detach(struct ifnet *ifp) |
| 1120 | { |
| 1121 | bool found; |
| 1122 | |
| 1123 | CURVNET_SET_QUIET(ifp->if_vnet); |
| 1124 | found = if_unlink_ifnet(ifp, false); |
| 1125 | if (found) { |
| 1126 | sx_xlock(&ifnet_detach_sxlock); |
| 1127 | if_detach_internal(ifp, 0, NULL); |
| 1128 | sx_xunlock(&ifnet_detach_sxlock); |
| 1129 | } |
| 1130 | CURVNET_RESTORE(); |
| 1131 | } |
| 1132 | |
| 1133 | /* |
| 1134 | * The vmove flag, if set, indicates that we are called from a callpath |
no test coverage detected