aboutgitcodebugslistschat
path: root/arp.c
diff options
context:
space:
mode:
authorStefano Brivio <sbrivio@redhat.com>2022-02-28 22:17:32 +0100
committerStefano Brivio <sbrivio@redhat.com>2022-02-28 22:17:32 +0100
commit2fa1cef0167ca330a2d1abd865c3e465cd032230 (patch)
treeb4082750da9ec030ee95e4c1490fb2b0f927429a /arp.c
parent213c397492bdc64cf26b2e7b3877e4a29dc9f8da (diff)
downloadpasst-2fa1cef0167ca330a2d1abd865c3e465cd032230.tar
passt-2fa1cef0167ca330a2d1abd865c3e465cd032230.tar.gz
passt-2fa1cef0167ca330a2d1abd865c3e465cd032230.tar.bz2
passt-2fa1cef0167ca330a2d1abd865c3e465cd032230.tar.lz
passt-2fa1cef0167ca330a2d1abd865c3e465cd032230.tar.xz
passt-2fa1cef0167ca330a2d1abd865c3e465cd032230.tar.zst
passt-2fa1cef0167ca330a2d1abd865c3e465cd032230.zip
arp, dhcp: Fix strict aliasing warnings reported by gcc 4.9 with -Ofast
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'arp.c')
-rw-r--r--arp.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/arp.c b/arp.c
index b5af49f..3195692 100644
--- a/arp.c
+++ b/arp.c
@@ -58,7 +58,8 @@ int arp(struct ctx *c, struct ethhdr *eh, size_t len)
/* Discard announcements (but not 0.0.0.0 "probes"): we might have the
* same IP address, hide that.
*/
- if (*((uint32_t *)&am->sip) && !memcmp(am->sip, am->tip, 4))
+ if (memcmp(am->sip, (unsigned char[4]){ 0, 0, 0, 0 }, 4) &&
+ !memcmp(am->sip, am->tip, 4))
return 1;
/* Don't resolve our own address, either. */