m_dup () packet not m_copypacket () since we will modify it. For more

details see PR kern/94448.

PR:     kern/94448

Original patch: Eygene A. Ryabinkin <rea-fbsd at rea dot mbslab dot kiae dot ru>Final patch:    thompsa@
Tested by:      thompsa@, Eygene A. Ryabinkin

MFC after:      7 days
This commit is contained in:
Roman Kurakin 2006-03-23 22:57:10 +00:00
parent 998ab76154
commit 5cb7f13aee
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=157057

View File

@ -2076,7 +2076,7 @@ bridge_broadcast(struct bridge_softc *sc, struct ifnet *src_if,
struct bridge_iflist *bif;
struct mbuf *mc;
struct ifnet *dst_if;
int error = 0, used = 0;
int error = 0, used = 0, i;
BRIDGE_LOCK_ASSERT(sc);
BRIDGE_LOCK2REF(sc, error);
@ -2121,7 +2121,7 @@ bridge_broadcast(struct bridge_softc *sc, struct ifnet *src_if,
mc = m;
used = 1;
} else {
mc = m_copypacket(m, M_DONTWAIT);
mc = m_dup(m, M_DONTWAIT);
if (mc == NULL) {
sc->sc_ifp->if_oerrors++;
continue;
@ -2138,6 +2138,15 @@ bridge_broadcast(struct bridge_softc *sc, struct ifnet *src_if,
|| PFIL_HOOKED(&inet6_pfil_hook)
#endif
)) {
if (used == 0) {
/* Keep the layer3 header aligned */
i = min(mc->m_pkthdr.len, max_protohdr);
mc = m_copyup(mc, i, ETHER_ALIGN);
if (mc == NULL) {
sc->sc_ifp->if_oerrors++;
continue;
}
}
if (bridge_pfil(&mc, NULL, dst_if, PFIL_OUT) != 0)
continue;
if (mc == NULL)