From 4b4b284d95f5265970ae191bcbcfda91fe9929e1 Mon Sep 17 00:00:00 2001 From: Kyle Evans Date: Fri, 15 Mar 2019 17:13:05 +0000 Subject: [PATCH] if_bridge(4): Drop pointless rtflush At this point, all routes should've already been dropped by removing all members from the bridge. This condition is in-fact KASSERT'd in the line immediately above where this nop flush was added. --- sys/net/if_bridge.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/sys/net/if_bridge.c b/sys/net/if_bridge.c index eefad57d62e9..1f076472f691 100644 --- a/sys/net/if_bridge.c +++ b/sys/net/if_bridge.c @@ -2449,6 +2449,22 @@ bridge_input(struct ifnet *ifp, struct mbuf *m) } \ m->m_pkthdr.rcvif = iface; \ BRIDGE_UNLOCK(sc); \ + /* \ + * These mbufs will not have another chance to get sent \ + * to bpf elsewhere in the stack as being received \ + * by this interface, because they are coming in over \ + * the bridge. They likely have been accounted for \ + * when received by the interface that they came from, \ + * but this is not enough for other consumers, \ + * e.g. dhclient, to be satisfied. \ + * \ + * rcvif needs to be set on the mbuf here, lest we risk \ + * losing the mbuf as a "duplicate" because it's \ + * considered outgoing by bpf. \ + */ \ + if ((iface)->if_type != IFT_BRIDGE && \ + (iface)->if_bpf != NULL && (iface) != (ifp)) \ + ETHER_BPF_MTAP(iface, m); \ return (m); \ } \ \ @@ -2890,7 +2906,6 @@ bridge_rtable_fini(struct bridge_softc *sc) KASSERT(sc->sc_brtcnt == 0, ("%s: %d bridge routes referenced", __func__, sc->sc_brtcnt)); - bridge_rtflush(sc, 1); free(sc->sc_rthash, M_DEVBUF); }