* Create a clone network interface. */
| 227 | * Create a clone network interface. |
| 228 | */ |
| 229 | static int |
| 230 | if_clone_createif(struct if_clone *ifc, char *name, size_t len, caddr_t params) |
| 231 | { |
| 232 | int err; |
| 233 | struct ifnet *ifp; |
| 234 | |
| 235 | if (ifunit(name) != NULL) |
| 236 | return (EEXIST); |
| 237 | |
| 238 | if (ifc->ifc_type == SIMPLE) |
| 239 | err = ifc_simple_create(ifc, name, len, params); |
| 240 | else |
| 241 | err = (*ifc->ifc_create)(ifc, name, len, params); |
| 242 | |
| 243 | if (!err) { |
| 244 | ifp = ifunit(name); |
| 245 | if (ifp == NULL) |
| 246 | panic("%s: lookup failed for %s", __func__, name); |
| 247 | |
| 248 | if_clone_addif(ifc, ifp); |
| 249 | } |
| 250 | |
| 251 | return (err); |
| 252 | } |
| 253 | |
| 254 | /* |
| 255 | * Lookup and destroy a clone network interface. |
no test coverage detected