* bridge_ifdetach: * * Detach an interface from a bridge. Called when a member * interface is detaching. */
| 1852 | * interface is detaching. |
| 1853 | */ |
| 1854 | static void |
| 1855 | bridge_ifdetach(void *arg __unused, struct ifnet *ifp) |
| 1856 | { |
| 1857 | struct bridge_softc *sc = ifp->if_bridge; |
| 1858 | struct bridge_iflist *bif; |
| 1859 | |
| 1860 | if (ifp->if_flags & IFF_RENAMING) |
| 1861 | return; |
| 1862 | if (V_bridge_cloner == NULL) { |
| 1863 | /* |
| 1864 | * This detach handler can be called after |
| 1865 | * vnet_bridge_uninit(). Just return in that case. |
| 1866 | */ |
| 1867 | return; |
| 1868 | } |
| 1869 | /* Check if the interface is a bridge member */ |
| 1870 | if (sc != NULL) { |
| 1871 | BRIDGE_LOCK(sc); |
| 1872 | |
| 1873 | bif = bridge_lookup_member_if(sc, ifp); |
| 1874 | if (bif != NULL) |
| 1875 | bridge_delete_member(sc, bif, 1); |
| 1876 | |
| 1877 | BRIDGE_UNLOCK(sc); |
| 1878 | return; |
| 1879 | } |
| 1880 | |
| 1881 | /* Check if the interface is a span port */ |
| 1882 | BRIDGE_LIST_LOCK(); |
| 1883 | LIST_FOREACH(sc, &V_bridge_list, sc_list) { |
| 1884 | BRIDGE_LOCK(sc); |
| 1885 | CK_LIST_FOREACH(bif, &sc->sc_spanlist, bif_next) |
| 1886 | if (ifp == bif->bif_ifp) { |
| 1887 | bridge_delete_span(sc, bif); |
| 1888 | break; |
| 1889 | } |
| 1890 | |
| 1891 | BRIDGE_UNLOCK(sc); |
| 1892 | } |
| 1893 | BRIDGE_LIST_UNLOCK(); |
| 1894 | } |
| 1895 | |
| 1896 | /* |
| 1897 | * bridge_init: |
nothing calls this directly
no test coverage detected