diff options
author | Martin Pieuchot <mpi@cvs.openbsd.org> | 2015-06-25 09:38:01 +0000 |
---|---|---|
committer | Martin Pieuchot <mpi@cvs.openbsd.org> | 2015-06-25 09:38:01 +0000 |
commit | 159fb3d015db2f7b5ccfda2c36c955e8d638784d (patch) | |
tree | 13b26837a15d8f382e4a2fb7073a52f26aa7c068 /sys/net/if_bridge.c | |
parent | 4449aeca8ba1c21b42111757d7b79c80ce30d58b (diff) |
Properly deliver broadcast-like packets to the network stack.
In bridge(4) speak, broadcast-like packets are Ethernet Multicast
frames or Unicast for which the destination is unknown.
It makes sense to not retransmit broadcast-like packets on the interface
they were received but they still must be delivered to the network stack.
Problem reported by and ok jasper@
Diffstat (limited to 'sys/net/if_bridge.c')
-rw-r--r-- | sys/net/if_bridge.c | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/sys/net/if_bridge.c b/sys/net/if_bridge.c index 62b7cb9eefa..ea4c3e73c02 100644 --- a/sys/net/if_bridge.c +++ b/sys/net/if_bridge.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_bridge.c,v 1.247 2015/06/25 09:20:20 mpi Exp $ */ +/* $OpenBSD: if_bridge.c,v 1.248 2015/06/25 09:38:00 mpi Exp $ */ /* * Copyright (c) 1999, 2000 Jason L. Wright (jason@thought.net) @@ -1469,12 +1469,9 @@ bridge_broadcast(struct bridge_softc *sc, struct ifnet *ifp, int len, used = 0; TAILQ_FOREACH(p, &sc->sc_iflist, next) { - /* - * Don't retransmit out of the same interface where - * the packet was received from. - */ dst_if = p->ifp; - if (dst_if->if_index == ifp->if_index) + + if ((dst_if->if_flags & IFF_RUNNING) == 0) continue; if ((p->bif_flags & IFBIF_STP) && @@ -1485,15 +1482,6 @@ bridge_broadcast(struct bridge_softc *sc, struct ifnet *ifp, (m->m_flags & (M_BCAST | M_MCAST)) == 0) continue; - if ((dst_if->if_flags & IFF_RUNNING) == 0) - continue; - - if (IF_QFULL(&dst_if->if_snd)) { - IF_DROP(&dst_if->if_snd); - sc->sc_if.if_oerrors++; - continue; - } - /* Drop non-IP frames if the appropriate flag is set. */ if (p->bif_flags & IFBIF_BLOCKNONIP && bridge_blocknonip(eh, m)) @@ -1504,6 +1492,19 @@ bridge_broadcast(struct bridge_softc *sc, struct ifnet *ifp, bridge_localbroadcast(sc, dst_if, eh, m); + /* + * Don't retransmit out of the same interface where + * the packet was received from. + */ + if (dst_if->if_index == ifp->if_index) + continue; + + if (IF_QFULL(&dst_if->if_snd)) { + IF_DROP(&dst_if->if_snd); + sc->sc_if.if_oerrors++; + continue; + } + /* If last one, reuse the passed-in mbuf */ if (TAILQ_NEXT(p, next) == NULL) { mc = m; |