1f4b3ec61Sdh155122 /* 2f4b3ec61Sdh155122 * CDDL HEADER START 3f4b3ec61Sdh155122 * 4f4b3ec61Sdh155122 * The contents of this file are subject to the terms of the 5f4b3ec61Sdh155122 * Common Development and Distribution License (the "License"). 6f4b3ec61Sdh155122 * You may not use this file except in compliance with the License. 7f4b3ec61Sdh155122 * 8f4b3ec61Sdh155122 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9f4b3ec61Sdh155122 * or http://www.opensolaris.org/os/licensing. 10f4b3ec61Sdh155122 * See the License for the specific language governing permissions 11f4b3ec61Sdh155122 * and limitations under the License. 12f4b3ec61Sdh155122 * 13f4b3ec61Sdh155122 * When distributing Covered Code, include this CDDL HEADER in each 14f4b3ec61Sdh155122 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15f4b3ec61Sdh155122 * If applicable, add the following below this CDDL HEADER, with the 16f4b3ec61Sdh155122 * fields enclosed by brackets "[]" replaced with your own identifying 17f4b3ec61Sdh155122 * information: Portions Copyright [yyyy] [name of copyright owner] 18f4b3ec61Sdh155122 * 19f4b3ec61Sdh155122 * CDDL HEADER END 20f4b3ec61Sdh155122 */ 21f4b3ec61Sdh155122 22f4b3ec61Sdh155122 /* 236e91bba0SGirish Moodalbail * Copyright 2010 Sun Microsystems, Inc. All rights reserved. 24f4b3ec61Sdh155122 * Use is subject to license terms. 25f4b3ec61Sdh155122 */ 26f4b3ec61Sdh155122 2742c5ef03SDan McDonald /* 2842c5ef03SDan McDonald * Copyright 2019 Joyent, Inc. 29*221e47fbSAndy Fiddaman * Copyright 2020 OmniOS Community Edition (OmniOSce) Association. 3042c5ef03SDan McDonald */ 3142c5ef03SDan McDonald 32f4b3ec61Sdh155122 #ifndef _INET_IP_STACK_H 33f4b3ec61Sdh155122 #define _INET_IP_STACK_H 34f4b3ec61Sdh155122 35f4b3ec61Sdh155122 #ifdef __cplusplus 36f4b3ec61Sdh155122 extern "C" { 37f4b3ec61Sdh155122 #endif 38f4b3ec61Sdh155122 39f4b3ec61Sdh155122 #include <sys/netstack.h> 40f4b3ec61Sdh155122 #include <netinet/igmp_var.h> 41e11c3f44Smeem #include <sys/modhash.h> 42f4b3ec61Sdh155122 43f4b3ec61Sdh155122 #ifdef _KERNEL 44da14cebeSEric Cheng #include <sys/list.h> 45f4b3ec61Sdh155122 46bd670b35SErik Nordmark 47f4b3ec61Sdh155122 /* 48f4b3ec61Sdh155122 * IP statistics. 49f4b3ec61Sdh155122 */ 50f4b3ec61Sdh155122 #define IP_STAT(ipst, x) ((ipst)->ips_ip_statistics.x.value.ui64++) 51f4b3ec61Sdh155122 #define IP_STAT_UPDATE(ipst, x, n) \ 52f4b3ec61Sdh155122 ((ipst)->ips_ip_statistics.x.value.ui64 += (n)) 53f4b3ec61Sdh155122 54f4b3ec61Sdh155122 typedef struct ip_stat { 55f4b3ec61Sdh155122 kstat_named_t ip_udp_fannorm; 56f4b3ec61Sdh155122 kstat_named_t ip_udp_fanmb; 57bd670b35SErik Nordmark kstat_named_t ip_recv_pullup; 58f4b3ec61Sdh155122 kstat_named_t ip_db_ref; 59bd670b35SErik Nordmark kstat_named_t ip_notaligned; 60bd670b35SErik Nordmark kstat_named_t ip_multimblk; 61f4b3ec61Sdh155122 kstat_named_t ip_opt; 62f4b3ec61Sdh155122 kstat_named_t ipsec_proto_ahesp; 63f4b3ec61Sdh155122 kstat_named_t ip_conn_flputbq; 64f4b3ec61Sdh155122 kstat_named_t ip_conn_walk_drain; 65f4b3ec61Sdh155122 kstat_named_t ip_out_sw_cksum; 66bd670b35SErik Nordmark kstat_named_t ip_out_sw_cksum_bytes; 67f4b3ec61Sdh155122 kstat_named_t ip_in_sw_cksum; 68bd670b35SErik Nordmark kstat_named_t ip_ire_reclaim_calls; 69bd670b35SErik Nordmark kstat_named_t ip_ire_reclaim_deleted; 70bd670b35SErik Nordmark kstat_named_t ip_nce_reclaim_calls; 71bd670b35SErik Nordmark kstat_named_t ip_nce_reclaim_deleted; 7242c5ef03SDan McDonald kstat_named_t ip_nce_mcast_reclaim_calls; 7342c5ef03SDan McDonald kstat_named_t ip_nce_mcast_reclaim_deleted; 7442c5ef03SDan McDonald kstat_named_t ip_nce_mcast_reclaim_tqfail; 75bd670b35SErik Nordmark kstat_named_t ip_dce_reclaim_calls; 76bd670b35SErik Nordmark kstat_named_t ip_dce_reclaim_deleted; 77f4b3ec61Sdh155122 kstat_named_t ip_tcp_in_full_hw_cksum_err; 78f4b3ec61Sdh155122 kstat_named_t ip_tcp_in_part_hw_cksum_err; 79f4b3ec61Sdh155122 kstat_named_t ip_tcp_in_sw_cksum_err; 80f4b3ec61Sdh155122 kstat_named_t ip_udp_in_full_hw_cksum_err; 81f4b3ec61Sdh155122 kstat_named_t ip_udp_in_part_hw_cksum_err; 82f4b3ec61Sdh155122 kstat_named_t ip_udp_in_sw_cksum_err; 83bd670b35SErik Nordmark kstat_named_t conn_in_recvdstaddr; 84bd670b35SErik Nordmark kstat_named_t conn_in_recvopts; 85bd670b35SErik Nordmark kstat_named_t conn_in_recvif; 86bd670b35SErik Nordmark kstat_named_t conn_in_recvslla; 87bd670b35SErik Nordmark kstat_named_t conn_in_recvucred; 88bd670b35SErik Nordmark kstat_named_t conn_in_recvttl; 89*221e47fbSAndy Fiddaman kstat_named_t conn_in_recvtos; 90bd670b35SErik Nordmark kstat_named_t conn_in_recvhopopts; 91bd670b35SErik Nordmark kstat_named_t conn_in_recvhoplimit; 92bd670b35SErik Nordmark kstat_named_t conn_in_recvdstopts; 93bd670b35SErik Nordmark kstat_named_t conn_in_recvrthdrdstopts; 94bd670b35SErik Nordmark kstat_named_t conn_in_recvrthdr; 95bd670b35SErik Nordmark kstat_named_t conn_in_recvpktinfo; 96bd670b35SErik Nordmark kstat_named_t conn_in_recvtclass; 97bd670b35SErik Nordmark kstat_named_t conn_in_timestamp; 98f4b3ec61Sdh155122 } ip_stat_t; 99f4b3ec61Sdh155122 100f4b3ec61Sdh155122 101f4b3ec61Sdh155122 /* 102f4b3ec61Sdh155122 * IP6 statistics. 103f4b3ec61Sdh155122 */ 104f4b3ec61Sdh155122 #define IP6_STAT(ipst, x) ((ipst)->ips_ip6_statistics.x.value.ui64++) 105f4b3ec61Sdh155122 #define IP6_STAT_UPDATE(ipst, x, n) \ 106f4b3ec61Sdh155122 ((ipst)->ips_ip6_statistics.x.value.ui64 += (n)) 107f4b3ec61Sdh155122 108f4b3ec61Sdh155122 typedef struct ip6_stat { 109f4b3ec61Sdh155122 kstat_named_t ip6_udp_fannorm; 110f4b3ec61Sdh155122 kstat_named_t ip6_udp_fanmb; 111bd670b35SErik Nordmark kstat_named_t ip6_recv_pullup; 112bd670b35SErik Nordmark kstat_named_t ip6_db_ref; 113bd670b35SErik Nordmark kstat_named_t ip6_notaligned; 114bd670b35SErik Nordmark kstat_named_t ip6_multimblk; 115bd670b35SErik Nordmark kstat_named_t ipsec_proto_ahesp; 116f4b3ec61Sdh155122 kstat_named_t ip6_out_sw_cksum; 117bd670b35SErik Nordmark kstat_named_t ip6_out_sw_cksum_bytes; 118f4b3ec61Sdh155122 kstat_named_t ip6_in_sw_cksum; 119f4b3ec61Sdh155122 kstat_named_t ip6_tcp_in_full_hw_cksum_err; 120f4b3ec61Sdh155122 kstat_named_t ip6_tcp_in_part_hw_cksum_err; 121f4b3ec61Sdh155122 kstat_named_t ip6_tcp_in_sw_cksum_err; 122f4b3ec61Sdh155122 kstat_named_t ip6_udp_in_full_hw_cksum_err; 123f4b3ec61Sdh155122 kstat_named_t ip6_udp_in_part_hw_cksum_err; 124f4b3ec61Sdh155122 kstat_named_t ip6_udp_in_sw_cksum_err; 125f4b3ec61Sdh155122 } ip6_stat_t; 126f4b3ec61Sdh155122 127f4b3ec61Sdh155122 typedef struct ire_stats { 128f4b3ec61Sdh155122 uint64_t ire_stats_alloced; /* # of ires alloced */ 129f4b3ec61Sdh155122 uint64_t ire_stats_freed; /* # of ires freed */ 130f4b3ec61Sdh155122 uint64_t ire_stats_inserted; /* # of ires inserted in the bucket */ 131f4b3ec61Sdh155122 uint64_t ire_stats_deleted; /* # of ires deleted from the bucket */ 132f4b3ec61Sdh155122 } ire_stats_t; 133f4b3ec61Sdh155122 134ae6aa22aSVenugopal Iyer #define TX_FANOUT_SIZE 128 135ae6aa22aSVenugopal Iyer #define IDLHASHINDEX(X) \ 136ae6aa22aSVenugopal Iyer ((((uintptr_t)(X) >> 2) + ((uintptr_t)(X) >> 9)) & (TX_FANOUT_SIZE - 1)) 137f4b3ec61Sdh155122 138d5b6ed4bSVasumathi Sundaram - Sun Microsystems /* Data structure to represent addresses */ 139d5b6ed4bSVasumathi Sundaram - Sun Microsystems typedef struct srcid_map { 140d5b6ed4bSVasumathi Sundaram - Sun Microsystems struct srcid_map *sm_next; 141d5b6ed4bSVasumathi Sundaram - Sun Microsystems in6_addr_t sm_addr; /* Local address */ 142d5b6ed4bSVasumathi Sundaram - Sun Microsystems uint_t sm_srcid; /* source id */ 143d5b6ed4bSVasumathi Sundaram - Sun Microsystems uint_t sm_refcnt; /* > 1 ipif with same addr? */ 144d5b6ed4bSVasumathi Sundaram - Sun Microsystems zoneid_t sm_zoneid; /* zone id */ 145d5b6ed4bSVasumathi Sundaram - Sun Microsystems } srcid_map_t; 146d5b6ed4bSVasumathi Sundaram - Sun Microsystems 147f4b3ec61Sdh155122 /* 148f4b3ec61Sdh155122 * IP stack instances 149f4b3ec61Sdh155122 */ 150f4b3ec61Sdh155122 struct ip_stack { 151f4b3ec61Sdh155122 netstack_t *ips_netstack; /* Common netstack */ 152f4b3ec61Sdh155122 153bd670b35SErik Nordmark uint_t ips_src_generation; /* Both IPv4 and IPv6 */ 154bd670b35SErik Nordmark 1556e91bba0SGirish Moodalbail struct mod_prop_info_s *ips_propinfo_tbl; /* ip tunables table */ 156f4b3ec61Sdh155122 157f4b3ec61Sdh155122 mib2_ipIfStatsEntry_t ips_ip_mib; /* SNMP fixed size info */ 158f4b3ec61Sdh155122 mib2_icmp_t ips_icmp_mib; 159f4b3ec61Sdh155122 /* 160f4b3ec61Sdh155122 * IPv6 mibs when the interface (ill) is not known. 161f4b3ec61Sdh155122 * When the ill is known the per-interface mib in the ill is used. 162f4b3ec61Sdh155122 */ 163f4b3ec61Sdh155122 mib2_ipIfStatsEntry_t ips_ip6_mib; 164f4b3ec61Sdh155122 mib2_ipv6IfIcmpEntry_t ips_icmp6_mib; 165f4b3ec61Sdh155122 166f4b3ec61Sdh155122 struct igmpstat ips_igmpstat; 167f4b3ec61Sdh155122 168f4b3ec61Sdh155122 kstat_t *ips_ip_mibkp; /* kstat exporting ip_mib data */ 169f4b3ec61Sdh155122 kstat_t *ips_icmp_mibkp; /* kstat exporting icmp_mib data */ 170f4b3ec61Sdh155122 kstat_t *ips_ip_kstat; 171f4b3ec61Sdh155122 ip_stat_t ips_ip_statistics; 172f4b3ec61Sdh155122 kstat_t *ips_ip6_kstat; 173f4b3ec61Sdh155122 ip6_stat_t ips_ip6_statistics; 174f4b3ec61Sdh155122 175f4b3ec61Sdh155122 /* ip.c */ 176f4b3ec61Sdh155122 kmutex_t ips_igmp_timer_lock; 177f4b3ec61Sdh155122 kmutex_t ips_mld_timer_lock; 178f4b3ec61Sdh155122 kmutex_t ips_ip_mi_lock; 179f4b3ec61Sdh155122 kmutex_t ips_ip_addr_avail_lock; 180f4b3ec61Sdh155122 krwlock_t ips_ill_g_lock; 181f4b3ec61Sdh155122 182f4b3ec61Sdh155122 krwlock_t ips_ill_g_usesrc_lock; 183f4b3ec61Sdh155122 184da14cebeSEric Cheng /* Taskq dispatcher for capability operations */ 185da14cebeSEric Cheng kmutex_t ips_capab_taskq_lock; 186da14cebeSEric Cheng kcondvar_t ips_capab_taskq_cv; 1874cc34124SThirumalai Srinivasan mblk_t *ips_capab_taskq_head; 1884cc34124SThirumalai Srinivasan mblk_t *ips_capab_taskq_tail; 189da14cebeSEric Cheng kthread_t *ips_capab_taskq_thread; 190da14cebeSEric Cheng boolean_t ips_capab_taskq_quit; 191da14cebeSEric Cheng 192f4b3ec61Sdh155122 /* ipclassifier.c - keep in ip_stack_t */ 193f4b3ec61Sdh155122 /* ipclassifier hash tables */ 194f4b3ec61Sdh155122 struct connf_s *ips_rts_clients; 195f4b3ec61Sdh155122 struct connf_s *ips_ipcl_conn_fanout; 196f4b3ec61Sdh155122 struct connf_s *ips_ipcl_bind_fanout; 197bd670b35SErik Nordmark struct connf_s *ips_ipcl_proto_fanout_v4; 198f4b3ec61Sdh155122 struct connf_s *ips_ipcl_proto_fanout_v6; 199f4b3ec61Sdh155122 struct connf_s *ips_ipcl_udp_fanout; 200bd670b35SErik Nordmark struct connf_s *ips_ipcl_raw_fanout; /* RAW SCTP sockets */ 2012b24ab6bSSebastien Roy struct connf_s *ips_ipcl_iptun_fanout; 202f4b3ec61Sdh155122 uint_t ips_ipcl_conn_fanout_size; 203f4b3ec61Sdh155122 uint_t ips_ipcl_bind_fanout_size; 204f4b3ec61Sdh155122 uint_t ips_ipcl_udp_fanout_size; 205f4b3ec61Sdh155122 uint_t ips_ipcl_raw_fanout_size; 2062b24ab6bSSebastien Roy uint_t ips_ipcl_iptun_fanout_size; 207f4b3ec61Sdh155122 struct connf_s *ips_ipcl_globalhash_fanout; 208f4b3ec61Sdh155122 int ips_conn_g_index; 209f4b3ec61Sdh155122 210f4b3ec61Sdh155122 /* ip.c */ 211328c7d1fSmeem /* Following protected by igmp_timer_lock */ 212f4b3ec61Sdh155122 int ips_igmp_time_to_next; /* Time since last timeout */ 2138dc47d9fSudpa int ips_igmp_timer_scheduled_last; 214f4b3ec61Sdh155122 int ips_igmp_deferred_next; 215f4b3ec61Sdh155122 timeout_id_t ips_igmp_timeout_id; 216f4b3ec61Sdh155122 boolean_t ips_igmp_timer_setter_active; 217f5db8fb0SRobert Mustacchi boolean_t ips_igmp_timer_quiesce; 218f4b3ec61Sdh155122 219f4b3ec61Sdh155122 /* Following protected by mld_timer_lock */ 220f4b3ec61Sdh155122 int ips_mld_time_to_next; /* Time since last timeout */ 2218dc47d9fSudpa int ips_mld_timer_scheduled_last; 222f4b3ec61Sdh155122 int ips_mld_deferred_next; 223f4b3ec61Sdh155122 timeout_id_t ips_mld_timeout_id; 224f4b3ec61Sdh155122 boolean_t ips_mld_timer_setter_active; 225f5db8fb0SRobert Mustacchi boolean_t ips_mld_timer_quiesce; 226f4b3ec61Sdh155122 227f4b3ec61Sdh155122 /* Protected by igmp_slowtimeout_lock */ 228f4b3ec61Sdh155122 timeout_id_t ips_igmp_slowtimeout_id; 229f4b3ec61Sdh155122 kmutex_t ips_igmp_slowtimeout_lock; 230f5db8fb0SRobert Mustacchi boolean_t ips_igmp_slowtimeout_quiesce; 231f4b3ec61Sdh155122 232f4b3ec61Sdh155122 /* Protected by mld_slowtimeout_lock */ 233f4b3ec61Sdh155122 timeout_id_t ips_mld_slowtimeout_id; 234f4b3ec61Sdh155122 kmutex_t ips_mld_slowtimeout_lock; 235f5db8fb0SRobert Mustacchi boolean_t ips_mld_slowtimeout_quiesce; 236f4b3ec61Sdh155122 237f4b3ec61Sdh155122 /* IPv4 forwarding table */ 238f4b3ec61Sdh155122 struct radix_node_head *ips_ip_ftable; 239f4b3ec61Sdh155122 240f4b3ec61Sdh155122 #define IPV6_ABITS 128 241f4b3ec61Sdh155122 #define IP6_MASK_TABLE_SIZE (IPV6_ABITS + 1) /* 129 ptrs */ 242f4b3ec61Sdh155122 struct irb *ips_ip_forwarding_table_v6[IP6_MASK_TABLE_SIZE]; 243f4b3ec61Sdh155122 244f4b3ec61Sdh155122 /* 245f4b3ec61Sdh155122 * ire_ft_init_lock is used while initializing ip_forwarding_table 246f4b3ec61Sdh155122 * dynamically in ire_add. 247f4b3ec61Sdh155122 */ 248f4b3ec61Sdh155122 kmutex_t ips_ire_ft_init_lock; 249f4b3ec61Sdh155122 250bd670b35SErik Nordmark /* 251bd670b35SErik Nordmark * This is the IPv6 counterpart of RADIX_NODE_HEAD_LOCK. It is used 252bd670b35SErik Nordmark * to prevent adds and deletes while we are doing a ftable_lookup 253bd670b35SErik Nordmark * and extracting the ire_generation. 254bd670b35SErik Nordmark */ 255bd670b35SErik Nordmark krwlock_t ips_ip6_ire_head_lock; 256bd670b35SErik Nordmark 257f4b3ec61Sdh155122 uint32_t ips_ip6_ftable_hash_size; 258f4b3ec61Sdh155122 259f4b3ec61Sdh155122 ire_stats_t ips_ire_stats_v4; /* IPv4 ire statistics */ 260f4b3ec61Sdh155122 ire_stats_t ips_ire_stats_v6; /* IPv6 ire statistics */ 261f4b3ec61Sdh155122 262bd670b35SErik Nordmark /* Count how many condemned objects for kmem_cache callbacks */ 263bd670b35SErik Nordmark uint32_t ips_num_ire_condemned; 264bd670b35SErik Nordmark uint32_t ips_num_nce_condemned; 265bd670b35SErik Nordmark uint32_t ips_num_dce_condemned; 266bd670b35SErik Nordmark 267bd670b35SErik Nordmark struct ire_s *ips_ire_reject_v4; /* For unreachable dests */ 268bd670b35SErik Nordmark struct ire_s *ips_ire_reject_v6; /* For unreachable dests */ 269bd670b35SErik Nordmark struct ire_s *ips_ire_blackhole_v4; /* For temporary failures */ 270bd670b35SErik Nordmark struct ire_s *ips_ire_blackhole_v6; /* For temporary failures */ 271bd670b35SErik Nordmark 272bd670b35SErik Nordmark /* ips_ire_dep_lock protects ire_dep_* relationship between IREs */ 273bd670b35SErik Nordmark krwlock_t ips_ire_dep_lock; 274bd670b35SErik Nordmark 275bd670b35SErik Nordmark /* Destination Cache Entries */ 276bd670b35SErik Nordmark struct dce_s *ips_dce_default; 277bd670b35SErik Nordmark uint_t ips_dce_hashsize; 278bd670b35SErik Nordmark struct dcb_s *ips_dce_hash_v4; 279bd670b35SErik Nordmark struct dcb_s *ips_dce_hash_v6; 2807c6d7024SJerry Jelinek uint_t ips_dce_reclaim_needed; 281bd670b35SErik Nordmark 282f4b3ec61Sdh155122 /* pending binds */ 283f4b3ec61Sdh155122 mblk_t *ips_ip6_asp_pending_ops; 284f4b3ec61Sdh155122 mblk_t *ips_ip6_asp_pending_ops_tail; 285f4b3ec61Sdh155122 286f4b3ec61Sdh155122 /* Synchronize updates with table usage */ 287f4b3ec61Sdh155122 mblk_t *ips_ip6_asp_pending_update; /* pending table updates */ 288f4b3ec61Sdh155122 289f4b3ec61Sdh155122 boolean_t ips_ip6_asp_uip; /* table update in progress */ 290f4b3ec61Sdh155122 kmutex_t ips_ip6_asp_lock; /* protect all the above */ 291f4b3ec61Sdh155122 uint32_t ips_ip6_asp_refcnt; /* outstanding references */ 292f4b3ec61Sdh155122 293f4b3ec61Sdh155122 struct ip6_asp *ips_ip6_asp_table; 294f4b3ec61Sdh155122 /* The number of policy entries in the table */ 295f4b3ec61Sdh155122 uint_t ips_ip6_asp_table_count; 296f4b3ec61Sdh155122 297fc80c0dfSnordmark struct conn_s *ips_ip_g_mrouter; 298f4b3ec61Sdh155122 299f4b3ec61Sdh155122 /* Time since last icmp_pkt_err */ 300f4b3ec61Sdh155122 clock_t ips_icmp_pkt_err_last; 301f4b3ec61Sdh155122 /* Number of packets sent in burst */ 302f4b3ec61Sdh155122 uint_t ips_icmp_pkt_err_sent; 303f4b3ec61Sdh155122 304f4b3ec61Sdh155122 /* Protected by ip_mi_lock */ 305bd670b35SErik Nordmark void *ips_ip_g_head; /* IP Instance Data List Head */ 306bd670b35SErik Nordmark void *ips_arp_g_head; /* ARP Instance Data List Head */ 307f4b3ec61Sdh155122 308f4b3ec61Sdh155122 /* Multirouting stuff */ 309f4b3ec61Sdh155122 /* Interval (in ms) between consecutive 'bad MTU' warnings */ 310f4b3ec61Sdh155122 hrtime_t ips_ip_multirt_log_interval; 311f4b3ec61Sdh155122 /* Time since last warning issued. */ 312f4b3ec61Sdh155122 hrtime_t ips_multirt_bad_mtu_last_time; 313f4b3ec61Sdh155122 3146e91bba0SGirish Moodalbail /* 3156e91bba0SGirish Moodalbail * CGTP hooks. Enabling and disabling of hooks is controlled by an 3166e91bba0SGirish Moodalbail * IP tunable 'ips_ip_cgtp_filter'. 3176e91bba0SGirish Moodalbail */ 3186e91bba0SGirish Moodalbail struct cgtp_filter_ops *ips_ip_cgtp_filter_ops; 319655a42e2Snordmark 320f4b3ec61Sdh155122 struct ipsq_s *ips_ipsq_g_head; 321f4b3ec61Sdh155122 uint_t ips_ill_index; /* Used to assign interface indicies */ 322f4b3ec61Sdh155122 /* When set search for unused index */ 323f4b3ec61Sdh155122 boolean_t ips_ill_index_wrap; 324f4b3ec61Sdh155122 325f4b3ec61Sdh155122 uint_t ips_loopback_packets; 326f4b3ec61Sdh155122 327f4b3ec61Sdh155122 /* NDP/NCE structures for IPv4 and IPv6 */ 328f4b3ec61Sdh155122 struct ndp_g_s *ips_ndp4; 329f4b3ec61Sdh155122 struct ndp_g_s *ips_ndp6; 330f4b3ec61Sdh155122 331f4b3ec61Sdh155122 /* ip_mroute stuff */ 332f4b3ec61Sdh155122 kmutex_t ips_ip_g_mrouter_mutex; 333f4b3ec61Sdh155122 334f4b3ec61Sdh155122 struct mrtstat *ips_mrtstat; /* Stats for netstat */ 3356e91bba0SGirish Moodalbail int ips_saved_ip_forwarding; 336f4b3ec61Sdh155122 337f4b3ec61Sdh155122 /* numvifs is only a hint about the max interface being used. */ 338f4b3ec61Sdh155122 ushort_t ips_numvifs; 339f4b3ec61Sdh155122 kmutex_t ips_numvifs_mutex; 340f4b3ec61Sdh155122 341f4b3ec61Sdh155122 struct vif *ips_vifs; 342f4b3ec61Sdh155122 struct mfcb *ips_mfcs; /* kernel routing table */ 343f4b3ec61Sdh155122 struct tbf *ips_tbfs; 344f4b3ec61Sdh155122 /* 345f4b3ec61Sdh155122 * One-back cache used to locate a tunnel's vif, 346f4b3ec61Sdh155122 * given a datagram's src ip address. 347f4b3ec61Sdh155122 */ 348f4b3ec61Sdh155122 ipaddr_t ips_last_encap_src; 349f4b3ec61Sdh155122 struct vif *ips_last_encap_vif; 350f4b3ec61Sdh155122 kmutex_t ips_last_encap_lock; /* Protects the above */ 351f4b3ec61Sdh155122 352f4b3ec61Sdh155122 /* 353f4b3ec61Sdh155122 * reg_vif_num is protected by numvifs_mutex 354f4b3ec61Sdh155122 */ 355f4b3ec61Sdh155122 /* Whether or not special PIM assert processing is enabled. */ 356f4b3ec61Sdh155122 ushort_t ips_reg_vif_num; /* Index to Register vif */ 357f4b3ec61Sdh155122 int ips_pim_assert; 358f4b3ec61Sdh155122 359f4b3ec61Sdh155122 union ill_g_head_u *ips_ill_g_heads; /* ILL List Head */ 360f4b3ec61Sdh155122 361f4b3ec61Sdh155122 kstat_t *ips_loopback_ksp; 362f4b3ec61Sdh155122 363ae6aa22aSVenugopal Iyer /* Array of conn drain lists */ 364ae6aa22aSVenugopal Iyer struct idl_tx_list_s *ips_idl_tx_list; 365f4b3ec61Sdh155122 uint_t ips_conn_drain_list_cnt; /* Count of conn_drain_list */ 366f4b3ec61Sdh155122 367f4b3ec61Sdh155122 /* 368f4b3ec61Sdh155122 * ID used to assign next free one. 369f4b3ec61Sdh155122 * Increases by one. Once it wraps we search for an unused ID. 370f4b3ec61Sdh155122 */ 371f4b3ec61Sdh155122 uint_t ips_ip_src_id; 372f4b3ec61Sdh155122 boolean_t ips_srcid_wrapped; 373f4b3ec61Sdh155122 374f4b3ec61Sdh155122 struct srcid_map *ips_srcid_head; 375f4b3ec61Sdh155122 krwlock_t ips_srcid_lock; 376f4b3ec61Sdh155122 377bd670b35SErik Nordmark uint64_t ips_ipif_g_seqid; /* Used only for sctp_addr.c */ 378f4b3ec61Sdh155122 union phyint_list_u *ips_phyint_g_list; /* start of phyint list */ 379f4b3ec61Sdh155122 380bd670b35SErik Nordmark /* ip_netinfo.c */ 381f4b3ec61Sdh155122 hook_family_t ips_ipv4root; 382f4b3ec61Sdh155122 hook_family_t ips_ipv6root; 383bd670b35SErik Nordmark hook_family_t ips_arproot; 384f4b3ec61Sdh155122 3850a0e9771SDarren Reed net_handle_t ips_ipv4_net_data; 3860a0e9771SDarren Reed net_handle_t ips_ipv6_net_data; 387bd670b35SErik Nordmark net_handle_t ips_arp_net_data; 3880a0e9771SDarren Reed 389f4b3ec61Sdh155122 /* 390f4b3ec61Sdh155122 * Hooks for firewalling 391f4b3ec61Sdh155122 */ 392f4b3ec61Sdh155122 hook_event_t ips_ip4_physical_in_event; 393f4b3ec61Sdh155122 hook_event_t ips_ip4_physical_out_event; 394f4b3ec61Sdh155122 hook_event_t ips_ip4_forwarding_event; 395f4b3ec61Sdh155122 hook_event_t ips_ip4_loopback_in_event; 396f4b3ec61Sdh155122 hook_event_t ips_ip4_loopback_out_event; 397bd670b35SErik Nordmark 398f4b3ec61Sdh155122 hook_event_t ips_ip6_physical_in_event; 399f4b3ec61Sdh155122 hook_event_t ips_ip6_physical_out_event; 400f4b3ec61Sdh155122 hook_event_t ips_ip6_forwarding_event; 401f4b3ec61Sdh155122 hook_event_t ips_ip6_loopback_in_event; 402f4b3ec61Sdh155122 hook_event_t ips_ip6_loopback_out_event; 403f4b3ec61Sdh155122 404bd670b35SErik Nordmark hook_event_t ips_arp_physical_in_event; 405bd670b35SErik Nordmark hook_event_t ips_arp_physical_out_event; 406bd670b35SErik Nordmark hook_event_t ips_arp_nic_events; 407bd670b35SErik Nordmark 408f4b3ec61Sdh155122 hook_event_token_t ips_ipv4firewall_physical_in; 409f4b3ec61Sdh155122 hook_event_token_t ips_ipv4firewall_physical_out; 410f4b3ec61Sdh155122 hook_event_token_t ips_ipv4firewall_forwarding; 411f4b3ec61Sdh155122 hook_event_token_t ips_ipv4firewall_loopback_in; 412f4b3ec61Sdh155122 hook_event_token_t ips_ipv4firewall_loopback_out; 413bd670b35SErik Nordmark 414f4b3ec61Sdh155122 hook_event_token_t ips_ipv6firewall_physical_in; 415f4b3ec61Sdh155122 hook_event_token_t ips_ipv6firewall_physical_out; 416f4b3ec61Sdh155122 hook_event_token_t ips_ipv6firewall_forwarding; 417f4b3ec61Sdh155122 hook_event_token_t ips_ipv6firewall_loopback_in; 418f4b3ec61Sdh155122 hook_event_token_t ips_ipv6firewall_loopback_out; 4190a0e9771SDarren Reed 4200a0e9771SDarren Reed hook_event_t ips_ip4_nic_events; 4210a0e9771SDarren Reed hook_event_t ips_ip6_nic_events; 4220a0e9771SDarren Reed hook_event_token_t ips_ipv4nicevents; 423f4b3ec61Sdh155122 hook_event_token_t ips_ipv6nicevents; 424f4b3ec61Sdh155122 425bd670b35SErik Nordmark hook_event_token_t ips_arp_physical_in; 426bd670b35SErik Nordmark hook_event_token_t ips_arp_physical_out; 427bd670b35SErik Nordmark hook_event_token_t ips_arpnicevents; 428bd670b35SErik Nordmark 4290a0e9771SDarren Reed net_handle_t ips_ip4_observe_pr; 4300a0e9771SDarren Reed net_handle_t ips_ip6_observe_pr; 4310a0e9771SDarren Reed hook_event_t ips_ip4_observe; 4320a0e9771SDarren Reed hook_event_t ips_ip6_observe; 4330a0e9771SDarren Reed hook_event_token_t ips_ipv4observing; 4340a0e9771SDarren Reed hook_event_token_t ips_ipv6observing; 4350f1702c5SYu Xiangning 4360f1702c5SYu Xiangning struct __ldi_ident *ips_ldi_ident; 437e11c3f44Smeem 438e11c3f44Smeem /* ipmp.c */ 439e11c3f44Smeem krwlock_t ips_ipmp_lock; 440e11c3f44Smeem mod_hash_t *ips_ipmp_grp_hash; 441e11c3f44Smeem 442f4b3ec61Sdh155122 }; 443f4b3ec61Sdh155122 typedef struct ip_stack ip_stack_t; 444f4b3ec61Sdh155122 445f4b3ec61Sdh155122 /* Finding an ip_stack_t */ 446f4b3ec61Sdh155122 #define CONNQ_TO_IPST(_q) (Q_TO_CONN(_q)->conn_netstack->netstack_ip) 447f4b3ec61Sdh155122 #define ILLQ_TO_IPST(_q) (((ill_t *)(_q)->q_ptr)->ill_ipst) 448e11c3f44Smeem #define PHYINT_TO_IPST(phyi) ((phyi)->phyint_ipsq->ipsq_ipst) 449f4b3ec61Sdh155122 450f4b3ec61Sdh155122 #else /* _KERNEL */ 451f4b3ec61Sdh155122 typedef int ip_stack_t; 452f4b3ec61Sdh155122 #endif /* _KERNEL */ 453f4b3ec61Sdh155122 454f4b3ec61Sdh155122 #ifdef __cplusplus 455f4b3ec61Sdh155122 } 456f4b3ec61Sdh155122 #endif 457f4b3ec61Sdh155122 458f4b3ec61Sdh155122 #endif /* _INET_IP_STACK_H */ 459