no need to do route lookup and perform other expensive checks
if redirect destination is not unicast.  this just moves this
check a bit up.  ok?

diff --git sys/netinet6/icmp6.c sys/netinet6/icmp6.c
index 1501766..40361f4 100644
--- sys/netinet6/icmp6.c
+++ sys/netinet6/icmp6.c
@@ -2212,6 +2212,13 @@ icmp6_redirect_input(struct mbuf *m, int off)
                        ip6_sprintf(&src6), ip6->ip6_hlim));
                goto bad;
        }
+       if (IN6_IS_ADDR_MULTICAST(&reddst6)) {
+               nd6log((LOG_ERR,
+                       "ICMP6 redirect rejected; "
+                       "redirect dst must be unicast: %s\n",
+                       icmp6_redirect_diag(&src6, &reddst6, &redtgt6)));
+               goto bad;
+       }
     {
        /* ip6->ip6_src must be equal to gw for icmp6->icmp6_reddst */
        struct sockaddr_in6 sin6;
@@ -2254,13 +2261,6 @@ icmp6_redirect_input(struct mbuf *m, int off)
        RTFREE(rt);
        rt = NULL;
     }
-       if (IN6_IS_ADDR_MULTICAST(&reddst6)) {
-               nd6log((LOG_ERR,
-                       "ICMP6 redirect rejected; "
-                       "redirect dst must be unicast: %s\n",
-                       icmp6_redirect_diag(&src6, &reddst6, &redtgt6)));
-               goto bad;
-       }
 
        is_router = is_onlink = 0;
        if (IN6_IS_ADDR_LINKLOCAL(&redtgt6))

Reply via email to