From owner-freebsd-net@FreeBSD.ORG Wed Feb 21 00:34:57 2007 Return-Path: X-Original-To: freebsd-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 9273516A408 for ; Wed, 21 Feb 2007 00:34:57 +0000 (UTC) (envelope-from bms@FreeBSD.org) Received: from out5.smtp.messagingengine.com (out5.smtp.messagingengine.com [66.111.4.29]) by mx1.freebsd.org (Postfix) with ESMTP id 67A3A13C428 for ; Wed, 21 Feb 2007 00:34:57 +0000 (UTC) (envelope-from bms@FreeBSD.org) Received: from out1.internal (unknown [10.202.2.149]) by out1.messagingengine.com (Postfix) with ESMTP id D50DE1BC0AE; Tue, 20 Feb 2007 19:36:04 -0500 (EST) Received: from heartbeat1.messagingengine.com ([10.202.2.160]) by out1.internal (MEProxy); Tue, 20 Feb 2007 19:36:04 -0500 X-Sasl-enc: pN4VO6AjsnpnuAwzu4+pwzRNFlhWua09u5iJxpi1bzYk 1172018163 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 762422D07D; Tue, 20 Feb 2007 19:36:03 -0500 (EST) Message-ID: <45DB93AE.7030804@FreeBSD.org> Date: Wed, 21 Feb 2007 00:34:54 +0000 From: "Bruce M. Simpson" User-Agent: Thunderbird 1.5.0.9 (X11/20070125) MIME-Version: 1.0 To: Jouke Witteveen References: <3993a4980702051233u10c30575kd1f6d27fcd600110@mail.gmail.com> <45C7A1F9.20306@FreeBSD.org> <3993a4980702170546t7f9384eaq358986a4cc734582@mail.gmail.com> In-Reply-To: <3993a4980702170546t7f9384eaq358986a4cc734582@mail.gmail.com> Content-Type: multipart/mixed; boundary="------------000101000609080301020806" Cc: freebsd-net@freebsd.org Subject: Re: ioctl: SIOCADDMULTI (howto?) 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: Wed, 21 Feb 2007 00:34:57 -0000 This is a multi-part message in MIME format. --------------000101000609080301020806 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Jouke Witteveen wrote: > > I hope someone can find a spare minute to look at if_findmulti. It > would help me quite much. I verified with mtest that FreeBSD cannot delete an AF_LINK multicast membership, reproduced with both 7-CURRENT and 6.2-RELEASE. if_findmulti() appears to be doing a possibly incorrect comparison. sa_equal() is not valid for use with AF_LINK in some cases, as sockaddr_dl has deeper structure than a simple array of bytes. Thanks for finding this bug -- it would have affected XORP's IS-IS implementation further on in time. Further testing would be appreciated. If the fix is good I will merge, though it should perhaps be a more general fix for sa_equal(). BMS --------------000101000609080301020806 Content-Type: text/x-patch; name="ethermcast.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="ethermcast.diff" Index: src/sys/net/if.c =================================================================== RCS file: /home/ncvs/src/sys/net/if.c,v retrieving revision 1.265 diff -u -p -r1.265 if.c --- src/sys/net/if.c 30 Nov 2006 15:02:01 -0000 1.265 +++ src/sys/net/if.c 21 Feb 2007 00:34:12 -0000 @@ -2123,8 +2123,16 @@ if_findmulti(struct ifnet *ifp, struct s IF_ADDR_LOCK_ASSERT(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (sa_equal(ifma->ifma_addr, sa)) - break; + if (sa->sa_family == AF_LINK) { + struct sockaddr_dl *sdl = (struct sockaddr_dl *)sa; + + if (bcmp(LLADDR((struct sockaddr_dl *)ifma->ifma_addr), + LLADDR(sdl), sdl->sdl_alen) == 0) + break; + } else { + if (sa_equal(ifma->ifma_addr, sa)) + break; + } } return ifma; --------------000101000609080301020806--