[ovs-dev] [PATCH 2/5] ofproto-dpif: Fix unaligned eth_addr pointers.

Ben Pfaff blp at ovn.org
Thu May 25 03:39:22 UTC 2017


On Tue, May 23, 2017 at 04:02:13PM -0700, Joe Stringer wrote:
> Clang 4.0 complains:
> 
> ../ofproto/ofproto-dpif.c:2291:46: error: taking address of packed member
> 'eth_src' of class or structure 'eth_header' may result in an unaligned pointer
> value
>       [-Werror,-Waddress-of-packed-member]
>     netdev_get_etheraddr(ofport->up.netdev, &eth->eth_src);
>                                              ^~~~~~~~~~~~
> ../ofproto/ofproto-dpif.c:2316:50: error: taking address of packed member
> 'eth_src' of class or structure 'eth_header' may result in an unaligned pointer
> value
>       [-Werror,-Waddress-of-packed-member]
>         netdev_get_etheraddr(ofport->up.netdev, &eth->eth_src);
> 
> 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 retrieving the mac address to the local stack
> and copying it into the header.
> 
> Signed-off-by: Joe Stringer <joe at ovn.org>

Hmm, I still don't understand what's packed here.


More information about the dev mailing list