Print this page
7819 IPv6 Packet and MTU bug


   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright (c) 1991, 2010, Oracle and/or its affiliates. All rights reserved.
  24  * Copyright (c) 1990 Mentat Inc.
  25  * Copyright (c) 2012 Joyent, Inc. All rights reserved.
  26  * Copyright (c) 2014, OmniTI Computer Consulting, Inc. All rights reserved.
  27  */
  28 
  29 #include <sys/types.h>
  30 #include <sys/stream.h>
  31 #include <sys/dlpi.h>
  32 #include <sys/stropts.h>
  33 #include <sys/sysmacros.h>
  34 #include <sys/strsubr.h>
  35 #include <sys/strlog.h>
  36 #include <sys/strsun.h>
  37 #include <sys/zone.h>
  38 #define _SUN_TPI_VERSION 2
  39 #include <sys/tihdr.h>
  40 #include <sys/xti_inet.h>
  41 #include <sys/ddi.h>
  42 #include <sys/suntpi.h>
  43 #include <sys/cmn_err.h>
  44 #include <sys/debug.h>
  45 #include <sys/kobj.h>
  46 #include <sys/modctl.h>


3841                 if (ixa->ixa_flags & IXAF_USE_MIN_MTU) {
3842                         switch (ixa->ixa_use_min_mtu) {
3843                         case IPV6_USE_MIN_MTU_MULTICAST:
3844                                 if (ire->ire_type & IRE_MULTICAST)
3845                                         pmtu = IPV6_MIN_MTU;
3846                                 break;
3847                         case IPV6_USE_MIN_MTU_ALWAYS:
3848                                 pmtu = IPV6_MIN_MTU;
3849                                 break;
3850                         case IPV6_USE_MIN_MTU_NEVER:
3851                                 break;
3852                         }
3853                 } else {
3854                         /* Default is IPV6_USE_MIN_MTU_MULTICAST */
3855                         if (ire->ire_type & IRE_MULTICAST)
3856                                 pmtu = IPV6_MIN_MTU;
3857                 }
3858         }
3859 
3860         /*
3861          * After receiving an ICMPv6 "packet too big" message with a
3862          * MTU < 1280, and for multirouted IPv6 packets, the IP layer
3863          * will insert a 8-byte fragment header in every packet. We compensate
3864          * for those cases by returning a smaller path MTU to the ULP.
3865          *
3866          * In the case of CGTP then ip_output will add a fragment header.
3867          * Make sure there is room for it by telling a smaller number
3868          * to the transport.
3869          *
3870          * When IXAF_IPV6_ADDR_FRAGHDR we subtract the frag hdr here
3871          * so the ULPs consistently see a iulp_pmtu and ip_get_pmtu()
3872          * which is the size of the packets it can send.
3873          */
3874         if (!(ixa->ixa_flags & IXAF_IS_IPV4)) {
3875                 if ((dce->dce_flags & DCEF_TOO_SMALL_PMTU) ||
3876                     (ire->ire_flags & RTF_MULTIRT) ||
3877                     (ixa->ixa_flags & IXAF_MULTIRT_MULTICAST)) {
3878                         pmtu -= sizeof (ip6_frag_t);
3879                         ixa->ixa_flags |= IXAF_IPV6_ADD_FRAGHDR;
3880                 }
3881         }
3882 
3883         return (pmtu);
3884 }
3885 
3886 /*
3887  * Carve "len" bytes out of an mblk chain, consuming any we empty, and duping
3888  * the final piece where we don't.  Return a pointer to the first mblk in the
3889  * result, and update the pointer to the next mblk to chew on.  If anything
3890  * goes wrong (i.e., dupb fails), we waste everything in sight and return a
3891  * NULL pointer.
3892  */
3893 mblk_t *
3894 ip_carve_mp(mblk_t **mpp, ssize_t len)
3895 {
3896         mblk_t  *mp0;




   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright (c) 1991, 2010, Oracle and/or its affiliates. All rights reserved.
  24  * Copyright (c) 1990 Mentat Inc.
  25  * Copyright (c) 2012 Joyent, Inc. All rights reserved.
  26  * Copyright (c) 2017 OmniTI Computer Consulting, Inc. All rights reserved.
  27  */
  28 
  29 #include <sys/types.h>
  30 #include <sys/stream.h>
  31 #include <sys/dlpi.h>
  32 #include <sys/stropts.h>
  33 #include <sys/sysmacros.h>
  34 #include <sys/strsubr.h>
  35 #include <sys/strlog.h>
  36 #include <sys/strsun.h>
  37 #include <sys/zone.h>
  38 #define _SUN_TPI_VERSION 2
  39 #include <sys/tihdr.h>
  40 #include <sys/xti_inet.h>
  41 #include <sys/ddi.h>
  42 #include <sys/suntpi.h>
  43 #include <sys/cmn_err.h>
  44 #include <sys/debug.h>
  45 #include <sys/kobj.h>
  46 #include <sys/modctl.h>


3841                 if (ixa->ixa_flags & IXAF_USE_MIN_MTU) {
3842                         switch (ixa->ixa_use_min_mtu) {
3843                         case IPV6_USE_MIN_MTU_MULTICAST:
3844                                 if (ire->ire_type & IRE_MULTICAST)
3845                                         pmtu = IPV6_MIN_MTU;
3846                                 break;
3847                         case IPV6_USE_MIN_MTU_ALWAYS:
3848                                 pmtu = IPV6_MIN_MTU;
3849                                 break;
3850                         case IPV6_USE_MIN_MTU_NEVER:
3851                                 break;
3852                         }
3853                 } else {
3854                         /* Default is IPV6_USE_MIN_MTU_MULTICAST */
3855                         if (ire->ire_type & IRE_MULTICAST)
3856                                 pmtu = IPV6_MIN_MTU;
3857                 }
3858         }
3859 
3860         /*
3861          * For multirouted IPv6 packets, the IP layer will insert a 8-byte
3862          * fragment header in every packet. We compensate for those cases by
3863          * returning a smaller path MTU to the ULP.

3864          *
3865          * In the case of CGTP then ip_output will add a fragment header.
3866          * Make sure there is room for it by telling a smaller number
3867          * to the transport.
3868          *
3869          * When IXAF_IPV6_ADDR_FRAGHDR we subtract the frag hdr here
3870          * so the ULPs consistently see a iulp_pmtu and ip_get_pmtu()
3871          * which is the size of the packets it can send.
3872          */
3873         if (!(ixa->ixa_flags & IXAF_IS_IPV4)) {
3874                 if ((ire->ire_flags & RTF_MULTIRT) ||

3875                     (ixa->ixa_flags & IXAF_MULTIRT_MULTICAST)) {
3876                         pmtu -= sizeof (ip6_frag_t);
3877                         ixa->ixa_flags |= IXAF_IPV6_ADD_FRAGHDR;
3878                 }
3879         }
3880 
3881         return (pmtu);
3882 }
3883 
3884 /*
3885  * Carve "len" bytes out of an mblk chain, consuming any we empty, and duping
3886  * the final piece where we don't.  Return a pointer to the first mblk in the
3887  * result, and update the pointer to the next mblk to chew on.  If anything
3888  * goes wrong (i.e., dupb fails), we waste everything in sight and return a
3889  * NULL pointer.
3890  */
3891 mblk_t *
3892 ip_carve_mp(mblk_t **mpp, ssize_t len)
3893 {
3894         mblk_t  *mp0;