Print this page
9832 Original bug discovered as 9560 has friends IPv4 packets coming in as IPv6 creating chaos

@@ -18,10 +18,11 @@
  *
  * CDDL HEADER END
  */
 /*
  * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2018 Joyent, Inc.
  */
 
 /*
  * MAC Services Module - misc utilities
  */

@@ -489,11 +490,18 @@
         ip6_rthdr_t *rthdr;
         ip6_frag_t *fraghdr;
 
         if (((uchar_t *)ip6h + IPV6_HDR_LEN) > endptr)
                 return (B_FALSE);
-        ASSERT(IPH_HDR_VERSION(ip6h) == IPV6_VERSION);
+        /*
+         * NOTE: Version-check failure here may cause mismatched IP versions
+         * to propagate ENOBUFS in some callers, instead of letting the
+         * packet reach the appropriate IP input function, where version check
+         * errors are logged & counted.
+         */
+        if (IPH_HDR_VERSION(ip6h) != IPV6_VERSION)
+                return (B_FALSE);
         length = IPV6_HDR_LEN;
         whereptr = ((uint8_t *)&ip6h[1]); /* point to next hdr */
 
         if (fragp != NULL)
                 *fragp = NULL;