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 /* 23*e11c3f44Smeem * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 24f4b3ec61Sdh155122 * Use is subject to license terms. 25f4b3ec61Sdh155122 */ 26f4b3ec61Sdh155122 27f4b3ec61Sdh155122 #ifndef _INET_IP_STACK_H 28f4b3ec61Sdh155122 #define _INET_IP_STACK_H 29f4b3ec61Sdh155122 30f4b3ec61Sdh155122 #ifdef __cplusplus 31f4b3ec61Sdh155122 extern "C" { 32f4b3ec61Sdh155122 #endif 33f4b3ec61Sdh155122 34f4b3ec61Sdh155122 #include <sys/netstack.h> 35f4b3ec61Sdh155122 #include <netinet/igmp_var.h> 36*e11c3f44Smeem #include <sys/modhash.h> 37f4b3ec61Sdh155122 38f4b3ec61Sdh155122 #ifdef _KERNEL 39da14cebeSEric Cheng #include <sys/list.h> 40f4b3ec61Sdh155122 41f4b3ec61Sdh155122 /* 42f4b3ec61Sdh155122 * IP statistics. 43f4b3ec61Sdh155122 */ 44f4b3ec61Sdh155122 #define IP_STAT(ipst, x) ((ipst)->ips_ip_statistics.x.value.ui64++) 45f4b3ec61Sdh155122 #define IP_STAT_UPDATE(ipst, x, n) \ 46f4b3ec61Sdh155122 ((ipst)->ips_ip_statistics.x.value.ui64 += (n)) 47f4b3ec61Sdh155122 48f4b3ec61Sdh155122 typedef struct ip_stat { 49f4b3ec61Sdh155122 kstat_named_t ipsec_fanout_proto; 50f4b3ec61Sdh155122 kstat_named_t ip_udp_fannorm; 51f4b3ec61Sdh155122 kstat_named_t ip_udp_fanmb; 52f4b3ec61Sdh155122 kstat_named_t ip_udp_fanothers; 53f4b3ec61Sdh155122 kstat_named_t ip_udp_fast_path; 54f4b3ec61Sdh155122 kstat_named_t ip_udp_slow_path; 55f4b3ec61Sdh155122 kstat_named_t ip_udp_input_err; 56f4b3ec61Sdh155122 kstat_named_t ip_tcppullup; 57f4b3ec61Sdh155122 kstat_named_t ip_tcpoptions; 58f4b3ec61Sdh155122 kstat_named_t ip_multipkttcp; 59f4b3ec61Sdh155122 kstat_named_t ip_tcp_fast_path; 60f4b3ec61Sdh155122 kstat_named_t ip_tcp_slow_path; 61f4b3ec61Sdh155122 kstat_named_t ip_tcp_input_error; 62f4b3ec61Sdh155122 kstat_named_t ip_db_ref; 63f4b3ec61Sdh155122 kstat_named_t ip_notaligned1; 64f4b3ec61Sdh155122 kstat_named_t ip_notaligned2; 65f4b3ec61Sdh155122 kstat_named_t ip_multimblk3; 66f4b3ec61Sdh155122 kstat_named_t ip_multimblk4; 67f4b3ec61Sdh155122 kstat_named_t ip_ipoptions; 68f4b3ec61Sdh155122 kstat_named_t ip_classify_fail; 69f4b3ec61Sdh155122 kstat_named_t ip_opt; 70f4b3ec61Sdh155122 kstat_named_t ip_udp_rput_local; 71f4b3ec61Sdh155122 kstat_named_t ipsec_proto_ahesp; 72f4b3ec61Sdh155122 kstat_named_t ip_conn_flputbq; 73f4b3ec61Sdh155122 kstat_named_t ip_conn_walk_drain; 74f4b3ec61Sdh155122 kstat_named_t ip_out_sw_cksum; 75f4b3ec61Sdh155122 kstat_named_t ip_in_sw_cksum; 76f4b3ec61Sdh155122 kstat_named_t ip_trash_ire_reclaim_calls; 77f4b3ec61Sdh155122 kstat_named_t ip_trash_ire_reclaim_success; 78f4b3ec61Sdh155122 kstat_named_t ip_ire_arp_timer_expired; 79f4b3ec61Sdh155122 kstat_named_t ip_ire_redirect_timer_expired; 80f4b3ec61Sdh155122 kstat_named_t ip_ire_pmtu_timer_expired; 81f4b3ec61Sdh155122 kstat_named_t ip_input_multi_squeue; 82f4b3ec61Sdh155122 kstat_named_t ip_tcp_in_full_hw_cksum_err; 83f4b3ec61Sdh155122 kstat_named_t ip_tcp_in_part_hw_cksum_err; 84f4b3ec61Sdh155122 kstat_named_t ip_tcp_in_sw_cksum_err; 85f4b3ec61Sdh155122 kstat_named_t ip_tcp_out_sw_cksum_bytes; 86f4b3ec61Sdh155122 kstat_named_t ip_udp_in_full_hw_cksum_err; 87f4b3ec61Sdh155122 kstat_named_t ip_udp_in_part_hw_cksum_err; 88f4b3ec61Sdh155122 kstat_named_t ip_udp_in_sw_cksum_err; 89f4b3ec61Sdh155122 kstat_named_t ip_udp_out_sw_cksum_bytes; 90f4b3ec61Sdh155122 kstat_named_t ip_frag_mdt_pkt_out; 91f4b3ec61Sdh155122 kstat_named_t ip_frag_mdt_discarded; 92f4b3ec61Sdh155122 kstat_named_t ip_frag_mdt_allocfail; 93f4b3ec61Sdh155122 kstat_named_t ip_frag_mdt_addpdescfail; 94f4b3ec61Sdh155122 kstat_named_t ip_frag_mdt_allocd; 95f4b3ec61Sdh155122 } ip_stat_t; 96f4b3ec61Sdh155122 97f4b3ec61Sdh155122 98f4b3ec61Sdh155122 /* 99f4b3ec61Sdh155122 * IP6 statistics. 100f4b3ec61Sdh155122 */ 101f4b3ec61Sdh155122 #define IP6_STAT(ipst, x) ((ipst)->ips_ip6_statistics.x.value.ui64++) 102f4b3ec61Sdh155122 #define IP6_STAT_UPDATE(ipst, x, n) \ 103f4b3ec61Sdh155122 ((ipst)->ips_ip6_statistics.x.value.ui64 += (n)) 104f4b3ec61Sdh155122 105f4b3ec61Sdh155122 typedef struct ip6_stat { 106f4b3ec61Sdh155122 kstat_named_t ip6_udp_fast_path; 107f4b3ec61Sdh155122 kstat_named_t ip6_udp_slow_path; 108f4b3ec61Sdh155122 kstat_named_t ip6_udp_fannorm; 109f4b3ec61Sdh155122 kstat_named_t ip6_udp_fanmb; 110f4b3ec61Sdh155122 kstat_named_t ip6_out_sw_cksum; 111f4b3ec61Sdh155122 kstat_named_t ip6_in_sw_cksum; 112f4b3ec61Sdh155122 kstat_named_t ip6_tcp_in_full_hw_cksum_err; 113f4b3ec61Sdh155122 kstat_named_t ip6_tcp_in_part_hw_cksum_err; 114f4b3ec61Sdh155122 kstat_named_t ip6_tcp_in_sw_cksum_err; 115f4b3ec61Sdh155122 kstat_named_t ip6_tcp_out_sw_cksum_bytes; 116f4b3ec61Sdh155122 kstat_named_t ip6_udp_in_full_hw_cksum_err; 117f4b3ec61Sdh155122 kstat_named_t ip6_udp_in_part_hw_cksum_err; 118f4b3ec61Sdh155122 kstat_named_t ip6_udp_in_sw_cksum_err; 119f4b3ec61Sdh155122 kstat_named_t ip6_udp_out_sw_cksum_bytes; 120f4b3ec61Sdh155122 kstat_named_t ip6_frag_mdt_pkt_out; 121f4b3ec61Sdh155122 kstat_named_t ip6_frag_mdt_discarded; 122f4b3ec61Sdh155122 kstat_named_t ip6_frag_mdt_allocfail; 123f4b3ec61Sdh155122 kstat_named_t ip6_frag_mdt_addpdescfail; 124f4b3ec61Sdh155122 kstat_named_t ip6_frag_mdt_allocd; 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 134f4b3ec61Sdh155122 135f4b3ec61Sdh155122 /* 136f4b3ec61Sdh155122 * IP stack instances 137f4b3ec61Sdh155122 */ 138f4b3ec61Sdh155122 struct ip_stack { 139f4b3ec61Sdh155122 netstack_t *ips_netstack; /* Common netstack */ 140f4b3ec61Sdh155122 141f4b3ec61Sdh155122 struct ipparam_s *ips_param_arr; /* ndd variable table */ 142f4b3ec61Sdh155122 struct ipndp_s *ips_ndp_arr; 143f4b3ec61Sdh155122 144f4b3ec61Sdh155122 mib2_ipIfStatsEntry_t ips_ip_mib; /* SNMP fixed size info */ 145f4b3ec61Sdh155122 mib2_icmp_t ips_icmp_mib; 146f4b3ec61Sdh155122 /* 147f4b3ec61Sdh155122 * IPv6 mibs when the interface (ill) is not known. 148f4b3ec61Sdh155122 * When the ill is known the per-interface mib in the ill is used. 149f4b3ec61Sdh155122 */ 150f4b3ec61Sdh155122 mib2_ipIfStatsEntry_t ips_ip6_mib; 151f4b3ec61Sdh155122 mib2_ipv6IfIcmpEntry_t ips_icmp6_mib; 152f4b3ec61Sdh155122 153f4b3ec61Sdh155122 struct igmpstat ips_igmpstat; 154f4b3ec61Sdh155122 155f4b3ec61Sdh155122 kstat_t *ips_ip_mibkp; /* kstat exporting ip_mib data */ 156f4b3ec61Sdh155122 kstat_t *ips_icmp_mibkp; /* kstat exporting icmp_mib data */ 157f4b3ec61Sdh155122 kstat_t *ips_ip_kstat; 158f4b3ec61Sdh155122 ip_stat_t ips_ip_statistics; 159f4b3ec61Sdh155122 kstat_t *ips_ip6_kstat; 160f4b3ec61Sdh155122 ip6_stat_t ips_ip6_statistics; 161f4b3ec61Sdh155122 162f4b3ec61Sdh155122 /* ip.c */ 163f4b3ec61Sdh155122 krwlock_t ips_ip_g_nd_lock; 164f4b3ec61Sdh155122 kmutex_t ips_igmp_timer_lock; 165f4b3ec61Sdh155122 kmutex_t ips_mld_timer_lock; 166f4b3ec61Sdh155122 kmutex_t ips_ip_mi_lock; 167f4b3ec61Sdh155122 kmutex_t ips_ip_addr_avail_lock; 168f4b3ec61Sdh155122 krwlock_t ips_ill_g_lock; 169f4b3ec61Sdh155122 krwlock_t ips_ipsec_capab_ills_lock; 170f4b3ec61Sdh155122 /* protects the list of IPsec capable ills */ 171f4b3ec61Sdh155122 struct ipsec_capab_ill_s *ips_ipsec_capab_ills_ah; 172f4b3ec61Sdh155122 struct ipsec_capab_ill_s *ips_ipsec_capab_ills_esp; 173f4b3ec61Sdh155122 174f4b3ec61Sdh155122 krwlock_t ips_ill_g_usesrc_lock; 175f4b3ec61Sdh155122 176da14cebeSEric Cheng /* Taskq dispatcher for capability operations */ 177da14cebeSEric Cheng kmutex_t ips_capab_taskq_lock; 178da14cebeSEric Cheng kcondvar_t ips_capab_taskq_cv; 179da14cebeSEric Cheng list_t ips_capab_taskq_list; 180da14cebeSEric Cheng kthread_t *ips_capab_taskq_thread; 181da14cebeSEric Cheng boolean_t ips_capab_taskq_quit; 182da14cebeSEric Cheng 183f4b3ec61Sdh155122 /* ipclassifier.c - keep in ip_stack_t */ 184f4b3ec61Sdh155122 /* ipclassifier hash tables */ 185f4b3ec61Sdh155122 struct connf_s *ips_rts_clients; 186f4b3ec61Sdh155122 struct connf_s *ips_ipcl_conn_fanout; 187f4b3ec61Sdh155122 struct connf_s *ips_ipcl_bind_fanout; 188f4b3ec61Sdh155122 struct connf_s *ips_ipcl_proto_fanout; 189f4b3ec61Sdh155122 struct connf_s *ips_ipcl_proto_fanout_v6; 190f4b3ec61Sdh155122 struct connf_s *ips_ipcl_udp_fanout; 191f4b3ec61Sdh155122 struct connf_s *ips_ipcl_raw_fanout; 192f4b3ec61Sdh155122 uint_t ips_ipcl_conn_fanout_size; 193f4b3ec61Sdh155122 uint_t ips_ipcl_bind_fanout_size; 194f4b3ec61Sdh155122 uint_t ips_ipcl_udp_fanout_size; 195f4b3ec61Sdh155122 uint_t ips_ipcl_raw_fanout_size; 196f4b3ec61Sdh155122 struct connf_s *ips_ipcl_globalhash_fanout; 197f4b3ec61Sdh155122 int ips_conn_g_index; 198f4b3ec61Sdh155122 199f4b3ec61Sdh155122 /* ip.c */ 200328c7d1fSmeem /* Following protected by igmp_timer_lock */ 201f4b3ec61Sdh155122 int ips_igmp_time_to_next; /* Time since last timeout */ 2028dc47d9fSudpa int ips_igmp_timer_scheduled_last; 203f4b3ec61Sdh155122 int ips_igmp_deferred_next; 204f4b3ec61Sdh155122 timeout_id_t ips_igmp_timeout_id; 205f4b3ec61Sdh155122 boolean_t ips_igmp_timer_setter_active; 206f4b3ec61Sdh155122 207f4b3ec61Sdh155122 /* Following protected by mld_timer_lock */ 208f4b3ec61Sdh155122 int ips_mld_time_to_next; /* Time since last timeout */ 2098dc47d9fSudpa int ips_mld_timer_scheduled_last; 210f4b3ec61Sdh155122 int ips_mld_deferred_next; 211f4b3ec61Sdh155122 timeout_id_t ips_mld_timeout_id; 212f4b3ec61Sdh155122 boolean_t ips_mld_timer_setter_active; 213f4b3ec61Sdh155122 214f4b3ec61Sdh155122 /* Protected by igmp_slowtimeout_lock */ 215f4b3ec61Sdh155122 timeout_id_t ips_igmp_slowtimeout_id; 216f4b3ec61Sdh155122 kmutex_t ips_igmp_slowtimeout_lock; 217f4b3ec61Sdh155122 218f4b3ec61Sdh155122 /* Protected by mld_slowtimeout_lock */ 219f4b3ec61Sdh155122 timeout_id_t ips_mld_slowtimeout_id; 220f4b3ec61Sdh155122 kmutex_t ips_mld_slowtimeout_lock; 221f4b3ec61Sdh155122 222f4b3ec61Sdh155122 /* IPv4 forwarding table */ 223f4b3ec61Sdh155122 struct radix_node_head *ips_ip_ftable; 224f4b3ec61Sdh155122 225f4b3ec61Sdh155122 /* This is dynamically allocated in ip_ire_init */ 226f4b3ec61Sdh155122 struct irb *ips_ip_cache_table; 227f4b3ec61Sdh155122 228f4b3ec61Sdh155122 #define IPV6_ABITS 128 229f4b3ec61Sdh155122 #define IP6_MASK_TABLE_SIZE (IPV6_ABITS + 1) /* 129 ptrs */ 230f4b3ec61Sdh155122 231f4b3ec61Sdh155122 struct irb *ips_ip_forwarding_table_v6[IP6_MASK_TABLE_SIZE]; 232f4b3ec61Sdh155122 /* This is dynamically allocated in ip_ire_init */ 233f4b3ec61Sdh155122 struct irb *ips_ip_cache_table_v6; 234f4b3ec61Sdh155122 235f4b3ec61Sdh155122 uint32_t ips_ire_handle; 236f4b3ec61Sdh155122 /* 237f4b3ec61Sdh155122 * ire_ft_init_lock is used while initializing ip_forwarding_table 238f4b3ec61Sdh155122 * dynamically in ire_add. 239f4b3ec61Sdh155122 */ 240f4b3ec61Sdh155122 kmutex_t ips_ire_ft_init_lock; 241f4b3ec61Sdh155122 kmutex_t ips_ire_handle_lock; /* Protects ire_handle */ 242f4b3ec61Sdh155122 243f4b3ec61Sdh155122 uint32_t ips_ip_cache_table_size; 244f4b3ec61Sdh155122 uint32_t ips_ip6_cache_table_size; 245f4b3ec61Sdh155122 uint32_t ips_ip6_ftable_hash_size; 246f4b3ec61Sdh155122 247f4b3ec61Sdh155122 ire_stats_t ips_ire_stats_v4; /* IPv4 ire statistics */ 248f4b3ec61Sdh155122 ire_stats_t ips_ire_stats_v6; /* IPv6 ire statistics */ 249f4b3ec61Sdh155122 250f4b3ec61Sdh155122 /* pending binds */ 251f4b3ec61Sdh155122 mblk_t *ips_ip6_asp_pending_ops; 252f4b3ec61Sdh155122 mblk_t *ips_ip6_asp_pending_ops_tail; 253f4b3ec61Sdh155122 254f4b3ec61Sdh155122 /* Synchronize updates with table usage */ 255f4b3ec61Sdh155122 mblk_t *ips_ip6_asp_pending_update; /* pending table updates */ 256f4b3ec61Sdh155122 257f4b3ec61Sdh155122 boolean_t ips_ip6_asp_uip; /* table update in progress */ 258f4b3ec61Sdh155122 kmutex_t ips_ip6_asp_lock; /* protect all the above */ 259f4b3ec61Sdh155122 uint32_t ips_ip6_asp_refcnt; /* outstanding references */ 260f4b3ec61Sdh155122 261f4b3ec61Sdh155122 struct ip6_asp *ips_ip6_asp_table; 262f4b3ec61Sdh155122 /* The number of policy entries in the table */ 263f4b3ec61Sdh155122 uint_t ips_ip6_asp_table_count; 264f4b3ec61Sdh155122 265f4b3ec61Sdh155122 int ips_ip_g_forward; 266f4b3ec61Sdh155122 int ips_ipv6_forward; 267f4b3ec61Sdh155122 268f4b3ec61Sdh155122 time_t ips_ip_g_frag_timeout; 269f4b3ec61Sdh155122 clock_t ips_ip_g_frag_timo_ms; 270f4b3ec61Sdh155122 271fc80c0dfSnordmark struct conn_s *ips_ip_g_mrouter; 272f4b3ec61Sdh155122 273f4b3ec61Sdh155122 /* Time since last icmp_pkt_err */ 274f4b3ec61Sdh155122 clock_t ips_icmp_pkt_err_last; 275f4b3ec61Sdh155122 /* Number of packets sent in burst */ 276f4b3ec61Sdh155122 uint_t ips_icmp_pkt_err_sent; 277f4b3ec61Sdh155122 278f4b3ec61Sdh155122 /* Protected by ip_mi_lock */ 279f4b3ec61Sdh155122 void *ips_ip_g_head; /* Instance Data List Head */ 280f4b3ec61Sdh155122 281f4b3ec61Sdh155122 caddr_t ips_ip_g_nd; /* Named Dispatch List Head */ 282f4b3ec61Sdh155122 283f4b3ec61Sdh155122 /* Multirouting stuff */ 284f4b3ec61Sdh155122 /* Interval (in ms) between consecutive 'bad MTU' warnings */ 285f4b3ec61Sdh155122 hrtime_t ips_ip_multirt_log_interval; 286f4b3ec61Sdh155122 /* Time since last warning issued. */ 287f4b3ec61Sdh155122 hrtime_t ips_multirt_bad_mtu_last_time; 288f4b3ec61Sdh155122 289655a42e2Snordmark struct cgtp_filter_ops *ips_ip_cgtp_filter_ops; /* CGTP hooks */ 290655a42e2Snordmark boolean_t ips_ip_cgtp_filter; /* Enable/disable CGTP hooks */ 291655a42e2Snordmark 292f4b3ec61Sdh155122 kmutex_t ips_ip_trash_timer_lock; 293f4b3ec61Sdh155122 timeout_id_t ips_ip_ire_expire_id; /* IRE expiration timer. */ 294f4b3ec61Sdh155122 struct ipsq_s *ips_ipsq_g_head; 295f4b3ec61Sdh155122 uint_t ips_ill_index; /* Used to assign interface indicies */ 296f4b3ec61Sdh155122 /* When set search for unused index */ 297f4b3ec61Sdh155122 boolean_t ips_ill_index_wrap; 298f4b3ec61Sdh155122 299f4b3ec61Sdh155122 clock_t ips_ip_ire_arp_time_elapsed; 300f4b3ec61Sdh155122 /* Time since IRE cache last flushed */ 301f4b3ec61Sdh155122 clock_t ips_ip_ire_rd_time_elapsed; 302f4b3ec61Sdh155122 /* ... redirect IREs last flushed */ 303f4b3ec61Sdh155122 clock_t ips_ip_ire_pmtu_time_elapsed; 304f4b3ec61Sdh155122 /* Time since path mtu increase */ 305f4b3ec61Sdh155122 306f4b3ec61Sdh155122 uint_t ips_ip_redirect_cnt; 307f4b3ec61Sdh155122 /* Num of redirect routes in ftable */ 308f4b3ec61Sdh155122 uint_t ips_ipv6_ire_default_count; 309f4b3ec61Sdh155122 /* Number of IPv6 IRE_DEFAULT entries */ 310f4b3ec61Sdh155122 uint_t ips_ipv6_ire_default_index; 311f4b3ec61Sdh155122 /* Walking IPv6 index used to mod in */ 312f4b3ec61Sdh155122 313f4b3ec61Sdh155122 uint_t ips_loopback_packets; 314f4b3ec61Sdh155122 315f4b3ec61Sdh155122 /* NDP/NCE structures for IPv4 and IPv6 */ 316f4b3ec61Sdh155122 struct ndp_g_s *ips_ndp4; 317f4b3ec61Sdh155122 struct ndp_g_s *ips_ndp6; 318f4b3ec61Sdh155122 319f4b3ec61Sdh155122 /* ip_mroute stuff */ 320f4b3ec61Sdh155122 kmutex_t ips_ip_g_mrouter_mutex; 321f4b3ec61Sdh155122 322f4b3ec61Sdh155122 struct mrtstat *ips_mrtstat; /* Stats for netstat */ 323f4b3ec61Sdh155122 int ips_saved_ip_g_forward; 324f4b3ec61Sdh155122 325f4b3ec61Sdh155122 /* numvifs is only a hint about the max interface being used. */ 326f4b3ec61Sdh155122 ushort_t ips_numvifs; 327f4b3ec61Sdh155122 kmutex_t ips_numvifs_mutex; 328f4b3ec61Sdh155122 329f4b3ec61Sdh155122 struct vif *ips_vifs; 330f4b3ec61Sdh155122 struct mfcb *ips_mfcs; /* kernel routing table */ 331f4b3ec61Sdh155122 struct tbf *ips_tbfs; 332f4b3ec61Sdh155122 /* 333f4b3ec61Sdh155122 * One-back cache used to locate a tunnel's vif, 334f4b3ec61Sdh155122 * given a datagram's src ip address. 335f4b3ec61Sdh155122 */ 336f4b3ec61Sdh155122 ipaddr_t ips_last_encap_src; 337f4b3ec61Sdh155122 struct vif *ips_last_encap_vif; 338f4b3ec61Sdh155122 kmutex_t ips_last_encap_lock; /* Protects the above */ 339f4b3ec61Sdh155122 340f4b3ec61Sdh155122 /* 341f4b3ec61Sdh155122 * reg_vif_num is protected by numvifs_mutex 342f4b3ec61Sdh155122 */ 343f4b3ec61Sdh155122 /* Whether or not special PIM assert processing is enabled. */ 344f4b3ec61Sdh155122 ushort_t ips_reg_vif_num; /* Index to Register vif */ 345f4b3ec61Sdh155122 int ips_pim_assert; 346f4b3ec61Sdh155122 347f4b3ec61Sdh155122 union ill_g_head_u *ips_ill_g_heads; /* ILL List Head */ 348f4b3ec61Sdh155122 349f4b3ec61Sdh155122 kstat_t *ips_loopback_ksp; 350f4b3ec61Sdh155122 351f4b3ec61Sdh155122 struct idl_s *ips_conn_drain_list; /* Array of conn drain lists */ 352f4b3ec61Sdh155122 uint_t ips_conn_drain_list_cnt; /* Count of conn_drain_list */ 353f4b3ec61Sdh155122 int ips_conn_drain_list_index; /* Next drain_list */ 354f4b3ec61Sdh155122 355f4b3ec61Sdh155122 /* 356f4b3ec61Sdh155122 * ID used to assign next free one. 357f4b3ec61Sdh155122 * Increases by one. Once it wraps we search for an unused ID. 358f4b3ec61Sdh155122 */ 359f4b3ec61Sdh155122 uint_t ips_ip_src_id; 360f4b3ec61Sdh155122 boolean_t ips_srcid_wrapped; 361f4b3ec61Sdh155122 362f4b3ec61Sdh155122 struct srcid_map *ips_srcid_head; 363f4b3ec61Sdh155122 krwlock_t ips_srcid_lock; 364f4b3ec61Sdh155122 365f4b3ec61Sdh155122 uint64_t ips_ipif_g_seqid; 366f4b3ec61Sdh155122 union phyint_list_u *ips_phyint_g_list; /* start of phyint list */ 367f4b3ec61Sdh155122 368f4b3ec61Sdh155122 /* ip_neti.c */ 369f4b3ec61Sdh155122 hook_family_t ips_ipv4root; 370f4b3ec61Sdh155122 hook_family_t ips_ipv6root; 371f4b3ec61Sdh155122 372f4b3ec61Sdh155122 /* 373f4b3ec61Sdh155122 * Hooks for firewalling 374f4b3ec61Sdh155122 */ 375f4b3ec61Sdh155122 hook_event_t ips_ip4_physical_in_event; 376f4b3ec61Sdh155122 hook_event_t ips_ip4_physical_out_event; 377f4b3ec61Sdh155122 hook_event_t ips_ip4_forwarding_event; 378f4b3ec61Sdh155122 hook_event_t ips_ip4_loopback_in_event; 379f4b3ec61Sdh155122 hook_event_t ips_ip4_loopback_out_event; 380f4b3ec61Sdh155122 hook_event_t ips_ip4_nic_events; 381f4b3ec61Sdh155122 hook_event_t ips_ip6_physical_in_event; 382f4b3ec61Sdh155122 hook_event_t ips_ip6_physical_out_event; 383f4b3ec61Sdh155122 hook_event_t ips_ip6_forwarding_event; 384f4b3ec61Sdh155122 hook_event_t ips_ip6_loopback_in_event; 385f4b3ec61Sdh155122 hook_event_t ips_ip6_loopback_out_event; 386f4b3ec61Sdh155122 hook_event_t ips_ip6_nic_events; 387f4b3ec61Sdh155122 388f4b3ec61Sdh155122 hook_event_token_t ips_ipv4firewall_physical_in; 389f4b3ec61Sdh155122 hook_event_token_t ips_ipv4firewall_physical_out; 390f4b3ec61Sdh155122 hook_event_token_t ips_ipv4firewall_forwarding; 391f4b3ec61Sdh155122 hook_event_token_t ips_ipv4firewall_loopback_in; 392f4b3ec61Sdh155122 hook_event_token_t ips_ipv4firewall_loopback_out; 393f4b3ec61Sdh155122 hook_event_token_t ips_ipv4nicevents; 394f4b3ec61Sdh155122 hook_event_token_t ips_ipv6firewall_physical_in; 395f4b3ec61Sdh155122 hook_event_token_t ips_ipv6firewall_physical_out; 396f4b3ec61Sdh155122 hook_event_token_t ips_ipv6firewall_forwarding; 397f4b3ec61Sdh155122 hook_event_token_t ips_ipv6firewall_loopback_in; 398f4b3ec61Sdh155122 hook_event_token_t ips_ipv6firewall_loopback_out; 399f4b3ec61Sdh155122 hook_event_token_t ips_ipv6nicevents; 400f4b3ec61Sdh155122 4017ddc9b1aSDarren Reed net_handle_t ips_ipv4_net_data; 4027ddc9b1aSDarren Reed net_handle_t ips_ipv6_net_data; 403b127ac41SPhilip Kirk 404b127ac41SPhilip Kirk boolean_t ips_ipobs_enabled; 405b127ac41SPhilip Kirk list_t ips_ipobs_cb_list; 406b127ac41SPhilip Kirk kmutex_t ips_ipobs_cb_lock; 407b127ac41SPhilip Kirk uint_t ips_ipobs_cb_nwalkers; 408b127ac41SPhilip Kirk kcondvar_t ips_ipobs_cb_cv; 4090f1702c5SYu Xiangning 4100f1702c5SYu Xiangning struct __ldi_ident *ips_ldi_ident; 411*e11c3f44Smeem 412*e11c3f44Smeem /* ipmp.c */ 413*e11c3f44Smeem krwlock_t ips_ipmp_lock; 414*e11c3f44Smeem mod_hash_t *ips_ipmp_grp_hash; 415*e11c3f44Smeem 416*e11c3f44Smeem /* igmp.c */ 417*e11c3f44Smeem /* multicast restart timers thread logic */ 418*e11c3f44Smeem kmutex_t ips_mrt_lock; 419*e11c3f44Smeem uint_t ips_mrt_flags; 420*e11c3f44Smeem kcondvar_t ips_mrt_cv; 421*e11c3f44Smeem kcondvar_t ips_mrt_done_cv; 422*e11c3f44Smeem kthread_t *ips_mrt_thread; 423f4b3ec61Sdh155122 }; 424f4b3ec61Sdh155122 typedef struct ip_stack ip_stack_t; 425f4b3ec61Sdh155122 426f4b3ec61Sdh155122 /* Finding an ip_stack_t */ 427f4b3ec61Sdh155122 #define CONNQ_TO_IPST(_q) (Q_TO_CONN(_q)->conn_netstack->netstack_ip) 428f4b3ec61Sdh155122 #define ILLQ_TO_IPST(_q) (((ill_t *)(_q)->q_ptr)->ill_ipst) 429*e11c3f44Smeem #define PHYINT_TO_IPST(phyi) ((phyi)->phyint_ipsq->ipsq_ipst) 430f4b3ec61Sdh155122 431f4b3ec61Sdh155122 #else /* _KERNEL */ 432f4b3ec61Sdh155122 typedef int ip_stack_t; 433f4b3ec61Sdh155122 #endif /* _KERNEL */ 434f4b3ec61Sdh155122 435f4b3ec61Sdh155122 #ifdef __cplusplus 436f4b3ec61Sdh155122 } 437f4b3ec61Sdh155122 #endif 438f4b3ec61Sdh155122 439f4b3ec61Sdh155122 #endif /* _INET_IP_STACK_H */ 440