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 <o.hartmann@walstatt.org>
This commit is contained in:
parent
93567e8778
commit
cfff8d3dbd
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=310864
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user