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>


   3  *
   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   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  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
  23  * Copyright (c) 2017, Joyent, Inc.
  24  */
  25 
  26 #ifndef _SYS_MAC_IMPL_H
  27 #define _SYS_MAC_IMPL_H
  28 
  29 #include <sys/cpupart.h>
  30 #include <sys/modhash.h>
  31 #include <sys/mac_client.h>
  32 #include <sys/mac_provider.h>
  33 #include <sys/note.h>
  34 #include <sys/avl.h>
  35 #include <net/if.h>
  36 #include <sys/mac_flow_impl.h>
  37 #include <netinet/ip6.h>
  38 
  39 #ifdef  __cplusplus
  40 extern "C" {
  41 #endif
  42 
  43 /*


 706         uint8_t                 pr_perm;
 707         uint8_t                 pr_errno;
 708         void                    *pr_default;
 709         size_t                  pr_default_size;
 710         mac_propval_range_t     *pr_range;
 711         uint_t                  pr_range_cur_count;
 712 } mac_prop_info_state_t;
 713 
 714 #define MAC_PROTECT_ENABLED(mcip, type) \
 715         (((mcip)->mci_flent-> \
 716         fe_resource_props.mrp_mask & MRP_PROTECT) != 0 && \
 717         ((mcip)->mci_flent-> \
 718         fe_resource_props.mrp_protect.mp_types & (type)) != 0)
 719 
 720 typedef struct mac_client_impl_s mac_client_impl_t;
 721 
 722 extern void     mac_init(void);
 723 extern int      mac_fini(void);
 724 
 725 extern void     mac_ndd_ioctl(mac_impl_t *, queue_t *, mblk_t *);
 726 extern boolean_t mac_ip_hdr_length_v6(ip6_t *, uint8_t *, uint16_t *,
 727     uint8_t *, ip6_frag_t **);
 728 
 729 extern mblk_t *mac_copymsgchain_cksum(mblk_t *);
 730 extern mblk_t *mac_fix_cksum(mblk_t *);
 731 extern void mac_packet_print(mac_handle_t, mblk_t *);
 732 extern void mac_rx_deliver(void *, mac_resource_handle_t, mblk_t *,
 733     mac_header_info_t *);
 734 extern void mac_tx_notify(mac_impl_t *);
 735 
 736 extern  boolean_t mac_callback_find(mac_cb_info_t *, mac_cb_t **, mac_cb_t *);
 737 extern  void    mac_callback_add(mac_cb_info_t *, mac_cb_t **, mac_cb_t *);
 738 extern  boolean_t mac_callback_remove(mac_cb_info_t *, mac_cb_t **, mac_cb_t *);
 739 extern  void    mac_callback_remove_wait(mac_cb_info_t *);
 740 extern  void    mac_callback_free(mac_cb_t *);
 741 extern  mac_cb_t *mac_callback_walker_cleanup(mac_cb_info_t *, mac_cb_t **);
 742 
 743 /* in mac_bcast.c */
 744 extern void mac_bcast_init(void);
 745 extern void mac_bcast_fini(void);
 746 extern mac_impl_t *mac_bcast_grp_mip(void *);




   3  *
   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   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  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
  23  * Copyright (c) 2019, Joyent, Inc.
  24  */
  25 
  26 #ifndef _SYS_MAC_IMPL_H
  27 #define _SYS_MAC_IMPL_H
  28 
  29 #include <sys/cpupart.h>
  30 #include <sys/modhash.h>
  31 #include <sys/mac_client.h>
  32 #include <sys/mac_provider.h>
  33 #include <sys/note.h>
  34 #include <sys/avl.h>
  35 #include <net/if.h>
  36 #include <sys/mac_flow_impl.h>
  37 #include <netinet/ip6.h>
  38 
  39 #ifdef  __cplusplus
  40 extern "C" {
  41 #endif
  42 
  43 /*


 706         uint8_t                 pr_perm;
 707         uint8_t                 pr_errno;
 708         void                    *pr_default;
 709         size_t                  pr_default_size;
 710         mac_propval_range_t     *pr_range;
 711         uint_t                  pr_range_cur_count;
 712 } mac_prop_info_state_t;
 713 
 714 #define MAC_PROTECT_ENABLED(mcip, type) \
 715         (((mcip)->mci_flent-> \
 716         fe_resource_props.mrp_mask & MRP_PROTECT) != 0 && \
 717         ((mcip)->mci_flent-> \
 718         fe_resource_props.mrp_protect.mp_types & (type)) != 0)
 719 
 720 typedef struct mac_client_impl_s mac_client_impl_t;
 721 
 722 extern void     mac_init(void);
 723 extern int      mac_fini(void);
 724 
 725 extern void     mac_ndd_ioctl(mac_impl_t *, queue_t *, mblk_t *);
 726 extern int mac_ip_hdr_length_v6(ip6_t *, uint8_t *, uint16_t *,
 727     uint8_t *, ip6_frag_t **);
 728 
 729 extern mblk_t *mac_copymsgchain_cksum(mblk_t *);
 730 extern mblk_t *mac_fix_cksum(mblk_t *);
 731 extern void mac_packet_print(mac_handle_t, mblk_t *);
 732 extern void mac_rx_deliver(void *, mac_resource_handle_t, mblk_t *,
 733     mac_header_info_t *);
 734 extern void mac_tx_notify(mac_impl_t *);
 735 
 736 extern  boolean_t mac_callback_find(mac_cb_info_t *, mac_cb_t **, mac_cb_t *);
 737 extern  void    mac_callback_add(mac_cb_info_t *, mac_cb_t **, mac_cb_t *);
 738 extern  boolean_t mac_callback_remove(mac_cb_info_t *, mac_cb_t **, mac_cb_t *);
 739 extern  void    mac_callback_remove_wait(mac_cb_info_t *);
 740 extern  void    mac_callback_free(mac_cb_t *);
 741 extern  mac_cb_t *mac_callback_walker_cleanup(mac_cb_info_t *, mac_cb_t **);
 742 
 743 /* in mac_bcast.c */
 744 extern void mac_bcast_init(void);
 745 extern void mac_bcast_fini(void);
 746 extern mac_impl_t *mac_bcast_grp_mip(void *);