Date: Fri, 22 Jul 2005 02:50:14 GMT From: Robert Watson <rwatson@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 80732 for review Message-ID: <200507220250.j6M2oEj0046019@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=80732 Change 80732 by rwatson@rwatson_zoo on 2005/07/22 02:49:24 Acquire in_multi_mtx around use of in_multihead address list, accessor macros, etc. Assert in_multi_mtx in functions that require it, especially in IGMP, IP input and output routines. Affected files ... .. //depot/projects/netsmp/src/sys/netinet/igmp.c#2 edit .. //depot/projects/netsmp/src/sys/netinet/ip_input.c#2 edit .. //depot/projects/netsmp/src/sys/netinet/ip_output.c#2 edit Differences ... ==== //depot/projects/netsmp/src/sys/netinet/igmp.c#2 (text+ko) ==== @@ -286,6 +286,7 @@ * - Use the value specified in the query message as * the maximum timeout. */ + IN_MULTI_LOCK(); IN_FIRST_MULTI(step, inm); while (inm != NULL) { if (inm->inm_ifp == ifp && @@ -301,6 +302,7 @@ } IN_NEXT_MULTI(step, inm); } + IN_MULTI_UNLOCK(); break; @@ -343,14 +345,15 @@ * If we belong to the group being reported, stop * our timer for that group. */ + IN_MULTI_LOCK(); IN_LOOKUP_MULTI(igmp->igmp_group, ifp, inm); - if (inm != NULL) { inm->inm_timer = 0; ++igmpstat.igps_rcv_ourreports; inm->inm_state = IGMP_OTHERMEMBER; } + IN_MULTI_UNLOCK(); break; } @@ -367,6 +370,8 @@ { int s = splnet(); + IN_MULTI_LOCK_ASSERT(); + if (inm->inm_addr.s_addr == igmp_all_hosts_group || inm->inm_ifp->if_flags & IFF_LOOPBACK) { inm->inm_timer = 0; @@ -391,6 +396,8 @@ igmp_leavegroup(struct in_multi *inm) { + IN_MULTI_LOCK_ASSERT(); + if (inm->inm_state == IGMP_IREPORTEDLAST && inm->inm_addr.s_addr != igmp_all_hosts_group && !(inm->inm_ifp->if_flags & IFF_LOOPBACK) && @@ -414,6 +421,7 @@ return; s = splnet(); + IN_MULTI_LOCK(); igmp_timers_are_running = 0; IN_FIRST_MULTI(step, inm); while (inm != NULL) { @@ -427,6 +435,7 @@ } IN_NEXT_MULTI(step, inm); } + IN_MULTI_UNLOCK(); splx(s); } @@ -458,6 +467,8 @@ struct ip *ip; struct ip_moptions imo; + IN_MULTI_LOCK_ASSERT(); + MGETHDR(m, M_DONTWAIT, MT_HEADER); if (m == NULL) return; ==== //depot/projects/netsmp/src/sys/netinet/ip_input.c#2 (text+ko) ==== @@ -607,7 +607,9 @@ * See if we belong to the destination multicast group on the * arrival interface. */ + IN_MULTI_LOCK(); IN_LOOKUP_MULTI(ip->ip_dst, m->m_pkthdr.rcvif, inm); + IN_MULTI_UNLOCK(); if (inm == NULL) { ipstat.ips_notmember++; m_freem(m); ==== //depot/projects/netsmp/src/sys/netinet/ip_output.c#2 (text+ko) ==== @@ -291,9 +291,15 @@ ip->ip_src = IA_SIN(ia)->sin_addr; } + /* + * XXXRW: Should the in_multi_mtx be held over + * ip_mloopback() or ip_mforward()? + */ + IN_MULTI_LOCK(); IN_LOOKUP_MULTI(ip->ip_dst, ifp, inm); if (inm != NULL && (imo == NULL || imo->imo_multicast_loop)) { + IN_MULTI_UNLOCK(); /* * If we belong to the destination multicast group * on the outgoing interface, and the caller did not @@ -302,6 +308,7 @@ ip_mloopback(ifp, m, dst, hlen); } else { + IN_MULTI_UNLOCK(); /* * If we are acting as a multicast router, perform * multicast forwarding as if the packet had just
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200507220250.j6M2oEj0046019>