* Lookup and create a clone network interface. */
| 175 | * Lookup and create a clone network interface. |
| 176 | */ |
| 177 | int |
| 178 | if_clone_create(char *name, size_t len, caddr_t params) |
| 179 | { |
| 180 | struct if_clone *ifc; |
| 181 | |
| 182 | /* Try to find an applicable cloner for this request */ |
| 183 | IF_CLONERS_LOCK(); |
| 184 | LIST_FOREACH(ifc, &V_if_cloners, ifc_list) |
| 185 | if (ifc->ifc_type == SIMPLE) { |
| 186 | if (ifc_simple_match(ifc, name)) |
| 187 | break; |
| 188 | } else { |
| 189 | if (ifc->ifc_match(ifc, name)) |
| 190 | break; |
| 191 | } |
| 192 | #ifdef VIMAGE |
| 193 | if (ifc == NULL && !IS_DEFAULT_VNET(curvnet)) { |
| 194 | CURVNET_SET_QUIET(vnet0); |
| 195 | LIST_FOREACH(ifc, &V_if_cloners, ifc_list) |
| 196 | if (ifc->ifc_type == SIMPLE) { |
| 197 | if (ifc_simple_match(ifc, name)) |
| 198 | break; |
| 199 | } else { |
| 200 | if (ifc->ifc_match(ifc, name)) |
| 201 | break; |
| 202 | } |
| 203 | CURVNET_RESTORE(); |
| 204 | } |
| 205 | #endif |
| 206 | IF_CLONERS_UNLOCK(); |
| 207 | |
| 208 | if (ifc == NULL) |
| 209 | return (EINVAL); |
| 210 | |
| 211 | return (if_clone_createif(ifc, name, len, params)); |
| 212 | } |
| 213 | |
| 214 | void |
| 215 | if_clone_addif(struct if_clone *ifc, struct ifnet *ifp) |
no test coverage detected