summaryrefslogtreecommitdiff
path: root/sys/netinet6/nd6_nbr.c
diff options
context:
space:
mode:
authorFlorian Obser <florian@cvs.openbsd.org>2018-12-07 10:01:07 +0000
committerFlorian Obser <florian@cvs.openbsd.org>2018-12-07 10:01:07 +0000
commit9e6238409f2016f419b4469fa0578372d3525b2f (patch)
treea689954ef3eec6d630b6474797dfb58b805512ed /sys/netinet6/nd6_nbr.c
parent91e4ae9c69fa65c435d9fef9d41fffa4e02e2219 (diff)
We are not going to send a neighbor advertisement from a non-master
carp interface. Move the check to the beginning of the function to make it clear that there are no other side effects happening. OK claudio
Diffstat (limited to 'sys/netinet6/nd6_nbr.c')
-rw-r--r--sys/netinet6/nd6_nbr.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/sys/netinet6/nd6_nbr.c b/sys/netinet6/nd6_nbr.c
index 174f0759a81..167679bbb5f 100644
--- a/sys/netinet6/nd6_nbr.c
+++ b/sys/netinet6/nd6_nbr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nd6_nbr.c,v 1.125 2018/12/06 08:11:52 claudio Exp $ */
+/* $OpenBSD: nd6_nbr.c,v 1.126 2018/12/07 10:01:06 florian Exp $ */
/* $KAME: nd6_nbr.c,v 1.61 2001/02/10 16:06:14 jinmei Exp $ */
/*
@@ -891,6 +891,12 @@ nd6_na_output(struct ifnet *ifp, struct in6_addr *daddr6,
int icmp6len, maxlen;
caddr_t mac = NULL;
+#if NCARP > 0
+ /* Do not send NAs for carp addresses if we're not the CARP master. */
+ if (ifp->if_type == IFT_CARP && !carp_iamatch(ifp))
+ return;
+#endif
+
/* estimate the size of message */
maxlen = sizeof(*ip6) + sizeof(*nd_na);
maxlen += (sizeof(struct nd_opt_hdr) + ifp->if_addrlen + 7) & ~7;
@@ -1009,12 +1015,6 @@ nd6_na_output(struct ifnet *ifp, struct in6_addr *daddr6,
} else
flags &= ~ND_NA_FLAG_OVERRIDE;
-#if NCARP > 0
- /* Do not send NAs for carp addresses if we're not the CARP master. */
- if (ifp->if_type == IFT_CARP && !carp_iamatch(ifp))
- goto bad;
-#endif
-
ip6->ip6_plen = htons((u_short)icmp6len);
nd_na->nd_na_flags_reserved = flags;
nd_na->nd_na_cksum = 0;