qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH ] lan9118: fix multicast filtering


From: Aurelien Jarno
Subject: Re: [Qemu-devel] [PATCH ] lan9118: fix multicast filtering
Date: Fri, 7 Sep 2012 16:56:24 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

On Thu, Aug 23, 2012 at 05:39:39PM +0200, Aurelien Jarno wrote:
> 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 <address@hidden>
> ---
>  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 {

Ping?

For the record the Linux kernel uses the ether_crc() function for
smsc911x.c, but also for 8139cp.c, 8139too.c and ethoc.c, which use
compute_mcast_idx() on the QEMU side.

To test it, just run this machine with a Linux kernel with IPv6 support
on an IPv6-enabled network with router advertisement, it should get an
IPv6 address automatically. It doesn't without this patch.

-- 
Aurelien Jarno                          GPG: 1024D/F1BCDB73
address@hidden                 http://www.aurel32.net



reply via email to

[Prev in Thread] Current Thread [Next in Thread]