| 974 | } |
| 975 | |
| 976 | static int |
| 977 | vlan_clone_create(struct if_clone *ifc, char *name, size_t len, caddr_t params) |
| 978 | { |
| 979 | char *dp; |
| 980 | bool wildcard = false; |
| 981 | bool subinterface = false; |
| 982 | int unit; |
| 983 | int error; |
| 984 | int vid = 0; |
| 985 | uint16_t proto = ETHERTYPE_VLAN; |
| 986 | struct ifvlan *ifv; |
| 987 | struct ifnet *ifp; |
| 988 | struct ifnet *p = NULL; |
| 989 | struct ifaddr *ifa; |
| 990 | struct sockaddr_dl *sdl; |
| 991 | struct vlanreq vlr; |
| 992 | static const u_char eaddr[ETHER_ADDR_LEN]; /* 00:00:00:00:00:00 */ |
| 993 | |
| 994 | |
| 995 | /* |
| 996 | * There are three ways to specify the cloned device: |
| 997 | * o pass a parameter block with the clone request. |
| 998 | * o specify parameters in the text of the clone device name |
| 999 | * o specify no parameters and get an unattached device that |
| 1000 | * must be configured separately. |
| 1001 | * The first technique is preferred; the latter two are supported |
| 1002 | * for backwards compatibility. |
| 1003 | * |
| 1004 | * XXXRW: Note historic use of the word "tag" here. New ioctls may be |
| 1005 | * called for. |
| 1006 | */ |
| 1007 | |
| 1008 | if (params) { |
| 1009 | error = copyin(params, &vlr, sizeof(vlr)); |
| 1010 | if (error) |
| 1011 | return error; |
| 1012 | vid = vlr.vlr_tag; |
| 1013 | proto = vlr.vlr_proto; |
| 1014 | |
| 1015 | p = ifunit_ref(vlr.vlr_parent); |
| 1016 | if (p == NULL) |
| 1017 | return (ENXIO); |
| 1018 | } |
| 1019 | |
| 1020 | if ((error = ifc_name2unit(name, &unit)) == 0) { |
| 1021 | |
| 1022 | /* |
| 1023 | * vlanX interface. Set wildcard to true if the unit number |
| 1024 | * is not fixed (-1) |
| 1025 | */ |
| 1026 | wildcard = (unit < 0); |
| 1027 | } else { |
| 1028 | struct ifnet *p_tmp = vlan_clone_match_ethervid(name, &vid); |
| 1029 | if (p_tmp != NULL) { |
| 1030 | error = 0; |
| 1031 | subinterface = true; |
| 1032 | unit = IF_DUNIT_NONE; |
| 1033 | wildcard = false; |
nothing calls this directly
no test coverage detected