From patchwork Thu Aug 23 15:39:39 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aurelien Jarno X-Patchwork-Id: 179673 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 3D3022C00AF for ; Fri, 24 Aug 2012 01:40:07 +1000 (EST) Received: from localhost ([::1]:38086 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T4ZVp-0003Ys-NX for incoming@patchwork.ozlabs.org; Thu, 23 Aug 2012 11:40:01 -0400 Received: from eggs.gnu.org ([208.118.235.92]:41181) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T4ZVh-0003Wp-4u for qemu-devel@nongnu.org; Thu, 23 Aug 2012 11:39:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T4ZVg-0002Ro-8t for qemu-devel@nongnu.org; Thu, 23 Aug 2012 11:39:53 -0400 Received: from hall.aurel32.net ([88.191.126.93]:50181) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T4ZVg-0002Qa-1H for qemu-devel@nongnu.org; Thu, 23 Aug 2012 11:39:52 -0400 Received: from wifi-nat233.ulb.ac.be ([164.15.117.233] helo=ohm.aurel32.net) by hall.aurel32.net with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1T4ZVb-00027J-Aq; Thu, 23 Aug 2012 17:39:47 +0200 Received: from aurel32 by ohm.aurel32.net with local (Exim 4.80) (envelope-from ) id 1T4ZVU-0004Iz-Pt; Thu, 23 Aug 2012 17:39:40 +0200 From: Aurelien Jarno To: qemu-devel@nongnu.org Date: Thu, 23 Aug 2012 17:39:39 +0200 Message-Id: <1345736379-16101-1-git-send-email-aurelien@aurel32.net> X-Mailer: git-send-email 1.7.10.4 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 88.191.126.93 Cc: Peter Maydell , Aurelien Jarno Subject: [Qemu-devel] [PATCH ] lan9118: fix multicast filtering X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org The lan9118 emulation tries to compute the multicast index by calling directly the crc32() function from zlib, but fails to get the correct result. Use the common compute_mcast_idx() function instead, which gives the correct result. This fixes IPv6 support. Signed-off-by: Aurelien Jarno Reviewed-by: Peter Maydell --- hw/lan9118.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/lan9118.c b/hw/lan9118.c index ff0a50b..ceaf96f 100644 --- a/hw/lan9118.c +++ b/hw/lan9118.c @@ -500,7 +500,7 @@ static int lan9118_filter(lan9118_state *s, const uint8_t *addr) } } else { /* Hash matching */ - hash = (crc32(~0, addr, 6) >> 26); + hash = compute_mcast_idx(addr); if (hash & 0x20) { return (s->mac_hashh >> (hash & 0x1f)) & 1; } else {