From cfff8d3dbd2f37103e685837ed40fcd4b71a4d44 Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Fri, 30 Dec 2016 21:33:01 +0000 Subject: [PATCH] Unbreak ip_carp with WITHOUT_INET6 enabled by conditionalizing all IPv6 structs under the INET6 #ifdef. Similarly (even though it doesn't seem to affect the build), conditionalize all IPv4 structs under the INET #ifdef This also unbreaks the LINT-NOINET6 tinderbox target on amd64; I have not verified other MACHINE/TARGET pairs (e.g. armv6/arm). MFC after: 2 weeks X-MFC with: r310847 Pointyhat to: jpaetzel Reported by: O. Hartmann --- sys/netinet/ip_carp.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/sys/netinet/ip_carp.c b/sys/netinet/ip_carp.c index ae04d5914a0..0a5fed78295 100644 --- a/sys/netinet/ip_carp.c +++ b/sys/netinet/ip_carp.c @@ -598,23 +598,29 @@ carp6_input(struct mbuf **mp, int *offp, int proto) static int carp_source_is_self(struct mbuf *m, struct ifaddr *ifa, sa_family_t af) { +#ifdef INET struct ip *ip4; struct in_addr in4; +#endif +#ifdef INET6 struct ip6_hdr *ip6; struct in6_addr in6; +#endif switch (af) { +#ifdef INET case AF_INET: ip4 = mtod(m, struct ip *); in4 = ifatoia(ifa)->ia_addr.sin_addr; return (in4.s_addr == ip4->ip_src.s_addr); - +#endif +#ifdef INET6 case AF_INET6: ip6 = mtod(m, struct ip6_hdr *); in6 = ifatoia6(ifa)->ia_addr.sin6_addr; return (memcmp(&in6, &ip6->ip6_src, sizeof(in6)) == 0); - - default: /* how did this happen? */ +#endif + default: break; } return (0);