From 2fa1cef0167ca330a2d1abd865c3e465cd032230 Mon Sep 17 00:00:00 2001 From: Stefano Brivio Date: Mon, 28 Feb 2022 22:17:32 +0100 Subject: arp, dhcp: Fix strict aliasing warnings reported by gcc 4.9 with -Ofast Signed-off-by: Stefano Brivio --- arp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'arp.c') 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. */ -- cgit v1.2.3