From owner-freebsd-net@FreeBSD.ORG Thu Sep 10 05:58:58 2009 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B41A31065672 for ; Thu, 10 Sep 2009 05:58:58 +0000 (UTC) (envelope-from stef-list@memberwebs.com) Received: from mail.npubs.com (mail.npubs.com [74.82.45.72]) by mx1.freebsd.org (Postfix) with ESMTP id A43138FC14 for ; Thu, 10 Sep 2009 05:58:58 +0000 (UTC) Resent-Message-Id: From: Stef Walter User-Agent: Thunderbird 2.0.0.23 (X11/20090817) MIME-Version: 1.0 To: "freebsd-net@FreeBSD.org" Content-Type: multipart/mixed; boundary="------------010308080209070707080404" X-Virus-Scanned: ClamAV using ClamSMTP Resent-Date: Thu, 10 Sep 2009 05:58:58 +0000 (UTC) Resent-From: stef-list@memberwebs.com Subject: [patch] Multicast: Keep membership and filters in sync X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: stef@memberwebs.com List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Date: Thu, 10 Sep 2009 05:58:58 -0000 X-List-Received-Date: Thu, 10 Sep 2009 05:58:58 -0000 This is a multi-part message in MIME format. --------------010308080209070707080404 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit When removing multicast membership from a socket (ie: IP_DROP_MEMBERSHIP) that has multiple multicast memberships, the internal list of memberships and filters are not kept in sync. This results in dropped packets that are not delivered to the socket that has the multicast membership. This was experienced with OSPF (running quagga). Besides the obvious non-functional multicast, the following command is another way to see an indication of the problem: > # netstat -s -p ip | grep multicast > 7 packets received for unknown multicast group Patch attached which fixes the problem. Cheers, Stef --------------010308080209070707080404 Content-Type: text/x-diff; name="freebsd-mcast-filter-array-in-sync.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="freebsd-mcast-filter-array-in-sync.patch" --- sys/netinet/in_mcast.c.orig 2009-09-09 19:33:22.000000000 +0000 +++ sys/netinet/in_mcast.c 2009-09-10 05:28:20.000000000 +0000 @@ -2280,7 +2292,9 @@ if (is_final) { - /* Remove the gap in the membership array. */ - for (++idx; idx < imo->imo_num_memberships; ++idx) + /* Remove the gap in the membership and filter array. */ + for (++idx; idx < imo->imo_num_memberships; ++idx) { imo->imo_membership[idx-1] = imo->imo_membership[idx]; + imo->imo_mfilters[idx-1] = imo->imo_mfilters[idx]; + } imo->imo_num_memberships--; } --------------010308080209070707080404--