On 24 May 2017 at 20:02, Ben Pfaff <[email protected]> wrote:
> On Tue, May 23, 2017 at 04:02:12PM -0700, Joe Stringer wrote:
>> Clang 4.0 complains:
>>
>> ../lib/odp-execute.c:61:37: error: taking address of packed member 'eth_dst' 
>> of
>> class or structure 'eth_header' may result in an unaligned pointer value
>>       [-Werror,-Waddress-of-packed-member]
>>             ether_addr_copy_masked(&eh->eth_src, key->eth_src, 
>> mask->eth_src);
>>                                     ^~~~~~~~~~~
>> ../lib/odp-execute.c:62:37: error: taking address of packed member 'eth_dst' 
>> of
>> class or structure 'eth_header' may result in an unaligned pointer value
>>       [-Werror,-Waddress-of-packed-member]
>>             ether_addr_copy_masked(&eh->eth_dst, key->eth_dst, 
>> mask->eth_dst);
>>
>> Ethernet source addresses are 48 bits offset into the Ethernet header,
>> so taking a pointer for this is not guaranteed to be valid on all
>> architectures. Fix this by referencing the memory direct from the
>> Ethernet header pointer.
>>
>> Signed-off-by: Joe Stringer <[email protected]>
>
> I don't understand--why does Clang think that there's something packed
> here?  I don't see any packed annotation on struct eth_header (and I
> don't think it needs one).

https://github.com/openvswitch/ovs/blob/master/lib/packets.h#L398

I believe that this is the wire-formatted version that we use for
assembling PDUs for protocols such as STP, so I think it needs to be
properly packed.
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to