From owner-freebsd-net@FreeBSD.ORG Mon Jan 29 22:59:07 2007 Return-Path: X-Original-To: net@FreeBSD.org Delivered-To: freebsd-net@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A72E816A400; Mon, 29 Jan 2007 22:59:07 +0000 (UTC) (envelope-from bms@FreeBSD.org) Received: from out4.smtp.messagingengine.com (out4.smtp.messagingengine.com [66.111.4.28]) by mx1.freebsd.org (Postfix) with ESMTP id 7BAAD13C471; Mon, 29 Jan 2007 22:59:07 +0000 (UTC) (envelope-from bms@FreeBSD.org) Received: from out1.internal (unknown [10.202.2.149]) by out1.messagingengine.com (Postfix) with ESMTP id C2CB899B50; Mon, 29 Jan 2007 17:59:06 -0500 (EST) Received: from heartbeat1.messagingengine.com ([10.202.2.160]) by out1.internal (MEProxy); Mon, 29 Jan 2007 17:59:06 -0500 X-Sasl-enc: LdP54oHACuM6rw/0zmkD3N9Fs8BhnZDCJNt9AywR//fc 1170111546 Received: from [192.168.123.18] (82-35-112-254.cable.ubr07.dals.blueyonder.co.uk [82.35.112.254]) by mail.messagingengine.com (Postfix) with ESMTP id C42991A180; Mon, 29 Jan 2007 17:59:05 -0500 (EST) Message-ID: <45BE7C37.20903@FreeBSD.org> Date: Mon, 29 Jan 2007 22:59:03 +0000 From: "Bruce M. Simpson" User-Agent: Thunderbird 1.5.0.9 (X11/20070125) MIME-Version: 1.0 To: Gleb Smirnoff References: <20070125162422.GA7922@bestcom.ru> <45B8EB23.705@FreeBSD.org> <20070125183720.GB7922@cell.sick.ru> <20070125203807.S13293@fledge.watson.org> <20070125212310.GG7922@cell.sick.ru> <20070125214956.J13293@fledge.watson.org> <20070126114449.GM7922@cell.sick.ru> In-Reply-To: <20070126114449.GM7922@cell.sick.ru> Content-Type: text/plain; charset=KOI8-R; format=flowed Content-Transfer-Encoding: 7bit Cc: Robert Watson , net@FreeBSD.org Subject: Re: rev. 1.94 of netinet/in.c broke CARP X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jan 2007 22:59:07 -0000 Hello, I've had a chance to read ip_carp.c in more detail now, so... Gleb Smirnoff wrote: > Is adding a generic GC function a correct way or was it better to just fix > the buggy layer, that forgot about its multicast memberships? > In the bigger picture: The real fix for netinet is to do what netinet6 does; that is, refcount the memberships and keep them in a list, rather than a vector. This would have been my preferred fix. However, this breaks the ABI for drivers, and is a larger change. The less intrusive, non-ABI-breaking change (discussed with Robert at the time) was to convert a statically allocated array to a lazy-reallocated vector. This was considered acceptable for the upcoming 6.2 release at that point in time. Unfortunately, due to how CARP works, two bugs were fixed at the expense of introducing another. > ATM, I can fix the CARP in the following way: > > 1) Call multicast cleanup, if we are destroying carp interface itself. > 2) Don't call multicast cleanup, if we are called through EVENTHANDLER(9) > since parent is detaching. > > Would this fix be ok? > Yes. In fact I would go so far as to say that it is the correct behaviour for CARP. Resource allocation and free for CARP runs along two separate paths; the case where a member interface is detached cannot be considered the same as when CARP itself is detaching, they are two distinct paths. imo_membership 'belongs to' netinet attached to an ifnet. CARP merely borrows it. Regards, BMS