diff options
author | thompsa <thompsa@FreeBSD.org> | 2005-12-15 19:34:39 +0000 |
---|---|---|
committer | thompsa <thompsa@FreeBSD.org> | 2005-12-15 19:34:39 +0000 |
commit | dd0db6b7bf6886d87a27debc3d33ce6dd983aca7 (patch) | |
tree | 840f4d79baf643c5749b6c28f7ae1ff2e7be624d | |
parent | 71d1cb326f3ca2dd193102af04de26fb531a3a2d (diff) | |
download | FreeBSD-src-dd0db6b7bf6886d87a27debc3d33ce6dd983aca7.zip FreeBSD-src-dd0db6b7bf6886d87a27debc3d33ce6dd983aca7.tar.gz |
It is not safe to use m_copypacket() here as the returned mbuf is readonly,
change to m_dup and keep the alignment on the layer3 header.
MFC after: 1 week
-rw-r--r-- | sys/net/if_bridge.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/sys/net/if_bridge.c b/sys/net/if_bridge.c index 4d36c96..c063b91 100644 --- a/sys/net/if_bridge.c +++ b/sys/net/if_bridge.c @@ -1858,7 +1858,12 @@ bridge_input(struct ifnet *ifp, struct mbuf *m) */ KASSERT(bifp->if_bridge == NULL, ("loop created in bridge_input")); - mc2 = m_copypacket(m, M_DONTWAIT); + mc2 = m_dup(m, M_DONTWAIT); + if (mc2 != NULL) { + /* Keep the layer3 header aligned */ + int i = min(mc2->m_pkthdr.len, max_protohdr); + mc2 = m_copyup(mc2, i, ETHER_ALIGN); + } if (mc2 != NULL) { mc2->m_pkthdr.rcvif = bifp; (*bifp->if_input)(bifp, mc2); |