* Interface ioctls. */
| 2932 | * Interface ioctls. |
| 2933 | */ |
| 2934 | int |
| 2935 | ifioctl(struct socket *so, u_long cmd, caddr_t data, struct thread *td) |
| 2936 | { |
| 2937 | #ifdef COMPAT_FREEBSD32 |
| 2938 | caddr_t saved_data = NULL; |
| 2939 | struct ifmediareq ifmr; |
| 2940 | struct ifmediareq *ifmrp = NULL; |
| 2941 | #endif |
| 2942 | struct ifnet *ifp; |
| 2943 | struct ifreq *ifr; |
| 2944 | int error; |
| 2945 | int oif_flags; |
| 2946 | #ifdef VIMAGE |
| 2947 | bool shutdown; |
| 2948 | #endif |
| 2949 | |
| 2950 | CURVNET_SET(so->so_vnet); |
| 2951 | #ifdef VIMAGE |
| 2952 | /* Make sure the VNET is stable. */ |
| 2953 | shutdown = VNET_IS_SHUTTING_DOWN(so->so_vnet); |
| 2954 | if (shutdown) { |
| 2955 | CURVNET_RESTORE(); |
| 2956 | return (EBUSY); |
| 2957 | } |
| 2958 | #endif |
| 2959 | |
| 2960 | switch (cmd) { |
| 2961 | case SIOCGIFCONF: |
| 2962 | error = ifconf(cmd, data); |
| 2963 | goto out_noref; |
| 2964 | |
| 2965 | #ifdef COMPAT_FREEBSD32 |
| 2966 | case SIOCGIFCONF32: |
| 2967 | { |
| 2968 | struct ifconf32 *ifc32; |
| 2969 | struct ifconf ifc; |
| 2970 | |
| 2971 | ifc32 = (struct ifconf32 *)data; |
| 2972 | ifc.ifc_len = ifc32->ifc_len; |
| 2973 | ifc.ifc_buf = PTRIN(ifc32->ifc_buf); |
| 2974 | |
| 2975 | error = ifconf(SIOCGIFCONF, (void *)&ifc); |
| 2976 | if (error == 0) |
| 2977 | ifc32->ifc_len = ifc.ifc_len; |
| 2978 | goto out_noref; |
| 2979 | } |
| 2980 | #endif |
| 2981 | } |
| 2982 | |
| 2983 | #ifdef COMPAT_FREEBSD32 |
| 2984 | switch (cmd) { |
| 2985 | case SIOCGIFMEDIA32: |
| 2986 | case SIOCGIFXMEDIA32: |
| 2987 | ifmrp = &ifmr; |
| 2988 | ifmr_init(ifmrp, data); |
| 2989 | cmd = _IOC_NEWTYPE(cmd, struct ifmediareq); |
| 2990 | saved_data = data; |
| 2991 | data = (caddr_t)ifmrp; |
no test coverage detected