On Tue, Jan 22, 2019 at 12:57:34PM -0200, Martin Pieuchot wrote:
> If a bridge(4) is down packets don't flow through it, so be coherent and
> do not copy them for span ports.
> 
> ok?

This makes span ports consistent with the bpf listener so this is indeed
the right way for span ports to work on bridges.
OK claudio@
 
> Index: net/if_bridge.c
> ===================================================================
> RCS file: /cvs/src/sys/net/if_bridge.c,v
> retrieving revision 1.316
> diff -u -p -r1.316 if_bridge.c
> --- net/if_bridge.c   17 Jan 2019 16:07:42 -0000      1.316
> +++ net/if_bridge.c   22 Jan 2019 14:43:37 -0000
> @@ -777,6 +777,8 @@ bridge_output(struct ifnet *ifp, struct 
>       ifp->if_opackets++;
>       ifp->if_obytes += m->m_pkthdr.len;
>  
> +     bridge_span(sc, m);
> +
>       /*
>        * If the packet is a broadcast or we don't know a better way to
>        * get there, send to all interfaces.
> @@ -788,8 +790,6 @@ bridge_output(struct ifnet *ifp, struct 
>               struct mbuf *mc;
>               int used = 0;
>  
> -             bridge_span(sc, m);
> -
>               SLIST_FOREACH(bif, &sc->sc_iflist, bif_next) {
>                       dst_if = bif->ifp;
>                       if ((dst_if->if_flags & IFF_RUNNING) == 0)
> @@ -850,7 +850,6 @@ sendunicast:
>           ((brtag = bridge_tunneltag(m)) != NULL))
>               bridge_copytag(&dst_p->brt_tunnel, brtag);
>  
> -     bridge_span(sc, m);
>       if ((dst_if->if_flags & IFF_RUNNING) == 0) {
>               m_freem(m);
>               return (ENETDOWN);
> 

-- 
:wq Claudio

Reply via email to