Print this page
Don't create DCE for bad MTU.

@@ -681,11 +681,23 @@
 
         /* Caller has already pulled up everything. */
         ip6h = (ip6_t *)&icmp6[1];
         final_dst = ip_get_dst_v6(ip6h, NULL, NULL);
 
+        mtu = ntohl(icmp6->icmp6_mtu);
+        if (mtu < IPV6_MIN_MTU) {
         /*
+                 * RFC 8021 suggests to ignore messages where mtu is
+                 * less than the IPv6 minimum.
+                 */
+                ip1dbg(("Received mtu less than IPv6 "
+                    "min mtu %d: %d\n", IPV6_MIN_MTU, mtu));
+                DTRACE_PROBE1(icmp6__too__small__mtu, uint32_t, mtu);
+                return;
+        }
+
+        /*
          * For link local destinations matching simply on address is not
          * sufficient. Same link local addresses for different ILL's is
          * possible.
          */
         if (IN6_IS_ADDR_LINKSCOPE(&final_dst)) {

@@ -703,38 +715,26 @@
                             &final_dst);
                 }
                 return;
         }
 
-        mtu = ntohl(icmp6->icmp6_mtu);
-
         mutex_enter(&dce->dce_lock);
         if (dce->dce_flags & DCEF_PMTU)
                 old_max_frag = dce->dce_pmtu;
         else if (IN6_IS_ADDR_MULTICAST(&final_dst))
                 old_max_frag = ill->ill_mc_mtu;
         else
                 old_max_frag = ill->ill_mtu;
 
-        if (mtu >= IPV6_MIN_MTU) {
                 ip1dbg(("Received mtu from router: %d\n", mtu));
                 DTRACE_PROBE1(icmp6__received__mtu, uint32_t, mtu);
                 dce->dce_pmtu = MIN(old_max_frag, mtu);
                 icmp6->icmp6_mtu = htonl(dce->dce_pmtu);
 
                 /* We now have a PMTU for sure */
                 dce->dce_flags |= DCEF_PMTU;
                 dce->dce_last_change_time = TICK_TO_SEC(ddi_get_lbolt64());
-        } else {
-                /*
-                 * RFC 8021 suggests to ignore messages where mtu is
-                 * less than the IPv6 minimum.
-                 */
-                ip1dbg(("Received mtu less than IPv6 "
-                    "min mtu %d: %d\n", IPV6_MIN_MTU, mtu));
-                DTRACE_PROBE1(icmp6__too__small__mtu, uint32_t, mtu);
-        }
 
         mutex_exit(&dce->dce_lock);
         /*
          * After dropping the lock the new value is visible to everyone.
          * Then we bump the generation number so any cached values reinspect