summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Hill <dhill@cvs.openbsd.org>2011-07-03 17:55:26 +0000
committerDavid Hill <dhill@cvs.openbsd.org>2011-07-03 17:55:26 +0000
commit1f96a6c314b39d9dd22fa6d12ffdcc86d3b1946d (patch)
treeb544bfabc3ce60b580a8cc0baf3b5831ce76c078
parent94c378f7daae1afdb136246e7d30f085f9aceec2 (diff)
avoid void * pointer arithmetic
OK claudio@
-rw-r--r--sys/netinet/ip_carp.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/netinet/ip_carp.c b/sys/netinet/ip_carp.c
index 43634bf6443..5b27c31d555 100644
--- a/sys/netinet/ip_carp.c
+++ b/sys/netinet/ip_carp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_carp.c,v 1.185 2011/07/03 17:37:48 claudio Exp $ */
+/* $OpenBSD: ip_carp.c,v 1.186 2011/07/03 17:55:25 dhill Exp $ */
/*
* Copyright (c) 2002 Michael Shalayeff. All rights reserved.
@@ -596,7 +596,7 @@ carp_proto_input(struct mbuf *m, ...)
return;
}
ip = mtod(m, struct ip *);
- ch = (void *)ip + iplen;
+ ch = (struct carp_header *)(mtod(m, caddr_t) + iplen);
/* verify the CARP checksum */
m->m_data += iplen;
@@ -1172,7 +1172,7 @@ carp_send_ad(void *v)
if (IN_MULTICAST(ip->ip_dst.s_addr))
m->m_flags |= M_MCAST;
- ch_ptr = (void *)ip + sizeof(*ip);
+ ch_ptr = (struct carp_header *)(ip + 1);
bcopy(&ch, ch_ptr, sizeof(ch));
if (carp_prepare_ad(m, vhe, ch_ptr))
goto retry_later;
@@ -1261,7 +1261,7 @@ carp_send_ad(void *v)
ip6->ip6_dst.s6_addr16[1] = htons(sc->sc_carpdev->if_index);
ip6->ip6_dst.s6_addr8[15] = 0x12;
- ch_ptr = (void *)ip6 + sizeof(*ip6);
+ ch_ptr = (struct carp_header *)(ip6 + 1);
bcopy(&ch, ch_ptr, sizeof(ch));
if (carp_prepare_ad(m, vhe, ch_ptr))
goto retry_later;