From owner-p4-projects@FreeBSD.ORG Fri Jul 22 02:51:59 2005 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id B76FA16A4CB; Fri, 22 Jul 2005 02:51:58 +0000 (GMT) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 53E2816A440 for ; Fri, 22 Jul 2005 02:51:58 +0000 (GMT) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8266943E6F for ; Fri, 22 Jul 2005 02:51:01 +0000 (GMT) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id j6M2oEZq046022 for ; Fri, 22 Jul 2005 02:50:14 GMT (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id j6M2oEj0046019 for perforce@freebsd.org; Fri, 22 Jul 2005 02:50:14 GMT (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Date: Fri, 22 Jul 2005 02:50:14 GMT Message-Id: <200507220250.j6M2oEj0046019@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to bb+lists.freebsd.perforce@cyrus.watson.org using -f From: Robert Watson To: Perforce Change Reviews Cc: Subject: PERFORCE change 80732 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jul 2005 02:52:00 -0000 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