Print this page
9832 Original bug discovered as 9560 has friends IPv4 packets coming in as IPv6 creating chaos
Reviewed by: Robert Mustacchi <rm@joyent.com>

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/io/mac/mac_protect.c
          +++ new/usr/src/uts/common/io/mac/mac_protect.c
↓ open down ↓ 13 lines elided ↑ open up ↑
  14   14   * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  
  22   22  /*
  23   23   * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
  24      - * Copyright (c) 2015, Joyent, Inc.  All rights reserved.
       24 + * Copyright (c) 2019, Joyent, Inc.  All rights reserved.
  25   25   */
  26   26  /*
  27   27   * Copyright 2014 Nexenta Systems, Inc.  All rights reserved.
  28   28   */
  29   29  
  30   30  #include <sys/cmn_err.h>
  31   31  #include <sys/strsun.h>
  32   32  #include <sys/sdt.h>
  33   33  #include <sys/mac.h>
  34   34  #include <sys/mac_impl.h>
↓ open down ↓ 770 lines elided ↑ open up ↑
 805  805   */
 806  806  static int
 807  807  get_dhcpv6_info(ip6_t *ip6h, uchar_t *end, dhcpv6_message_t **dh6)
 808  808  {
 809  809          uint16_t        hdrlen, client, server;
 810  810          boolean_t       first_frag = B_FALSE;
 811  811          ip6_frag_t      *frag = NULL;
 812  812          uint8_t         proto;
 813  813          struct udphdr   *udph;
 814  814          uchar_t         *dh;
      815 +        int             errno;
 815  816  
 816      -        if (!mac_ip_hdr_length_v6(ip6h, end, &hdrlen, &proto, &frag))
 817      -                return (ENOSPC);
      817 +        errno = mac_ip_hdr_length_v6(ip6h, end, &hdrlen, &proto, &frag);
      818 +        if (errno != 0)
      819 +                return (errno);
 818  820  
 819  821          if (proto != IPPROTO_UDP)
 820  822                  return (EINVAL);
 821  823  
 822  824          if (frag != NULL) {
 823  825                  /*
 824  826                   * All non-initial fragments may pass because we cannot
 825  827                   * identify their type. It's safe to let them through
 826  828                   * because reassembly will fail if we decide to drop the
 827  829                   * initial fragment.
↓ open down ↓ 26 lines elided ↑ open up ↑
 854  856  }
 855  857  
 856  858  static int
 857  859  get_ra_info(ip6_t *ip6h, uchar_t *end, nd_router_advert_t **ra)
 858  860  {
 859  861          uint16_t                hdrlen;
 860  862          ip6_frag_t              *frag = NULL;
 861  863          uint8_t                 proto;
 862  864          uchar_t                 *hdrp;
 863  865          struct icmp6_hdr        *icmp;
      866 +        int                     errno;
 864  867  
 865      -        if (!mac_ip_hdr_length_v6(ip6h, end, &hdrlen, &proto, &frag))
 866      -                return (ENOSPC);
      868 +        errno = mac_ip_hdr_length_v6(ip6h, end, &hdrlen, &proto, &frag);
      869 +        if (errno != 0)
      870 +                return (errno);
 867  871  
 868  872          if (proto != IPPROTO_ICMPV6)
 869  873                  return (EINVAL);
 870  874  
 871  875          if (frag != NULL) {
 872  876                  /*
 873  877                   * All non-initial fragments may pass because we cannot
 874  878                   * identify their type. It's safe to let them through
 875  879                   * because reassembly will fail if we decide to drop the
 876  880                   * initial fragment.
↓ open down ↓ 1741 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX