2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 06:15:47 +00:00

netdev-linux: Fix aliasing error.

The latest version of GCC flags a common socket convention as breaking
strict-aliasing rules.  This commit removes the aliasing and gets rid of
the scary warning.
This commit is contained in:
Ben Pfaff
2009-12-14 22:59:55 -08:00
committed by Justin Pettit
parent c39c2868e0
commit c100e025e2

View File

@@ -1710,14 +1710,14 @@ netdev_linux_arp_lookup(const struct netdev *netdev,
uint32_t ip, uint8_t mac[ETH_ADDR_LEN])
{
struct arpreq r;
struct sockaddr_in *pa;
struct sockaddr_in sin;
int retval;
memset(&r, 0, sizeof r);
pa = (struct sockaddr_in *) &r.arp_pa;
pa->sin_family = AF_INET;
pa->sin_addr.s_addr = ip;
pa->sin_port = 0;
sin.sin_family = AF_INET;
sin.sin_addr.s_addr = ip;
sin.sin_port = 0;
memcpy(&r.arp_pa, &sin, sizeof sin);
r.arp_ha.sa_family = ARPHRD_ETHER;
r.arp_flags = 0;
strncpy(r.arp_dev, netdev->name, sizeof r.arp_dev);