MCPcopy Create free account
hub / github.com/F-Stack/f-stack / vlan_ioctl

Function vlan_ioctl

freebsd/net/if_vlan.c:1842–2057  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1840}
1841
1842static int
1843vlan_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
1844{
1845 struct ifnet *p;
1846 struct ifreq *ifr;
1847 struct ifaddr *ifa;
1848 struct ifvlan *ifv;
1849 struct ifvlantrunk *trunk;
1850 struct vlanreq vlr;
1851 int error = 0, oldmtu;
1852
1853 ifr = (struct ifreq *)data;
1854 ifa = (struct ifaddr *) data;
1855 ifv = ifp->if_softc;
1856
1857 switch (cmd) {
1858 case SIOCSIFADDR:
1859 ifp->if_flags |= IFF_UP;
1860#ifdef INET
1861 if (ifa->ifa_addr->sa_family == AF_INET)
1862 arp_ifinit(ifp, ifa);
1863#endif
1864 break;
1865 case SIOCGIFADDR:
1866 bcopy(IF_LLADDR(ifp), &ifr->ifr_addr.sa_data[0],
1867 ifp->if_addrlen);
1868 break;
1869 case SIOCGIFMEDIA:
1870 VLAN_SLOCK();
1871 if (TRUNK(ifv) != NULL) {
1872 p = PARENT(ifv);
1873 if_ref(p);
1874 error = (*p->if_ioctl)(p, SIOCGIFMEDIA, data);
1875 if_rele(p);
1876 /* Limit the result to the parent's current config. */
1877 if (error == 0) {
1878 struct ifmediareq *ifmr;
1879
1880 ifmr = (struct ifmediareq *)data;
1881 if (ifmr->ifm_count >= 1 && ifmr->ifm_ulist) {
1882 ifmr->ifm_count = 1;
1883 error = copyout(&ifmr->ifm_current,
1884 ifmr->ifm_ulist,
1885 sizeof(int));
1886 }
1887 }
1888 } else {
1889 error = EINVAL;
1890 }
1891 VLAN_SUNLOCK();
1892 break;
1893
1894 case SIOCSIFMEDIA:
1895 error = EINVAL;
1896 break;
1897
1898 case SIOCSIFMTU:
1899 /*

Callers

nothing calls this directly

Calls 15

arp_ifinitFunction · 0.85
if_refFunction · 0.85
if_releFunction · 0.85
ifr_data_get_ptrFunction · 0.85
vlan_unconfigFunction · 0.85
ifunit_refFunction · 0.85
vlan_configFunction · 0.85
nd6_setmtuFunction · 0.85
rt_updatemtuFunction · 0.85
bzeroFunction · 0.85
vlan_setflagsFunction · 0.85
vlan_setmultiFunction · 0.85

Tested by

no test coverage detected