MCPcopy Index your code
hub / github.com/F-Stack/f-stack / ifioctl

Function ifioctl

freebsd/net/if.c:2934–3095  ·  view source on GitHub ↗

* Interface ioctls. */

Source from the content-addressed store, hash-verified

2932 * Interface ioctls.
2933 */
2934int
2935ifioctl(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;

Callers 6

soo_ioctlFunction · 0.85
lo_set_defaultaddrFunction · 0.85
ff_veth_setaddrFunction · 0.85
ff_veth_setvaddrFunction · 0.85
ff_veth_setaddr6Function · 0.85
ff_veth_setvaddr6Function · 0.85

Calls 14

ifmr_initFunction · 0.85
if_vmove_reclaimFunction · 0.85
if_clone_createFunction · 0.85
ifr_data_get_ptrFunction · 0.85
if_clone_destroyFunction · 0.85
if_clone_listFunction · 0.85
if_getgroupmembersFunction · 0.85
ifunit_refFunction · 0.85
ifhwioctlFunction · 0.85
in6_if_upFunction · 0.85
if_releFunction · 0.85
ifmr_updateFunction · 0.85

Tested by

no test coverage detected