From 42033fe6ad16e28f126c32e3a7f1657c60c3c382 Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Mon, 4 Oct 2010 08:34:03 -0700 Subject: [PATCH] network - Fix udp multicast assertion & mplock for ip_output * Fix an assertion which is no longer valid, the MP lock is no longer held by the caller when passing a multicast packet into ip_output. * Move the mp lock for udp multicast packets inward. The underlying code still isn't mpsafe. Reported-by: "Edward O'Callaghan" --- sys/netinet/ip_output.c | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c index 5be2b832b4..3c4a7e0bf4 100644 --- a/sys/netinet/ip_output.c +++ b/sys/netinet/ip_output.c @@ -306,17 +306,6 @@ ip_output(struct mbuf *m0, struct mbuf *opt, struct route *ro, reroute: pkt_dst = next_hop ? next_hop->sin_addr : ip->ip_dst; -#ifdef INVARIANTS - if (IN_MULTICAST(ntohl(pkt_dst.s_addr))) { - /* - * XXX - * Multicast is not MPSAFE yet. Caller must hold - * BGL when output a multicast IP packet. - */ - ASSERT_MP_LOCK_HELD(curthread); - } -#endif - dst = (struct sockaddr_in *)&ro->ro_dst; /* * If there is a cached route, @@ -463,10 +452,14 @@ reroute: */ if (!rsvp_on) imo = NULL; - if (ip_mforward && - ip_mforward(ip, ifp, m, imo) != 0) { - m_freem(m); - goto done; + if (ip_mforward) { + get_mplock(); + if (ip_mforward(ip, ifp, m, imo) != 0) { + m_freem(m); + rel_mplock(); + goto done; + } + rel_mplock(); } } } @@ -2186,6 +2179,8 @@ ip_mloopback(struct ifnet *ifp, struct mbuf *m, struct sockaddr_in *dst, dst->sin_family = AF_INET; } #endif + get_mplock(); /* is if_simloop() mpsafe yet? */ if_simloop(ifp, copym, dst->sin_family, 0); + rel_mplock(); } } -- 2.11.4.GIT