From 748741c7ae4a03d46c91df65ab2cc605c3b7629e Mon Sep 17 00:00:00 2001 From: Gleb Smirnoff Date: Thu, 26 May 2005 06:50:00 +0000 Subject: [PATCH] Plug mbuf leak, that I have introduced in 1.85. Also restore important comment from if_ethersubr.c:1.178. While here adjust formatting, to make code more readable. Reported by: Alexey Kamyshev, rwatson --- sys/net/bridge.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/sys/net/bridge.c b/sys/net/bridge.c index 2461088de763..1011f10b2839 100644 --- a/sys/net/bridge.c +++ b/sys/net/bridge.c @@ -864,24 +864,32 @@ bridge_in(struct ifnet *ifp, struct mbuf *m) case (uintptr_t)BDG_DROP: m_freem(m); return (NULL); + case (uintptr_t)BDG_LOCAL: return (m); + case (uintptr_t)BDG_BCAST: case (uintptr_t)BDG_MCAST: m = bdg_forward(m, dst); -#ifdef DIAGNOSTIC /* glebius: am I right here? */ - if (m == NULL) { +#ifdef DIAGNOSTIC + if (m == NULL) if_printf(ifp, "bridge dropped %s packet\n", dst == BDG_BCAST ? "broadcast" : "multicast"); - return (NULL); - } #endif return (m); + default: m = bdg_forward(m, dst); + /* + * But in some cases the bridge may return the + * packet for us to free; sigh. + */ + if (m != NULL) + m_freem(m); + } - return (NULL); /* not reached */ + return (NULL); } /*