qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PULL 4/4] net: disallow to specify multicast MAC addre


From: Eric Blake
Subject: Re: [Qemu-devel] [PULL 4/4] net: disallow to specify multicast MAC address
Date: Fri, 18 Oct 2013 10:39:24 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.0

On 10/18/2013 10:34 AM, Stefan Hajnoczi wrote:

>>> +
>>> +bool net_macaddr_is_multicast(uint8_t *macaddr)
>>> +{
>>> +    return macaddr[0] % 2;
>>> +}
>>
>> Duplicate, we already have is_multicast_ether_addr() in include/net/eth.h
> 
> And net_macaddr_is_multicast() is wrong:
> bit 0 is the unicast/multicast bit, not bit 1.

Huh? 'foo % 2' is the same as 'foo & 1' - both check bit 0.  But I agree
that the '&' form is a bit easier to reason with, even if the compiler
is smart enough to use the same code for both.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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