bail early in nd6_na_output() if not carp master

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

bail early in nd6_na_output() if not carp master

Florian Obser-2
Spotted this when reviewing Claudio's m_align diff and wondered why we
bail right at the end just before we send the packet. Is there stuff
happening before that's important? Turns out no.

(I suspect this is a belt for suspenders somewhere else in the stack
and we never get here on a carp backup interface).

OK?

diff --git netinet6/nd6_nbr.c netinet6/nd6_nbr.c
index a90f852b25e..6aa2586a082 100644
--- netinet6/nd6_nbr.c
+++ netinet6/nd6_nbr.c
@@ -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;
@@ -1010,12 +1016,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;


--
I'm not entirely sure you are real.

Reply | Threaded
Open this post in threaded view
|

Re: bail early in nd6_na_output() if not carp master

Claudio Jeker
On Thu, Dec 06, 2018 at 08:03:01PM +0100, Florian Obser wrote:
> Spotted this when reviewing Claudio's m_align diff and wondered why we
> bail right at the end just before we send the packet. Is there stuff
> happening before that's important? Turns out no.
>
> (I suspect this is a belt for suspenders somewhere else in the stack
> and we never get here on a carp backup interface).
>
> OK?

Sure OK claudio@
 

> diff --git netinet6/nd6_nbr.c netinet6/nd6_nbr.c
> index a90f852b25e..6aa2586a082 100644
> --- netinet6/nd6_nbr.c
> +++ netinet6/nd6_nbr.c
> @@ -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;
> @@ -1010,12 +1016,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;
>
>
> --
> I'm not entirely sure you are real.
>

--
:wq Claudio