if_bridge.c (1e4200620ac6b9dd4bb0848d83edd05df952c7c0) if_bridge.c (73ff045c575b440ea1406234848972fd0f41df75)
1/* $NetBSD: if_bridge.c,v 1.31 2005/06/01 19:45:34 jdc Exp $ */
2
3/*
4 * Copyright 2001 Wasabi Systems, Inc.
5 * All rights reserved.
6 *
7 * Written by Jason R. Thorpe for Wasabi Systems, Inc.
8 *

--- 710 unchanged lines hidden (view full) ---

719 case IFT_ETHER:
720 case IFT_L2VLAN:
721 /*
722 * Take the interface out of promiscuous mode.
723 */
724 (void) ifpromisc(ifs, 0);
725 break;
726
1/* $NetBSD: if_bridge.c,v 1.31 2005/06/01 19:45:34 jdc Exp $ */
2
3/*
4 * Copyright 2001 Wasabi Systems, Inc.
5 * All rights reserved.
6 *
7 * Written by Jason R. Thorpe for Wasabi Systems, Inc.
8 *

--- 710 unchanged lines hidden (view full) ---

719 case IFT_ETHER:
720 case IFT_L2VLAN:
721 /*
722 * Take the interface out of promiscuous mode.
723 */
724 (void) ifpromisc(ifs, 0);
725 break;
726
727 case IFT_GIF:
728 break;
729
727 default:
728#ifdef DIAGNOSTIC
729 panic("bridge_delete_member: impossible");
730#endif
731 break;
732 }
733 }
734

--- 41 unchanged lines hidden (view full) ---

776 if (ifs == NULL)
777 return (ENOENT);
778
779 /* If it's in the span list, it can't be a member. */
780 LIST_FOREACH(bif, &sc->sc_spanlist, bif_next)
781 if (ifs == bif->bif_ifp)
782 return (EBUSY);
783
730 default:
731#ifdef DIAGNOSTIC
732 panic("bridge_delete_member: impossible");
733#endif
734 break;
735 }
736 }
737

--- 41 unchanged lines hidden (view full) ---

779 if (ifs == NULL)
780 return (ENOENT);
781
782 /* If it's in the span list, it can't be a member. */
783 LIST_FOREACH(bif, &sc->sc_spanlist, bif_next)
784 if (ifs == bif->bif_ifp)
785 return (EBUSY);
786
784 /* Allow the first member to define the MTU */
785 if (LIST_EMPTY(&sc->sc_iflist))
786 sc->sc_ifp->if_mtu = ifs->if_mtu;
787 else if (sc->sc_ifp->if_mtu != ifs->if_mtu) {
788 if_printf(sc->sc_ifp, "invalid MTU for %s\n", ifs->if_xname);
789 return (EINVAL);
787 /* Allow the first Ethernet member to define the MTU */
788 if (ifs->if_type != IFT_GIF) {
789 if (LIST_EMPTY(&sc->sc_iflist))
790 sc->sc_ifp->if_mtu = ifs->if_mtu;
791 else if (sc->sc_ifp->if_mtu != ifs->if_mtu) {
792 if_printf(sc->sc_ifp, "invalid MTU for %s\n",
793 ifs->if_xname);
794 return (EINVAL);
795 }
790 }
791
792 if (ifs->if_bridge == sc)
793 return (EEXIST);
794
795 if (ifs->if_bridge != NULL)
796 return (EBUSY);
797

--- 7 unchanged lines hidden (view full) ---

805 /*
806 * Place the interface into promiscuous mode.
807 */
808 error = ifpromisc(ifs, 1);
809 if (error)
810 goto out;
811 break;
812
796 }
797
798 if (ifs->if_bridge == sc)
799 return (EEXIST);
800
801 if (ifs->if_bridge != NULL)
802 return (EBUSY);
803

--- 7 unchanged lines hidden (view full) ---

811 /*
812 * Place the interface into promiscuous mode.
813 */
814 error = ifpromisc(ifs, 1);
815 if (error)
816 goto out;
817 break;
818
819 case IFT_GIF:
820 break;
821
813 default:
814 error = EINVAL;
815 goto out;
816 }
817
818 bif->bif_ifp = ifs;
819 bif->bif_flags = IFBIF_LEARNING | IFBIF_DISCOVER;
820 bif->bif_priority = BSTP_DEFAULT_PORT_PRIORITY;

--- 727 unchanged lines hidden (view full) ---

1548 m_freem(m);
1549 return (0);
1550 }
1551
1552 bridge_span(sc, m);
1553
1554 LIST_FOREACH(bif, &sc->sc_iflist, bif_next) {
1555 dst_if = bif->bif_ifp;
822 default:
823 error = EINVAL;
824 goto out;
825 }
826
827 bif->bif_ifp = ifs;
828 bif->bif_flags = IFBIF_LEARNING | IFBIF_DISCOVER;
829 bif->bif_priority = BSTP_DEFAULT_PORT_PRIORITY;

--- 727 unchanged lines hidden (view full) ---

1557 m_freem(m);
1558 return (0);
1559 }
1560
1561 bridge_span(sc, m);
1562
1563 LIST_FOREACH(bif, &sc->sc_iflist, bif_next) {
1564 dst_if = bif->bif_ifp;
1565
1566 if (dst_if->if_type == IFT_GIF)
1567 continue;
1556 if ((dst_if->if_drv_flags & IFF_DRV_RUNNING) == 0)
1557 continue;
1558
1559 /*
1560 * If this is not the original output interface,
1561 * and the interface is participating in spanning
1562 * tree, make sure the port is in a state that
1563 * allows forwarding.

--- 375 unchanged lines hidden (view full) ---

1939 return (m);
1940 }
1941 }
1942
1943 /*
1944 * Unicast. Make sure it's not for us.
1945 */
1946 LIST_FOREACH(bif, &sc->sc_iflist, bif_next) {
1568 if ((dst_if->if_drv_flags & IFF_DRV_RUNNING) == 0)
1569 continue;
1570
1571 /*
1572 * If this is not the original output interface,
1573 * and the interface is participating in spanning
1574 * tree, make sure the port is in a state that
1575 * allows forwarding.

--- 375 unchanged lines hidden (view full) ---

1951 return (m);
1952 }
1953 }
1954
1955 /*
1956 * Unicast. Make sure it's not for us.
1957 */
1958 LIST_FOREACH(bif, &sc->sc_iflist, bif_next) {
1959 if(bif->bif_ifp->if_type == IFT_GIF)
1960 continue;
1947 /* It is destined for us. */
1948 if (memcmp(IF_LLADDR(bif->bif_ifp), eh->ether_dhost,
1949 ETHER_ADDR_LEN) == 0) {
1950 if (bif->bif_flags & IFBIF_LEARNING)
1951 (void) bridge_rtupdate(sc,
1952 eh->ether_shost, ifp, 0, IFBAF_DYNAMIC);
1953 m->m_pkthdr.rcvif = bif->bif_ifp;
1954 BRIDGE_UNLOCK(sc);

--- 915 unchanged lines hidden ---
1961 /* It is destined for us. */
1962 if (memcmp(IF_LLADDR(bif->bif_ifp), eh->ether_dhost,
1963 ETHER_ADDR_LEN) == 0) {
1964 if (bif->bif_flags & IFBIF_LEARNING)
1965 (void) bridge_rtupdate(sc,
1966 eh->ether_shost, ifp, 0, IFBAF_DYNAMIC);
1967 m->m_pkthdr.rcvif = bif->bif_ifp;
1968 BRIDGE_UNLOCK(sc);

--- 915 unchanged lines hidden ---