#ifndef _INET_IP_H
#define _INET_IP_H
#ifdef __cplusplus
extern "C" {
#endif
#include <sys/isa_defs.h>
#include <sys/types.h>
#include <inet/mib2.h>
#include <inet/nd.h>
#include <sys/atomic.h>
#include <net/if_dl.h>
#include <net/if.h>
#include <netinet/ip.h>
#include <netinet/igmp.h>
#include <sys/neti.h>
#include <sys/hook.h>
#include <sys/hook_event.h>
#include <sys/hook_impl.h>
#include <inet/ip_stack.h>
#ifdef _KERNEL
#include <netinet/ip6.h>
#include <sys/avl.h>
#include <sys/list.h>
#include <sys/vmem.h>
#include <sys/squeue.h>
#include <net/route.h>
#include <sys/systm.h>
#include <net/radix.h>
#include <sys/modhash.h>
#ifdef DEBUG
#define CONN_DEBUG
#endif
#define IP_DEBUG
#define IP_DEVMTFLAGS D_MP
#endif
#define IP_MOD_NAME "ip"
#define IP_DEV_NAME "/dev/ip"
#define IP6_DEV_NAME "/dev/ip6"
#define UDP_MOD_NAME "udp"
#define UDP_DEV_NAME "/dev/udp"
#define UDP6_DEV_NAME "/dev/udp6"
#define TCP_MOD_NAME "tcp"
#define TCP_DEV_NAME "/dev/tcp"
#define TCP6_DEV_NAME "/dev/tcp6"
#define SCTP_MOD_NAME "sctp"
#ifndef _IPADDR_T
#define _IPADDR_T
typedef uint32_t ipaddr_t;
#endif
#define IP_ABITS 32
#define IPV4_ABITS IP_ABITS
#define IPV6_ABITS 128
#define IP_MAX_HW_LEN 40
#define IP_HOST_MASK (ipaddr_t)0xffffffffU
#define IP_CSUM(mp, off, sum) (~ip_cksum(mp, off, sum) & 0xFFFF)
#define IP_CSUM_PARTIAL(mp, off, sum) ip_cksum(mp, off, sum)
#define IP_BCSUM_PARTIAL(bp, len, sum) bcksum(bp, len, sum)
#define ILL_FRAG_HASH_TBL_COUNT ((unsigned int)64)
#define ILL_FRAG_HASH_TBL_SIZE (ILL_FRAG_HASH_TBL_COUNT * sizeof (ipfb_t))
#define IPV4_ADDR_LEN 4
#define IP_ADDR_LEN IPV4_ADDR_LEN
#define IP_ARP_PROTO_TYPE 0x0800
#define IPV4_VERSION 4
#define IP_VERSION IPV4_VERSION
#define IP_SIMPLE_HDR_LENGTH_IN_WORDS 5
#define IP_SIMPLE_HDR_LENGTH 20
#define IP_MAX_HDR_LENGTH 60
#define IP_MAX_OPT_LENGTH (IP_MAX_HDR_LENGTH-IP_SIMPLE_HDR_LENGTH)
#define IP_MIN_MTU (IP_MAX_HDR_LENGTH + 8)
#define IP_MAXPACKET 65535
#define IP_SIMPLE_HDR_VERSION \
((IP_VERSION << 4) | IP_SIMPLE_HDR_LENGTH_IN_WORDS)
#define UDPH_SIZE 8
#define IP_IOCTL (('i'<<8)|'p')
#define IP_IOC_IRE_DELETE 4
#define IP_IOC_IRE_DELETE_NO_REPLY 5
#define IP_IOC_RTS_REQUEST 7
typedef struct ipllcmd_s {
uint_t ipllc_cmd;
uint_t ipllc_name_offset;
uint_t ipllc_name_length;
} ipllc_t;
typedef struct ipid_s {
ipllc_t ipid_ipllc;
uint_t ipid_ire_type;
uint_t ipid_addr_offset;
uint_t ipid_addr_length;
uint_t ipid_mask_offset;
uint_t ipid_mask_length;
} ipid_t;
#define ipid_cmd ipid_ipllc.ipllc_cmd
#ifdef _KERNEL
typedef struct ipoptp_s
{
uint8_t *ipoptp_next;
uint8_t *ipoptp_end;
uint8_t *ipoptp_cur;
uint8_t ipoptp_len;
uint32_t ipoptp_flags;
} ipoptp_t;
#define IPOPTP_ERROR 0x00000001
#endif
#define IP_FORWARD_NEVER 0
#define IP_FORWARD_ALWAYS 1
#define WE_ARE_FORWARDING(ipst) ((ipst)->ips_ip_forwarding == IP_FORWARD_ALWAYS)
#define IPH_HDR_LENGTH(ipha) \
((int)(((ipha_t *)ipha)->ipha_version_and_hdr_length & 0xF) << 2)
#define IPH_HDR_VERSION(ipha) \
((int)(((ipha_t *)ipha)->ipha_version_and_hdr_length) >> 4)
#ifdef _KERNEL
#define IP_REASS_START(mp) ((uint_t)(uintptr_t)((mp)->b_next))
#define IP_REASS_SET_START(mp, u) \
((mp)->b_next = (mblk_t *)(uintptr_t)(u))
#define IP_REASS_END(mp) ((uint_t)(uintptr_t)((mp)->b_prev))
#define IP_REASS_SET_END(mp, u) \
((mp)->b_prev = (mblk_t *)(uintptr_t)(u))
#define IP_REASS_COMPLETE 0x1
#define IP_REASS_PARTIAL 0x2
#define IP_REASS_FAILED 0x4
#define CONN_Q(q) (WR(q)->q_next == NULL)
#define Q_TO_CONN(q) ((conn_t *)(q)->q_ptr)
#define Q_TO_TCP(q) (Q_TO_CONN((q))->conn_tcp)
#define Q_TO_UDP(q) (Q_TO_CONN((q))->conn_udp)
#define Q_TO_ICMP(q) (Q_TO_CONN((q))->conn_icmp)
#define Q_TO_RTS(q) (Q_TO_CONN((q))->conn_rts)
#define CONNP_TO_WQ(connp) ((connp)->conn_wq)
#define CONNP_TO_RQ(connp) ((connp)->conn_rq)
#define GRAB_CONN_LOCK(q) { \
if (q != NULL && CONN_Q(q)) \
mutex_enter(&(Q_TO_CONN(q))->conn_lock); \
}
#define RELEASE_CONN_LOCK(q) { \
if (q != NULL && CONN_Q(q)) \
mutex_exit(&(Q_TO_CONN(q))->conn_lock); \
}
#define CONN_INC_IOCTLREF_LOCKED(connp) { \
ASSERT(MUTEX_HELD(&(connp)->conn_lock)); \
DTRACE_PROBE1(conn__inc__ioctlref, conn_t *, (connp)); \
(connp)->conn_ioctlref++; \
mutex_exit(&(connp)->conn_lock); \
}
#define CONN_INC_IOCTLREF(connp) { \
mutex_enter(&(connp)->conn_lock); \
CONN_INC_IOCTLREF_LOCKED(connp); \
}
#define CONN_DEC_IOCTLREF(connp) { \
mutex_enter(&(connp)->conn_lock); \
DTRACE_PROBE1(conn__dec__ioctlref, conn_t *, (connp)); \
\
ASSERT((connp)->conn_ioctlref != 0); \
if ((--(connp)->conn_ioctlref == 0) && \
((connp)->conn_state_flags & CONN_CLOSING)) { \
cv_broadcast(&(connp)->conn_cv); \
} \
mutex_exit(&(connp)->conn_lock); \
}
#define CONN_OPER_PENDING_DONE(connp) { \
mutex_enter(&(connp)->conn_lock); \
(connp)->conn_oper_pending_ill = NULL; \
cv_broadcast(&(connp)->conn_refcv); \
mutex_exit(&(connp)->conn_lock); \
CONN_DEC_REF(connp); \
}
#define IP_SQUEUE_ENTER_NODRAIN 1
#define IP_SQUEUE_ENTER 2
#define IP_SQUEUE_FILL 3
extern int ip_squeue_flag;
typedef struct ipf_s {
struct ipf_s *ipf_hash_next;
struct ipf_s **ipf_ptphn;
uint32_t ipf_ident;
uint8_t ipf_protocol;
uchar_t ipf_last_frag_seen : 1;
time_t ipf_timestamp;
mblk_t *ipf_mp;
mblk_t *ipf_tail_mp;
int ipf_hole_cnt;
int ipf_end;
uint_t ipf_gen;
size_t ipf_count;
uint_t ipf_nf_hdr_len;
in6_addr_t ipf_v6src;
in6_addr_t ipf_v6dst;
uint_t ipf_prev_nexthdr_offset;
uint8_t ipf_ecn;
uint8_t ipf_num_dups;
uint16_t ipf_checksum_flags;
uint32_t ipf_checksum;
} ipf_t;
#define IS_V4_FRAGMENT(ipha_fragment_offset_and_flags) \
(((ntohs(ipha_fragment_offset_and_flags) & IPH_OFFSET) != 0) || \
((ntohs(ipha_fragment_offset_and_flags) & IPH_MF) != 0))
#define ipf_src V4_PART_OF_V6(ipf_v6src)
#define ipf_dst V4_PART_OF_V6(ipf_v6dst)
#endif
#define ICMP_ECHO_REPLY 0
#define ICMP_DEST_UNREACHABLE 3
#define ICMP_SOURCE_QUENCH 4
#define ICMP_REDIRECT 5
#define ICMP_ECHO_REQUEST 8
#define ICMP_ROUTER_ADVERTISEMENT 9
#define ICMP_ROUTER_SOLICITATION 10
#define ICMP_TIME_EXCEEDED 11
#define ICMP_PARAM_PROBLEM 12
#define ICMP_TIME_STAMP_REQUEST 13
#define ICMP_TIME_STAMP_REPLY 14
#define ICMP_INFO_REQUEST 15
#define ICMP_INFO_REPLY 16
#define ICMP_ADDRESS_MASK_REQUEST 17
#define ICMP_ADDRESS_MASK_REPLY 18
#define ICMP_IS_ERROR(type) ( \
(type) == ICMP_DEST_UNREACHABLE || \
(type) == ICMP_SOURCE_QUENCH || \
(type) == ICMP_TIME_EXCEEDED || \
(type) == ICMP_PARAM_PROBLEM)
#define ICMP_TTL_EXCEEDED 0
#define ICMP_REASSEMBLY_TIME_EXCEEDED 1
#define ICMP_NET_UNREACHABLE 0
#define ICMP_HOST_UNREACHABLE 1
#define ICMP_PROTOCOL_UNREACHABLE 2
#define ICMP_PORT_UNREACHABLE 3
#define ICMP_FRAGMENTATION_NEEDED 4
#define ICMP_SOURCE_ROUTE_FAILED 5
#define ICMP_DEST_NET_UNKNOWN 6
#define ICMP_DEST_HOST_UNKNOWN 7
#define ICMP_SRC_HOST_ISOLATED 8
#define ICMP_DEST_NET_UNREACH_ADMIN 9
#define ICMP_DEST_HOST_UNREACH_ADMIN 10
#define ICMP_DEST_NET_UNREACH_TOS 11
#define ICMP_DEST_HOST_UNREACH_TOS 12
typedef struct icmph_s {
uint8_t icmph_type;
uint8_t icmph_code;
uint16_t icmph_checksum;
union {
struct {
uint16_t u_echo_ident;
uint16_t u_echo_seqnum;
} u_echo;
struct {
uint16_t u_du_zero;
uint16_t u_du_mtu;
} u_du;
struct {
uint8_t u_pp_ptr;
uint8_t u_pp_rsvd[3];
} u_pp;
struct {
ipaddr_t u_rd_gateway;
} u_rd;
} icmph_u;
} icmph_t;
#define icmph_echo_ident icmph_u.u_echo.u_echo_ident
#define icmph_echo_seqnum icmph_u.u_echo.u_echo_seqnum
#define icmph_du_zero icmph_u.u_du.u_du_zero
#define icmph_du_mtu icmph_u.u_du.u_du_mtu
#define icmph_pp_ptr icmph_u.u_pp.u_pp_ptr
#define icmph_rd_gateway icmph_u.u_rd.u_rd_gateway
#define ICMPH_SIZE 8
#define ICMP_MIN_TP_HDR_LEN 8
typedef struct ipha_s {
uint8_t ipha_version_and_hdr_length;
uint8_t ipha_type_of_service;
uint16_t ipha_length;
uint16_t ipha_ident;
uint16_t ipha_fragment_offset_and_flags;
uint8_t ipha_ttl;
uint8_t ipha_protocol;
uint16_t ipha_hdr_checksum;
ipaddr_t ipha_src;
ipaddr_t ipha_dst;
} ipha_t;
#define IPH_DF 0x4000
#define IPH_MF 0x2000
#define IPH_OFFSET 0x1FFF
#ifdef _BIG_ENDIAN
#define IPH_DF_HTONS 0x4000
#define IPH_MF_HTONS 0x2000
#define IPH_OFFSET_HTONS 0x1FFF
#else
#define IPH_DF_HTONS 0x0040
#define IPH_MF_HTONS 0x0020
#define IPH_OFFSET_HTONS 0xFF1F
#endif
#define IPH_ECN_NECT 0x0
#define IPH_ECN_ECT1 0x1
#define IPH_ECN_ECT0 0x2
#define IPH_ECN_CE 0x3
struct ill_s;
typedef void ip_v6intfid_func_t(struct ill_s *, in6_addr_t *);
typedef void ip_v6mapinfo_func_t(struct ill_s *, uchar_t *, uchar_t *);
typedef void ip_v4mapinfo_func_t(struct ill_s *, uchar_t *, uchar_t *);
typedef struct ip_m_s {
t_uscalar_t ip_m_mac_type;
int ip_m_type;
t_uscalar_t ip_m_ipv4sap;
t_uscalar_t ip_m_ipv6sap;
ip_v4mapinfo_func_t *ip_m_v4mapping;
ip_v6mapinfo_func_t *ip_m_v6mapping;
ip_v6intfid_func_t *ip_m_v6intfid;
ip_v6intfid_func_t *ip_m_v6destintfid;
} ip_m_t;
extern void ip_mcast_mapping(struct ill_s *, uchar_t *, uchar_t *);
#define MEDIA_V6INTFID(ip_m, ill, v6ptr) (ip_m)->ip_m_v6intfid(ill, v6ptr)
#define MEDIA_V6DESTINTFID(ip_m, ill, v6ptr) \
(ip_m)->ip_m_v6destintfid(ill, v6ptr)
#define IRE_BROADCAST 0x0001
#define IRE_DEFAULT 0x0002
#define IRE_LOCAL 0x0004
#define IRE_LOOPBACK 0x0008
#define IRE_PREFIX 0x0010
#ifndef _KERNEL
#define IRE_CACHE 0x0020
#endif
#define IRE_IF_NORESOLVER 0x0040
#define IRE_IF_RESOLVER 0x0080
#define IRE_HOST 0x0100
#define IRE_HOST_REDIRECT 0x0200
#define IRE_IF_CLONE 0x0400
#define IRE_MULTICAST 0x0800
#define IRE_NOROUTE 0x1000
#define IRE_INTERFACE (IRE_IF_NORESOLVER | IRE_IF_RESOLVER)
#define IRE_IF_ALL (IRE_IF_NORESOLVER | IRE_IF_RESOLVER | \
IRE_IF_CLONE)
#define IRE_OFFSUBNET (IRE_DEFAULT | IRE_PREFIX | IRE_HOST)
#define IRE_OFFLINK IRE_OFFSUBNET
#define IRE_ONLINK (IRE_IF_ALL|IRE_LOCAL|IRE_LOOPBACK| \
IRE_BROADCAST|IRE_MULTICAST|IRE_NOROUTE)
#define IRE_FLUSH_DELETE 0
#define IRE_FLUSH_ADD 1
#define IRE_FLUSH_GWCHANGE 2
#define IRR_NONE 0
#define IRR_ALLOCATE 1
#define IRR_INCOMPLETE 2
#define CONN_CLOSING 0x01
#define CONN_CONDEMNED 0x02
#define CONN_INCIPIENT 0x04
#define CONN_QUIESCED 0x08
#define CONN_UPDATE_ILL 0x10
#define DCEF_DEFAULT 0x0001
#define DCEF_PMTU 0x0002
#define DCEF_UINFO 0x0004
#define DCEF_TOO_SMALL_PMTU 0x0008
#ifdef _KERNEL
#define MAX_FILTER_SIZE 64
typedef struct slist_s {
int sl_numsrc;
in6_addr_t sl_addr[MAX_FILTER_SIZE];
} slist_t;
typedef struct rtx_state_s {
uint_t rtx_timer;
int rtx_cnt;
int rtx_fmode_cnt;
slist_t *rtx_allow;
slist_t *rtx_block;
} rtx_state_t;
typedef struct mrec_s {
struct mrec_s *mrec_next;
uint8_t mrec_type;
uint8_t mrec_auxlen;
in6_addr_t mrec_group;
slist_t mrec_srcs;
} mrec_t;
typedef struct ilg_s {
struct ilg_s *ilg_next;
struct ilg_s **ilg_ptpn;
struct conn_s *ilg_connp;
in6_addr_t ilg_v6group;
ipaddr_t ilg_ifaddr;
uint_t ilg_ifindex;
struct ill_s *ilg_ill;
struct ilm_s *ilg_ilm;
uint_t ilg_refcnt;
mcast_record_t ilg_fmode;
slist_t *ilg_filter;
boolean_t ilg_condemned;
} ilg_t;
typedef struct ilm_s {
in6_addr_t ilm_v6addr;
int ilm_refcnt;
uint_t ilm_timer;
struct ilm_s *ilm_next;
uint_t ilm_state;
struct ill_s *ilm_ill;
zoneid_t ilm_zoneid;
int ilm_no_ilg_cnt;
mcast_record_t ilm_fmode;
slist_t *ilm_filter;
slist_t *ilm_pendsrcs;
rtx_state_t ilm_rtx;
ipaddr_t ilm_ifaddr;
ip_stack_t *ilm_ipst;
} ilm_t;
#define ilm_addr V4_PART_OF_V6(ilm_v6addr)
typedef struct ipsa_ref_s
{
struct ipsa_s *ipsr_sa;
struct isaf_s *ipsr_bucket;
uint64_t ipsr_gen;
} ipsa_ref_t;
typedef struct ipsec_latch_s
{
kmutex_t ipl_lock;
uint32_t ipl_refcnt;
struct ipsid_s *ipl_local_cid;
struct ipsid_s *ipl_remote_cid;
unsigned int
ipl_ids_latched : 1,
ipl_pad_to_bit_31 : 31;
} ipsec_latch_t;
#define IPLATCH_REFHOLD(ipl) { \
atomic_inc_32(&(ipl)->ipl_refcnt); \
ASSERT((ipl)->ipl_refcnt != 0); \
}
#define IPLATCH_REFRELE(ipl) { \
ASSERT((ipl)->ipl_refcnt != 0); \
membar_exit(); \
if (atomic_dec_32_nv(&(ipl)->ipl_refcnt) == 0) \
iplatch_free(ipl); \
}
typedef struct conn_s conn_t;
typedef struct ipsec_selector {
in6_addr_t ips_local_addr_v6;
in6_addr_t ips_remote_addr_v6;
uint16_t ips_local_port;
uint16_t ips_remote_port;
uint8_t ips_icmp_type;
uint8_t ips_icmp_code;
uint8_t ips_protocol;
uint8_t ips_isv4 : 1,
ips_is_icmp_inv_acq: 1;
} ipsec_selector_t;
#define ips_local_addr_v4 ips_local_addr_v6.s6_addr32[0]
#define ips_remote_addr_v4 ips_remote_addr_v6.s6_addr32[0]
#define IPSEC_OUTBOUND B_TRUE
#define IPSEC_INBOUND B_FALSE
#define IPSEC_POLICY_NOT_NEEDED 0
#define IPSEC_POLICY_MISMATCH 1
#define IPSEC_POLICY_AUTH_NOT_NEEDED 2
#define IPSEC_POLICY_ENCR_NOT_NEEDED 3
#define IPSEC_POLICY_SE_NOT_NEEDED 4
#define IPSEC_POLICY_MAX 5
#define CONN_INBOUND_POLICY_PRESENT(connp, ipss) \
((connp)->conn_in_enforce_policy || \
(!((connp)->conn_policy_cached) && \
(ipss)->ipsec_inbound_v4_policy_present))
#define CONN_INBOUND_POLICY_PRESENT_V6(connp, ipss) \
((connp)->conn_in_enforce_policy || \
(!(connp)->conn_policy_cached && \
(ipss)->ipsec_inbound_v6_policy_present))
#define CONN_OUTBOUND_POLICY_PRESENT(connp, ipss) \
((connp)->conn_out_enforce_policy || \
(!((connp)->conn_policy_cached) && \
(ipss)->ipsec_outbound_v4_policy_present))
#define CONN_OUTBOUND_POLICY_PRESENT_V6(connp, ipss) \
((connp)->conn_out_enforce_policy || \
(!(connp)->conn_policy_cached && \
(ipss)->ipsec_outbound_v6_policy_present))
typedef struct iulp_s {
boolean_t iulp_set;
uint32_t iulp_ssthresh;
clock_t iulp_rtt;
clock_t iulp_rtt_sd;
uint32_t iulp_spipe;
uint32_t iulp_rpipe;
uint32_t iulp_rtomax;
uint32_t iulp_sack;
uint32_t iulp_mtu;
uint32_t
iulp_tstamp_ok : 1,
iulp_wscale_ok : 1,
iulp_ecn_ok : 1,
iulp_pmtud_ok : 1,
iulp_localnet: 1,
iulp_loopback: 1,
iulp_local: 1,
iulp_not_used : 25;
} iulp_t;
typedef uintptr_t ip_mac_tx_cookie_t;
typedef struct idl_s idl_t;
typedef struct idl_tx_list_s idl_tx_list_t;
struct idl_tx_list_s {
ip_mac_tx_cookie_t txl_cookie;
kmutex_t txl_lock;
idl_t *txl_drain_list;
int txl_drain_index;
};
struct idl_s {
conn_t *idl_conn;
kmutex_t idl_lock;
idl_tx_list_t *idl_itl;
};
typedef struct ifrt_s {
ushort_t ifrt_type;
in6_addr_t ifrt_v6addr;
in6_addr_t ifrt_v6gateway_addr;
in6_addr_t ifrt_v6setsrc_addr;
in6_addr_t ifrt_v6mask;
uint32_t ifrt_flags;
iulp_t ifrt_metrics;
zoneid_t ifrt_zoneid;
} ifrt_t;
#define ifrt_addr V4_PART_OF_V6(ifrt_v6addr)
#define ifrt_gateway_addr V4_PART_OF_V6(ifrt_v6gateway_addr)
#define ifrt_mask V4_PART_OF_V6(ifrt_v6mask)
#define ifrt_setsrc_addr V4_PART_OF_V6(ifrt_v6setsrc_addr)
#define MAX_ADDRS_PER_IF 8192
#define MAX_IPIF_SELECT_SOURCE 50
#ifdef IP_DEBUG
#define TR_STACK_DEPTH 14
typedef struct tr_buf_s {
int tr_depth;
clock_t tr_time;
pc_t tr_stack[TR_STACK_DEPTH];
} tr_buf_t;
typedef struct th_trace_s {
int th_refcnt;
uint_t th_trace_lastref;
kthread_t *th_id;
#define TR_BUF_MAX 38
tr_buf_t th_trbuf[TR_BUF_MAX];
} th_trace_t;
typedef struct th_hash_s {
list_node_t thh_link;
mod_hash_t *thh_hash;
ip_stack_t *thh_ipst;
} th_hash_t;
#endif
#define IPIF_CONDEMNED 0x1
#define IPIF_CHANGING 0x2
#define IPIF_SET_LINKLOCAL 0x10
typedef struct ipif_s {
struct ipif_s *ipif_next;
struct ill_s *ipif_ill;
int ipif_id;
in6_addr_t ipif_v6lcl_addr;
in6_addr_t ipif_v6subnet;
in6_addr_t ipif_v6net_mask;
in6_addr_t ipif_v6brd_addr;
in6_addr_t ipif_v6pp_dst_addr;
uint64_t ipif_flags;
uint_t ipif_ire_type;
uint_t ipif_ib_pkt_count;
unsigned int
ipif_was_up : 1,
ipif_addr_ready : 1,
ipif_was_dup : 1,
ipif_added_nce : 1,
ipif_pad_to_31 : 28;
ilm_t *ipif_allhosts_ilm;
ilm_t *ipif_solmulti_ilm;
uint_t ipif_seqid;
uint_t ipif_state_flags;
uint_t ipif_refcnt;
zoneid_t ipif_zoneid;
timeout_id_t ipif_recovery_id;
boolean_t ipif_trace_disable;
struct ill_s *ipif_bound_ill;
struct ipif_s *ipif_bound_next;
boolean_t ipif_bound;
struct ire_s *ipif_ire_local;
struct ire_s *ipif_ire_if;
} ipif_t;
typedef enum { IPVL_UNICAST_UP, IPVL_UNICAST_DOWN, IPVL_MCAST, IPVL_BCAST,
IPVL_BAD} ip_laddr_t;
#define IP_TR_HASH(tid) ((((uintptr_t)tid) >> 6) & (IP_TR_HASH_MAX - 1))
#ifdef DEBUG
#define IPIF_TRACE_REF(ipif) ipif_trace_ref(ipif)
#define ILL_TRACE_REF(ill) ill_trace_ref(ill)
#define IPIF_UNTRACE_REF(ipif) ipif_untrace_ref(ipif)
#define ILL_UNTRACE_REF(ill) ill_untrace_ref(ill)
#else
#define IPIF_TRACE_REF(ipif)
#define ILL_TRACE_REF(ill)
#define IPIF_UNTRACE_REF(ipif)
#define ILL_UNTRACE_REF(ill)
#endif
#define ipif_lcl_addr V4_PART_OF_V6(ipif_v6lcl_addr)
#define ipif_subnet V4_PART_OF_V6(ipif_v6subnet)
#define ipif_net_mask V4_PART_OF_V6(ipif_v6net_mask)
#define ipif_brd_addr V4_PART_OF_V6(ipif_v6brd_addr)
#define ipif_pp_dst_addr V4_PART_OF_V6(ipif_v6pp_dst_addr)
#define ipif_isv6 ipif_ill->ill_isv6
#define SIOCLIFADDR_NDX 112
#define CONN_CLOSE 1
#define COPYOUT 2
#define NO_COPYOUT 3
#define IPI2MODE(ipi) ((ipi)->ipi_flags & IPI_GET_CMD ? COPYOUT : NO_COPYOUT)
typedef struct ipxop_s {
kmutex_t ipx_lock;
kthread_t *ipx_writer;
mblk_t *ipx_mphead;
mblk_t *ipx_mptail;
struct ipsq_s *ipx_ipsq;
boolean_t ipx_ipsq_queued;
int ipx_waitfor;
int ipx_reentry_cnt;
boolean_t ipx_current_done;
int ipx_current_ioctl;
ipif_t *ipx_current_ipif;
ipif_t *ipx_pending_ipif;
mblk_t *ipx_pending_mp;
boolean_t ipx_forced;
#ifdef DEBUG
int ipx_depth;
#define IPX_STACK_DEPTH 15
pc_t ipx_stack[IPX_STACK_DEPTH];
#endif
} ipxop_t;
typedef struct ipsq_s {
kmutex_t ipsq_lock;
mblk_t *ipsq_switch_mp;
mblk_t *ipsq_xopq_mphead;
mblk_t *ipsq_xopq_mptail;
struct phyint *ipsq_phyint;
struct ipsq_s *ipsq_next;
struct ipxop_s *ipsq_xop;
struct ipxop_s *ipsq_swxop;
struct ipxop_s ipsq_ownxop;
ip_stack_t *ipsq_ipst;
} ipsq_t;
enum {
IPIF_DOWN = 1,
ILL_DOWN,
IPIF_FREE,
ILL_FREE
};
#define CUR_OP 0
#define NEW_OP 1
#define SWITCH_OP 2
enum {
IPMP_KSTAT_OBYTES, IPMP_KSTAT_OBYTES64, IPMP_KSTAT_RBYTES,
IPMP_KSTAT_RBYTES64, IPMP_KSTAT_OPACKETS, IPMP_KSTAT_OPACKETS64,
IPMP_KSTAT_OERRORS, IPMP_KSTAT_IPACKETS, IPMP_KSTAT_IPACKETS64,
IPMP_KSTAT_IERRORS, IPMP_KSTAT_MULTIRCV, IPMP_KSTAT_MULTIXMT,
IPMP_KSTAT_BRDCSTRCV, IPMP_KSTAT_BRDCSTXMT, IPMP_KSTAT_LINK_UP,
IPMP_KSTAT_MAX
};
typedef struct phyint {
struct ill_s *phyint_illv4;
struct ill_s *phyint_illv6;
uint_t phyint_ifindex;
uint64_t phyint_flags;
avl_node_t phyint_avl_by_index;
avl_node_t phyint_avl_by_name;
kmutex_t phyint_lock;
struct ipsq_s *phyint_ipsq;
struct ipmp_grp_s *phyint_grp;
char phyint_name[LIFNAMSIZ];
uint64_t phyint_kstats0[IPMP_KSTAT_MAX];
} phyint_t;
#define CACHE_ALIGN_SIZE 64
#define CACHE_ALIGN(align_struct) P2ROUNDUP(sizeof (struct align_struct),\
CACHE_ALIGN_SIZE)
struct _phyint_list_s_ {
avl_tree_t phyint_list_avl_by_index;
avl_tree_t phyint_list_avl_by_name;
};
typedef union phyint_list_u {
struct _phyint_list_s_ phyint_list_s;
char phyint_list_filler[CACHE_ALIGN(_phyint_list_s_)];
} phyint_list_t;
#define phyint_list_avl_by_index phyint_list_s.phyint_list_avl_by_index
#define phyint_list_avl_by_name phyint_list_s.phyint_list_avl_by_name
typedef struct ipfb_s {
struct ipf_s *ipfb_ipf;
size_t ipfb_count;
kmutex_t ipfb_lock;
uint_t ipfb_frag_pkts;
} ipfb_t;
typedef struct irb {
struct ire_s *irb_ire;
krwlock_t irb_lock;
uint_t irb_refcnt;
uchar_t irb_marks;
#define IRB_MARK_CONDEMNED 0x0001
#define IRB_MARK_DYNAMIC 0x0002
uint_t irb_ire_cnt;
int irb_nire;
ip_stack_t *irb_ipst;
} irb_t;
typedef struct multiphysaddr_s {
struct multiphysaddr_s *mpa_next;
char mpa_addr[IP_MAX_HW_LEN];
int mpa_refcnt;
} multiphysaddr_t;
#define IRB2RT(irb) (rt_t *)((caddr_t)(irb) - offsetof(rt_t, rt_irb))
struct dce_s;
typedef struct dce_s dce_t;
struct ire_s;
typedef struct ire_s ire_t;
struct ncec_s;
typedef struct ncec_s ncec_t;
struct nce_s;
typedef struct nce_s nce_t;
struct ip_recv_attr_s;
typedef struct ip_recv_attr_s ip_recv_attr_t;
struct ip_xmit_attr_s;
typedef struct ip_xmit_attr_s ip_xmit_attr_t;
struct tsol_ire_gw_secattr_s;
typedef struct tsol_ire_gw_secattr_s tsol_ire_gw_secattr_t;
typedef struct {
ire_t *rtc_ire;
ipaddr_t rtc_ipaddr;
in6_addr_t rtc_ip6addr;
} rtc_t;
typedef uint64_t iaflags_t;
typedef void (*pfillinput_t)(mblk_t *, void *, void *, ip_recv_attr_t *,
rtc_t *);
typedef void (*pfirerecv_t)(ire_t *, mblk_t *, void *, ip_recv_attr_t *);
typedef int (*pfiresend_t)(ire_t *, mblk_t *, void *,
ip_xmit_attr_t *, uint32_t *);
typedef int (*pfirepostfrag_t)(mblk_t *, nce_t *, iaflags_t, uint_t, uint32_t,
zoneid_t, zoneid_t, uintptr_t *);
#define IP_V4_G_HEAD 0
#define IP_V6_G_HEAD 1
#define MAX_G_HEADS 2
struct _ill_if_s_ {
union ill_if_u *illif_next;
union ill_if_u *illif_prev;
avl_tree_t illif_avl_by_ppa;
vmem_t *illif_ppa_arena;
uint16_t illif_mcast_v1;
uint16_t illif_mcast_v2;
int illif_name_len;
char illif_name[LIFNAMSIZ];
};
typedef union ill_if_u {
struct _ill_if_s_ ill_if_s;
char illif_filler[CACHE_ALIGN(_ill_if_s_)];
} ill_if_t;
#define illif_next ill_if_s.illif_next
#define illif_prev ill_if_s.illif_prev
#define illif_avl_by_ppa ill_if_s.illif_avl_by_ppa
#define illif_ppa_arena ill_if_s.illif_ppa_arena
#define illif_mcast_v1 ill_if_s.illif_mcast_v1
#define illif_mcast_v2 ill_if_s.illif_mcast_v2
#define illif_name ill_if_s.illif_name
#define illif_name_len ill_if_s.illif_name_len
typedef struct ill_walk_context_s {
int ctx_current_list;
int ctx_last_list;
} ill_walk_context_t;
struct _ill_g_head_s_ {
ill_if_t *ill_g_list_head;
ill_if_t *ill_g_list_tail;
};
typedef union ill_g_head_u {
struct _ill_g_head_s_ ill_g_head_s;
char ill_g_head_filler[CACHE_ALIGN(_ill_g_head_s_)];
} ill_g_head_t;
#define ill_g_list_head ill_g_head_s.ill_g_list_head
#define ill_g_list_tail ill_g_head_s.ill_g_list_tail
#define IP_V4_ILL_G_LIST(ipst) \
(ipst)->ips_ill_g_heads[IP_V4_G_HEAD].ill_g_list_head
#define IP_V6_ILL_G_LIST(ipst) \
(ipst)->ips_ill_g_heads[IP_V6_G_HEAD].ill_g_list_head
#define IP_VX_ILL_G_LIST(i, ipst) \
(ipst)->ips_ill_g_heads[i].ill_g_list_head
#define ILL_START_WALK_V4(ctx_ptr, ipst) \
ill_first(IP_V4_G_HEAD, IP_V4_G_HEAD, ctx_ptr, ipst)
#define ILL_START_WALK_V6(ctx_ptr, ipst) \
ill_first(IP_V6_G_HEAD, IP_V6_G_HEAD, ctx_ptr, ipst)
#define ILL_START_WALK_ALL(ctx_ptr, ipst) \
ill_first(MAX_G_HEADS, MAX_G_HEADS, ctx_ptr, ipst)
#define ILL_CAPAB_LSO 0x04
#define ILL_CAPAB_HCKSUM 0x08
#define ILL_CAPAB_ZEROCOPY 0x10
#define ILL_CAPAB_DLD 0x20
#define ILL_CAPAB_DLD_POLL 0x40
#define ILL_CAPAB_DLD_DIRECT 0x80
typedef struct ill_hcksum_capab_s ill_hcksum_capab_t;
typedef struct ill_zerocopy_capab_s ill_zerocopy_capab_t;
typedef struct ill_dld_capab_s ill_dld_capab_t;
typedef struct ill_rx_ring ill_rx_ring_t;
typedef struct ill_lso_capab_s ill_lso_capab_t;
#define ILL_LL_SUBNET_PENDING 0x01
#define ILL_CONDEMNED 0x02
#define ILL_DL_UNBIND_IN_PROGRESS 0x04
#define ILL_DOWN_IN_PROGRESS 0x08
#define IS_USESRC_ILL(ill) \
(((ill)->ill_usesrc_ifindex == 0) && \
((ill)->ill_usesrc_grp_next != NULL))
#define IS_USESRC_CLI_ILL(ill) \
(((ill)->ill_usesrc_ifindex != 0) && \
((ill)->ill_usesrc_grp_next != NULL))
#define IS_VNI(ill) \
(((ill)->ill_phyint->phyint_flags & (PHYI_LOOPBACK|PHYI_VIRTUAL)) == \
PHYI_VIRTUAL)
#define IS_LOOPBACK(ill) \
((ill)->ill_phyint->phyint_flags & PHYI_LOOPBACK)
#define IS_IPMP(ill) \
((ill)->ill_phyint->phyint_flags & PHYI_IPMP)
#define IS_UNDER_IPMP(ill) \
((ill)->ill_grp != NULL && !IS_IPMP(ill))
#define IS_IN_SAME_ILLGRP(ill1, ill2) \
((ill1)->ill_grp != NULL && ((ill1)->ill_grp == (ill2)->ill_grp))
#define IS_ON_SAME_LAN(ill1, ill2) \
((ill1) == (ill2) || IS_IN_SAME_ILLGRP(ill1, ill2))
#define ILL_OTHER(ill) \
((ill)->ill_isv6 ? (ill)->ill_phyint->phyint_illv4 : \
(ill)->ill_phyint->phyint_illv6)
typedef struct ipmp_illgrp_s {
list_t ig_if;
list_t ig_actif;
uint_t ig_nactif;
struct ill_s *ig_next_ill;
struct ill_s *ig_ipmp_ill;
struct ill_s *ig_cast_ill;
list_t ig_arpent;
uint_t ig_mtu;
uint_t ig_mc_mtu;
} ipmp_illgrp_t;
typedef struct ipmp_grp_s {
char gr_name[LIFGRNAMSIZ];
char gr_ifname[LIFNAMSIZ];
t_uscalar_t gr_mactype;
phyint_t *gr_phyint;
uint_t gr_nif;
uint_t gr_nactif;
ipmp_illgrp_t *gr_v4;
ipmp_illgrp_t *gr_v6;
uint_t gr_nv4;
uint_t gr_nv6;
uint_t gr_pendv4;
uint_t gr_pendv6;
mblk_t *gr_linkdownmp;
kstat_t *gr_ksp;
uint64_t gr_kstats0[IPMP_KSTAT_MAX];
} ipmp_grp_t;
typedef struct ipmp_arpent_s {
ipaddr_t ia_ipaddr;
boolean_t ia_proxyarp;
boolean_t ia_notified;
list_node_t ia_node;
uint16_t ia_flags;
size_t ia_lladdr_len;
uchar_t *ia_lladdr;
} ipmp_arpent_t;
struct arl_s;
struct ill_hcksum_capab_s {
uint_t ill_hcksum_version;
uint_t ill_hcksum_txflags;
};
struct ill_zerocopy_capab_s {
uint_t ill_zerocopy_version;
uint_t ill_zerocopy_flags;
};
struct ill_lso_capab_s {
uint_t ill_lso_flags;
uint_t ill_lso_max_tcpv4;
uint_t ill_lso_max_tcpv6;
};
typedef struct ill_s {
pfillinput_t ill_inputfn;
ill_if_t *ill_ifptr;
queue_t *ill_rq;
queue_t *ill_wq;
int ill_error;
ipif_t *ill_ipif;
uint_t ill_ipif_up_count;
uint_t ill_max_frag;
uint_t ill_current_frag;
uint_t ill_mtu;
uint_t ill_mc_mtu;
uint_t ill_metric;
char *ill_name;
uint_t ill_ipif_dup_count;
uint_t ill_name_length;
uint_t ill_net_type;
uint_t ill_ppa;
t_uscalar_t ill_sap;
t_scalar_t ill_sap_length;
uint_t ill_phys_addr_length;
uint_t ill_bcast_addr_length;
t_uscalar_t ill_mactype;
uint8_t *ill_frag_ptr;
timeout_id_t ill_frag_timer_id;
ipfb_t *ill_frag_hash_tbl;
krwlock_t ill_mcast_lock;
kmutex_t ill_mcast_serializer;
ilm_t *ill_ilm;
uint_t ill_global_timer;
int ill_mcast_type;
uint16_t ill_mcast_v1_time;
uint16_t ill_mcast_v2_time;
uint8_t ill_mcast_v1_tset;
uint8_t ill_mcast_v2_tset;
uint8_t ill_mcast_rv;
int ill_mcast_qi;
#define ill_first_mp_to_free ill_bcast_mp
mblk_t *ill_bcast_mp;
mblk_t *ill_unbind_mp;
mblk_t *ill_promiscoff_mp;
mblk_t *ill_dlpi_deferred;
mblk_t *ill_dest_addr_mp;
mblk_t *ill_replumb_mp;
mblk_t *ill_phys_addr_mp;
mblk_t *ill_mcast_deferred;
#define ill_last_mp_to_free ill_mcast_deferred
cred_t *ill_credp;
uint8_t *ill_phys_addr;
uint8_t *ill_dest_addr;
uint_t ill_state_flags;
uint_t
ill_needs_attach : 1,
ill_reserved : 1,
ill_isv6 : 1,
ill_dlpi_style_set : 1,
ill_ifname_pending : 1,
ill_logical_down : 1,
ill_dl_up : 1,
ill_up_ipifs : 1,
ill_note_link : 1,
ill_capab_reneg : 1,
ill_dld_capab_inprog : 1,
ill_need_recover_multicast : 1,
ill_replumbing : 1,
ill_arl_dlpi_pending : 1,
ill_grp_pending : 1,
ill_pad_to_bit_31 : 17;
uint_t
ill_fragtimer_executing : 1,
ill_fragtimer_needrestart : 1,
ill_manual_token : 1,
ill_manual_linklocal : 1,
ill_manual_dst_linklocal : 1,
ill_mcast_ncec_cleanup : 1,
ill_pad_bit_31 : 26;
int ill_muxid;
uint_t ill_ipf_gen;
uint_t ill_frag_count;
uint_t ill_frag_free_num_pkts;
clock_t ill_last_frag_clean_time;
int ill_type;
uint_t ill_dlpi_multicast_state;
uint_t ill_dlpi_fastpath_state;
uint_t ill_dlpi_capab_state;
uint_t ill_capab_pending_cnt;
uint64_t ill_capabilities;
ill_hcksum_capab_t *ill_hcksum_capab;
ill_zerocopy_capab_t *ill_zerocopy_capab;
ill_dld_capab_t *ill_dld_capab;
ill_lso_capab_t *ill_lso_capab;
mblk_t *ill_capab_reset_mp;
uint8_t ill_max_hops;
uint_t ill_user_mtu;
uint32_t ill_reachable_time;
uint32_t ill_reachable_retrans_time;
uint_t ill_max_buf;
in6_addr_t ill_token;
in6_addr_t ill_dest_token;
uint_t ill_token_length;
uint32_t ill_xmit_count;
mib2_ipIfStatsEntry_t *ill_ip_mib;
mib2_ipv6IfIcmpEntry_t *ill_icmp6_mib;
phyint_t *ill_phyint;
uint64_t ill_flags;
kmutex_t ill_lock;
mblk_t *ill_nd_lla_mp;
uint8_t *ill_nd_lla;
uint_t ill_nd_lla_len;
t_uscalar_t ill_phys_addr_pend;
uint_t ill_ifname_pending_err;
avl_node_t ill_avl_byppa;
uint_t ill_mcast_nces;
list_t ill_nce;
uint_t ill_refcnt;
uint_t ill_ire_cnt;
kcondvar_t ill_cv;
uint_t ill_ncec_cnt;
uint_t ill_nce_cnt;
uint_t ill_waiters;
queue_t *ill_lmod_rq;
uint_t ill_lmod_cnt;
ip_m_t *ill_media;
t_uscalar_t ill_dlpi_pending;
uint_t ill_usesrc_ifindex;
struct ill_s *ill_usesrc_grp_next;
boolean_t ill_trace_disable;
zoneid_t ill_zoneid;
ip_stack_t *ill_ipst;
uint32_t ill_dhcpinit;
void *ill_flownotify_mh;
uint_t ill_ilm_cnt;
uint_t ill_ipallmulti_cnt;
ilm_t *ill_ipallmulti_ilm;
mblk_t *ill_saved_ire_mp;
kmutex_t ill_saved_ire_lock;
uint_t ill_saved_ire_cnt;
struct arl_ill_common_s *ill_common;
ire_t *ill_ire_multicast;
clock_t ill_defend_start;
uint_t ill_defend_count;
ipmp_illgrp_t *ill_grp;
list_node_t ill_actnode;
list_node_t ill_grpnode;
ipif_t *ill_src_ipif;
ipif_t *ill_move_ipif;
boolean_t ill_nom_cast;
uint_t ill_bound_cnt;
ipif_t *ill_bound_ipif;
timeout_id_t ill_refresh_tid;
uint32_t ill_mrouter_cnt;
uint32_t ill_allowed_ips_cnt;
in6_addr_t *ill_allowed_ips;
multiphysaddr_t *ill_mphysaddr_list;
} ill_t;
#define ILL_FREE_OK(ill) \
((ill)->ill_ire_cnt == 0 && (ill)->ill_ilm_cnt == 0 && \
(ill)->ill_ncec_cnt == 0 && (ill)->ill_nce_cnt == 0)
#define ILL_DOWN_OK(ill) \
(ill->ill_ire_cnt == 0 && ill->ill_ncec_cnt == 0 && \
ill->ill_nce_cnt == 0)
struct ip_ioctl_cmd_s;
typedef int (*ifunc_t)(ipif_t *, struct sockaddr_in *, queue_t *, mblk_t *,
struct ip_ioctl_cmd_s *, void *);
typedef struct ip_ioctl_cmd_s {
int ipi_cmd;
size_t ipi_copyin_size;
uint_t ipi_flags;
uint_t ipi_cmd_type;
ifunc_t ipi_func;
ifunc_t ipi_func_restart;
} ip_ioctl_cmd_t;
enum { IF_CMD = 1, LIF_CMD, ARP_CMD, XARP_CMD, MSFILT_CMD, MISC_CMD };
#define IPI_DONTCARE 0
#define IPI_PRIV 0x1
#define IPI_MODOK 0x2
#define IPI_WR 0x4
#define IPI_GET_CMD 0x8
#define IPI_NULL_BCONT 0x20
extern ip_ioctl_cmd_t ip_ndx_ioctl_table[];
extern ip_ioctl_cmd_t ip_misc_ioctl_table[];
extern int ip_ndx_ioctl_count;
extern int ip_misc_ioctl_count;
typedef struct ipmx_s {
char ipmx_name[LIFNAMSIZ];
uint_t
ipmx_arpdev_stream : 1,
ipmx_notused : 31;
} ipmx_t;
#define IDS_UNKNOWN 0
#define IDS_INPROGRESS 1
#define IDS_OK 2
#define IDS_FAILED 3
enum {
IDCS_UNKNOWN,
IDCS_PROBE_SENT,
IDCS_OK,
IDCS_RESET_SENT,
IDCS_RENEG,
IDCS_FAILED
};
typedef struct ipndp_s {
ndgetf_t ip_ndp_getf;
ndsetf_t ip_ndp_setf;
caddr_t ip_ndp_data;
char *ip_ndp_name;
} ipndp_t;
typedef enum {
IXAN_LSO,
IXAN_PMTU,
IXAN_ZCOPY
} ixa_notify_type_t;
typedef uint_t ixa_notify_arg_t;
typedef void (*ixa_notify_t)(void *, ip_xmit_attr_t *ixa, ixa_notify_type_t,
ixa_notify_arg_t);
#define IAF_IS_IPV4 0x80000000
#define IAF_TRUSTED_ICMP 0x40000000
#define IAF_NO_LOOP_ZONEID_SET 0x20000000
#define IAF_LOOPBACK_COPY 0x10000000
#define IAF_MASK 0xf0000000
struct ip_xmit_attr_s {
iaflags_t ixa_flags;
uint32_t ixa_free_flags;
uint32_t ixa_refcnt;
uint32_t ixa_xmit_hint;
uint_t ixa_pktlen;
zoneid_t ixa_zoneid;
ire_t *ixa_ire;
uint_t ixa_ire_generation;
nce_t *ixa_nce;
dce_t *ixa_dce;
uint_t ixa_dce_generation;
uint_t ixa_src_generation;
uint32_t ixa_src_preferences;
uint32_t ixa_pmtu;
uint32_t ixa_fragsize;
int8_t ixa_use_min_mtu;
pfirepostfrag_t ixa_postfragfn;
in6_addr_t ixa_nexthop_v6;
#define ixa_nexthop_v4 V4_PART_OF_V6(ixa_nexthop_v6)
zoneid_t ixa_no_loop_zoneid;
uint_t ixa_scopeid;
uint_t ixa_broadcast_ttl;
uint_t ixa_multicast_ttl;
uint_t ixa_multicast_ifindex;
ipaddr_t ixa_multicast_ifaddr;
int ixa_raw_cksum_offset;
uint32_t ixa_ident;
uint64_t ixa_conn_id;
ill_lso_capab_t ixa_lso_capab;
uint64_t ixa_ipsec_policy_gen;
ipsec_latch_t *ixa_ipsec_latch;
struct ipsa_s *ixa_ipsec_ah_sa;
struct ipsa_s *ixa_ipsec_esp_sa;
struct ipsec_policy_s *ixa_ipsec_policy;
struct ipsec_action_s *ixa_ipsec_action;
ipsa_ref_t ixa_ipsec_ref[2];
uint16_t ixa_ipsec_src_port;
uint16_t ixa_ipsec_dst_port;
uint8_t ixa_ipsec_icmp_type;
uint8_t ixa_ipsec_icmp_code;
sa_family_t ixa_ipsec_inaf;
#define IXA_MAX_ADDRLEN 4
uint32_t ixa_ipsec_insrc[IXA_MAX_ADDRLEN];
uint32_t ixa_ipsec_indst[IXA_MAX_ADDRLEN];
uint8_t ixa_ipsec_insrcpfx;
uint8_t ixa_ipsec_indstpfx;
uint8_t ixa_ipsec_proto;
uint_t ixa_ifindex;
uint16_t ixa_ip_hdr_length;
uint8_t ixa_protocol;
ts_label_t *ixa_tsl;
ip_stack_t *ixa_ipst;
uint32_t ixa_extra_ident;
cred_t *ixa_cred;
pid_t ixa_cpid;
#ifdef DEBUG
kthread_t *ixa_curthread;
#endif
squeue_t *ixa_sqp;
uintptr_t ixa_cookie;
ixa_notify_t ixa_notify;
void *ixa_notify_cookie;
uint_t ixa_tcpcleanup;
};
#define IXAF_REACH_CONF 0x00000001
#define IXAF_BROADCAST_TTL_SET 0x00000002
#define IXAF_SET_SOURCE 0x00000004
#define IXAF_USE_MIN_MTU 0x00000008
#define IXAF_DONTFRAG 0x00000010
#define IXAF_VERIFY_PMTU 0x00000020
#define IXAF_PMTU_DISCOVERY 0x00000040
#define IXAF_MULTICAST_LOOP 0x00000080
#define IXAF_IPSEC_SECURE 0x00000100
#define IXAF_UCRED_TSL 0x00000200
#define IXAF_DONTROUTE 0x00000400
#define IXAF_NO_IPSEC 0x00000800
#define IXAF_PMTU_TOO_SMALL 0x00001000
#define IXAF_SET_ULP_CKSUM 0x00002000
#define IXAF_VERIFY_SOURCE 0x00004000
#define IXAF_NEXTHOP_SET 0x00008000
#define IXAF_PMTU_IPV4_DF 0x00010000
#define IXAF_NO_DEV_FLOW_CTL 0x00020000
#define IXAF_NO_TTL_CHANGE 0x00040000
#define IXAF_IPV6_ADD_FRAGHDR 0x00080000
#define IXAF_IPSEC_TUNNEL 0x00100000
#define IXAF_NO_PFHOOK 0x00200000
#define IXAF_NO_TRACE 0x00400000
#define IXAF_SCOPEID_SET 0x00800000
#define IXAF_MULTIRT_MULTICAST 0x01000000
#define IXAF_NO_HW_CKSUM 0x02000000
#define IXAF_SET_RAW_CKSUM 0x04000000
#define IXAF_IPSEC_GLOBAL_POLICY 0x08000000
#define IXAF_IS_IPV4 IAF_IS_IPV4
#define IXAF_TRUSTED_ICMP IAF_TRUSTED_ICMP
#define IXAF_NO_LOOP_ZONEID_SET IAF_NO_LOOP_ZONEID_SET
#define IXAF_LOOPBACK_COPY IAF_LOOPBACK_COPY
#define IXAF_VERIFY_LSO 0x100000000
#define IXAF_LSO_CAPAB 0x200000000
#define IXAF_VERIFY_ZCOPY 0x400000000
#define IXAF_ZCOPY_CAPAB 0x800000000
#define IXAF_BASIC_SIMPLE_V4 \
(IXAF_SET_ULP_CKSUM | IXAF_IS_IPV4 | IXAF_VERIFY_SOURCE)
#define IXAF_BASIC_SIMPLE_V6 (IXAF_SET_ULP_CKSUM | IXAF_VERIFY_SOURCE)
#define IXA_FREE_CRED 0x00000001
#define IXA_FREE_TSL 0x00000002
#define IXATC_IDLE 0x00000000
#define IXATC_INPROGRESS 0x00000001
#define IXATC_COMPLETE 0x00000002
#define CONN_TO_XMIT_HINT(connp) ((uint32_t)(((uintptr_t)connp) >> 11))
#define ILL_RING_TO_XMIT_HINT(ring) ((uint32_t)(((uintptr_t)ring) >> 7))
#define IPDF_ALLOW_MCBC 0x1
#define IPDF_VERIFY_DST 0x2
#define IPDF_SELECT_SRC 0x4
#define IPDF_LSO 0x8
#define IPDF_IPSEC 0x10
#define IPDF_ZONE_IS_GLOBAL 0x20
#define IPDF_ZCOPY 0x40
#define IPDF_UNIQUE_DCE 0x80
struct ip_recv_attr_s {
iaflags_t ira_flags;
uint32_t ira_free_flags;
squeue_t *ira_sqp;
ill_rx_ring_t *ira_ring;
squeue_t *ira_target_sqp;
mblk_t *ira_target_sqp_mp;
uint32_t ira_xmit_hint;
zoneid_t ira_zoneid;
uint_t ira_pktlen;
uint16_t ira_ip_hdr_length;
uint8_t ira_protocol;
uint8_t ira_ttl;
uint_t ira_rifindex;
uint_t ira_ruifindex;
ts_label_t *ira_tsl;
ill_t *ira_rill;
ill_t *ira_ill;
cred_t *ira_cred;
pid_t ira_cpid;
ipaddr_t ira_verified_src;
struct ipsec_action_s *ira_ipsec_action;
struct ipsa_s *ira_ipsec_ah_sa;
struct ipsa_s *ira_ipsec_esp_sa;
ipaddr_t ira_mroute_tunnel;
zoneid_t ira_no_loop_zoneid;
uint32_t ira_esp_udp_ports;
#define IRA_L2SRC_SIZE 244
uint8_t ira_l2src[IRA_L2SRC_SIZE];
struct mac_header_info_s *ira_mhip;
};
#define IRAF_SYSTEM_LABELED 0x00000001
#define IRAF_IPV4_OPTIONS 0x00000002
#define IRAF_MULTICAST 0x00000004
#define IRAF_BROADCAST 0x00000008
#define IRAF_MULTIBROADCAST (IRAF_MULTICAST|IRAF_BROADCAST)
#define IRAF_LOOPBACK 0x00000010
#define IRAF_VERIFY_IP_CKSUM 0x00000020
#define IRAF_VERIFY_ULP_CKSUM 0x00000040
#define IRAF_SCTP_CSUM_ERR 0x00000080
#define IRAF_IPSEC_SECURE 0x00000100
#define IRAF_DHCP_UNICAST 0x00000200
#define IRAF_IPSEC_DECAPS 0x00000400
#define IRAF_TARGET_SQP 0x00000800
#define IRAF_VERIFIED_SRC 0x00001000
#define IRAF_RSVP 0x00002000
#define IRAF_MROUTE_TUNNEL_SET 0x00004000
#define IRAF_PIM_REGISTER 0x00008000
#define IRAF_TX_MAC_EXEMPTABLE 0x00010000
#define IRAF_TX_SHARED_ADDR 0x00020000
#define IRAF_ESP_UDP_PORTS 0x00040000
#define IRAF_NO_HW_CKSUM 0x00080000
#define IRAF_ICMP_ERROR 0x00100000
#define IRAF_ROUTER_ALERT 0x00200000
#define IRAF_L2SRC_SET 0x00400000
#define IRAF_L2SRC_LOOPBACK 0x00800000
#define IRAF_L2DST_MULTICAST 0x01000000
#define IRAF_L2DST_BROADCAST 0x02000000
#define IRAF_IS_IPV4 IAF_IS_IPV4
#define IRAF_TRUSTED_ICMP IAF_TRUSTED_ICMP
#define IRAF_NO_LOOP_ZONEID_SET IAF_NO_LOOP_ZONEID_SET
#define IRAF_LOOPBACK_COPY IAF_LOOPBACK_COPY
#define IRA_FREE_CRED 0x00000001
#define IRA_FREE_TSL 0x00000002
struct dce_s {
uint_t dce_generation;
uint_t dce_flags;
uint_t dce_ipversion;
uint32_t dce_pmtu;
uint32_t dce_ident;
iulp_t dce_uinfo;
struct dce_s *dce_next;
struct dce_s **dce_ptpn;
struct dcb_s *dce_bucket;
union {
in6_addr_t dceu_v6addr;
ipaddr_t dceu_v4addr;
} dce_u;
#define dce_v4addr dce_u.dceu_v4addr
#define dce_v6addr dce_u.dceu_v6addr
uint_t dce_ifindex;
kmutex_t dce_lock;
uint_t dce_refcnt;
uint64_t dce_last_change_time;
ip_stack_t *dce_ipst;
};
#define DCE_GENERATION_CONDEMNED 0
#define DCE_GENERATION_VERIFY 1
#define DCE_GENERATION_INITIAL 2
#define DCE_IS_CONDEMNED(dce) \
((dce)->dce_generation == DCE_GENERATION_CONDEMNED)
#define SRC_GENERATION_VERIFY 0
#define SRC_GENERATION_INITIAL 1
struct tsol_gcgrp_s;
extern uchar_t ip6opt_ls;
typedef struct tsol_gcdb_s {
uint_t gcdb_refcnt;
struct rtsa_s gcdb_attr;
#define gcdb_mask gcdb_attr.rtsa_mask
#define gcdb_doi gcdb_attr.rtsa_doi
#define gcdb_slrange gcdb_attr.rtsa_slrange
} tsol_gcdb_t;
typedef struct tsol_gc_s {
uint_t gc_refcnt;
struct tsol_gcgrp_s *gc_grp;
struct tsol_gc_s *gc_prev;
struct tsol_gc_s *gc_next;
tsol_gcdb_t *gc_db;
} tsol_gc_t;
typedef struct tsol_gcgrp_addr_s {
int ga_af;
in6_addr_t ga_addr;
} tsol_gcgrp_addr_t;
typedef struct tsol_gcgrp_s {
uint_t gcgrp_refcnt;
krwlock_t gcgrp_rwlock;
uint_t gcgrp_count;
tsol_gc_t *gcgrp_head;
tsol_gc_t *gcgrp_tail;
tsol_gcgrp_addr_t gcgrp_addr;
} tsol_gcgrp_t;
extern kmutex_t gcgrp_lock;
#define GC_REFRELE(p) { \
ASSERT((p)->gc_grp != NULL); \
rw_enter(&(p)->gc_grp->gcgrp_rwlock, RW_WRITER); \
ASSERT((p)->gc_refcnt > 0); \
if (--((p)->gc_refcnt) == 0) \
gc_inactive(p); \
else \
rw_exit(&(p)->gc_grp->gcgrp_rwlock); \
}
#define GCGRP_REFHOLD(p) { \
mutex_enter(&gcgrp_lock); \
++((p)->gcgrp_refcnt); \
ASSERT((p)->gcgrp_refcnt != 0); \
mutex_exit(&gcgrp_lock); \
}
#define GCGRP_REFRELE(p) { \
mutex_enter(&gcgrp_lock); \
ASSERT((p)->gcgrp_refcnt > 0); \
if (--((p)->gcgrp_refcnt) == 0) \
gcgrp_inactive(p); \
ASSERT(MUTEX_HELD(&gcgrp_lock)); \
mutex_exit(&gcgrp_lock); \
}
struct tsol_tnrhc;
struct tsol_ire_gw_secattr_s {
kmutex_t igsa_lock;
struct tsol_tnrhc *igsa_rhc;
tsol_gc_t *igsa_gc;
};
void irb_refrele_ftable(irb_t *);
extern struct kmem_cache *rt_entry_cache;
typedef struct ire4 {
ipaddr_t ire4_mask;
ipaddr_t ire4_addr;
ipaddr_t ire4_gateway_addr;
ipaddr_t ire4_setsrc_addr;
} ire4_t;
typedef struct ire6 {
in6_addr_t ire6_mask;
in6_addr_t ire6_addr;
in6_addr_t ire6_gateway_addr;
in6_addr_t ire6_setsrc_addr;
} ire6_t;
typedef union ire_addr {
ire6_t ire6_u;
ire4_t ire4_u;
} ire_addr_u_t;
struct ire_s {
struct ire_s *ire_next;
struct ire_s **ire_ptpn;
uint32_t ire_refcnt;
ill_t *ire_ill;
uint32_t ire_identical_ref;
uchar_t ire_ipversion;
ushort_t ire_type;
uint_t ire_generation;
uint_t ire_ib_pkt_count;
uint_t ire_ob_pkt_count;
time_t ire_create_time;
uint32_t ire_flags;
boolean_t ire_testhidden;
pfirerecv_t ire_recvfn;
pfiresend_t ire_sendfn;
pfirepostfrag_t ire_postfragfn;
uint_t ire_masklen;
ire_addr_u_t ire_u;
irb_t *ire_bucket;
kmutex_t ire_lock;
clock_t ire_last_used_time;
tsol_ire_gw_secattr_t *ire_gw_secattr;
zoneid_t ire_zoneid;
nce_t *ire_nce_cache;
boolean_t ire_nce_capable;
ire_t *ire_dep_parent;
ire_t *ire_dep_children;
ire_t *ire_dep_sib_next;
ire_t **ire_dep_sib_ptpn;
uint_t ire_dep_parent_generation;
uint_t ire_badcnt;
uint64_t ire_last_badcnt;
uint_t ire_defense_count;
uint_t ire_defense_time;
boolean_t ire_trace_disable;
ip_stack_t *ire_ipst;
iulp_t ire_metrics;
boolean_t ire_unbound;
};
#define ire_mask ire_u.ire4_u.ire4_mask
#define ire_addr ire_u.ire4_u.ire4_addr
#define ire_gateway_addr ire_u.ire4_u.ire4_gateway_addr
#define ire_setsrc_addr ire_u.ire4_u.ire4_setsrc_addr
#define ire_mask_v6 ire_u.ire6_u.ire6_mask
#define ire_addr_v6 ire_u.ire6_u.ire6_addr
#define ire_gateway_addr_v6 ire_u.ire6_u.ire6_gateway_addr
#define ire_setsrc_addr_v6 ire_u.ire6_u.ire6_setsrc_addr
#define IRE_GENERATION_CONDEMNED 0
#define IRE_GENERATION_VERIFY 1
#define IRE_GENERATION_INITIAL 2
#define IRE_IS_CONDEMNED(ire) \
((ire)->ire_generation == IRE_GENERATION_CONDEMNED)
typedef struct sockaddr_in sin_t;
typedef struct sockaddr_in6 sin6_t;
typedef struct nv_s {
uint64_t nv_value;
char *nv_name;
} nv_t;
#define ILL_FRAG_HASH(s, i) \
((ntohl(s) ^ ((i) ^ ((i) >> 8))) % ILL_FRAG_HASH_TBL_COUNT)
#define COMMON_IP_MTU 1500
#define MAX_FRAG_MIN 10
#define MAX_FRAG_PKTS(ipst) \
MAX(MAX_FRAG_MIN, (2 * (ipst->ips_ip_reass_queue_bytes / \
(COMMON_IP_MTU * ILL_FRAG_HASH_TBL_COUNT))))
extern uint_t ip_max_frag_dups;
struct ip_pkt_s {
uint_t ipp_fields;
in6_addr_t ipp_addr;
#define ipp_addr_v4 V4_PART_OF_V6(ipp_addr)
uint_t ipp_unicast_hops;
uint_t ipp_hoplimit;
uint_t ipp_hopoptslen;
uint_t ipp_rthdrdstoptslen;
uint_t ipp_rthdrlen;
uint_t ipp_dstoptslen;
uint_t ipp_fraghdrlen;
ip6_hbh_t *ipp_hopopts;
ip6_dest_t *ipp_rthdrdstopts;
ip6_rthdr_t *ipp_rthdr;
ip6_dest_t *ipp_dstopts;
ip6_frag_t *ipp_fraghdr;
uint8_t ipp_tclass;
uint8_t ipp_type_of_service;
uint_t ipp_ipv4_options_len;
uint8_t *ipp_ipv4_options;
uint_t ipp_label_len_v4;
uint8_t *ipp_label_v4;
uint_t ipp_label_len_v6;
uint8_t *ipp_label_v6;
};
typedef struct ip_pkt_s ip_pkt_t;
extern void ip_pkt_free(ip_pkt_t *);
extern ipaddr_t ip_pkt_source_route_v4(const ip_pkt_t *);
extern in6_addr_t *ip_pkt_source_route_v6(const ip_pkt_t *);
extern int ip_pkt_copy(ip_pkt_t *, ip_pkt_t *, int);
extern void ip_pkt_source_route_reverse_v4(ip_pkt_t *);
#define IPPF_ADDR 0x0001
#define IPPF_HOPLIMIT 0x0002
#define IPPF_TCLASS 0x0004
#define IPPF_HOPOPTS 0x0010
#define IPPF_RTHDR 0x0020
#define IPPF_RTHDRDSTOPTS 0x0040
#define IPPF_DSTOPTS 0x0080
#define IPPF_IPV4_OPTIONS 0x0100
#define IPPF_LABEL_V4 0x0200
#define IPPF_LABEL_V6 0x0400
#define IPPF_FRAGHDR 0x0800
typedef struct conn_opt_arg_s {
conn_t *coa_connp;
ip_xmit_attr_t *coa_ixa;
ip_pkt_t *coa_ipp;
boolean_t coa_ancillary;
uint_t coa_changed;
} conn_opt_arg_t;
#define COA_HEADER_CHANGED 0x0001
#define COA_ROUTE_CHANGED 0x0002
#define COA_RCVBUF_CHANGED 0x0004
#define COA_SNDBUF_CHANGED 0x0008
#define COA_WROFF_CHANGED 0x0010
#define COA_ICMP_BIND_NEEDED 0x0020
#define COA_OOBINLINE_CHANGED 0x0040
#define TCP_PORTS_OFFSET 0
#define UDP_PORTS_OFFSET 0
#define ILL_LOOKUP_FAILED 1
#define IPIF_LOOKUP_FAILED 2
#define ILL_CAN_LOOKUP(ill) \
(!((ill)->ill_state_flags & ILL_CONDEMNED) || \
IAM_WRITER_ILL(ill))
#define ILL_IS_CONDEMNED(ill) \
((ill)->ill_state_flags & ILL_CONDEMNED)
#define IPIF_CAN_LOOKUP(ipif) \
(!((ipif)->ipif_state_flags & IPIF_CONDEMNED) || \
IAM_WRITER_IPIF(ipif))
#define IPIF_IS_CONDEMNED(ipif) \
((ipif)->ipif_state_flags & IPIF_CONDEMNED)
#define IPIF_IS_CHANGING(ipif) \
((ipif)->ipif_state_flags & IPIF_CHANGING)
#define IAM_WRITER_IPSQ(ipsq) ((ipsq)->ipsq_xop->ipx_writer == curthread)
#define IAM_WRITER_ILL(ill) IAM_WRITER_IPSQ((ill)->ill_phyint->phyint_ipsq)
#define IAM_WRITER_IPIF(ipif) IAM_WRITER_ILL((ipif)->ipif_ill)
#define GRAB_ILL_LOCKS(ill_1, ill_2) \
{ \
if ((ill_1) > (ill_2)) { \
if (ill_1 != NULL) \
mutex_enter(&(ill_1)->ill_lock); \
if (ill_2 != NULL) \
mutex_enter(&(ill_2)->ill_lock); \
} else { \
if (ill_2 != NULL) \
mutex_enter(&(ill_2)->ill_lock); \
if (ill_1 != NULL && ill_1 != ill_2) \
mutex_enter(&(ill_1)->ill_lock); \
} \
}
#define RELEASE_ILL_LOCKS(ill_1, ill_2) \
{ \
if (ill_1 != NULL) \
mutex_exit(&(ill_1)->ill_lock); \
if (ill_2 != NULL && ill_2 != ill_1) \
mutex_exit(&(ill_2)->ill_lock); \
}
#define ILL_OTHER(ill) \
((ill)->ill_isv6 ? (ill)->ill_phyint->phyint_illv4 : \
(ill)->ill_phyint->phyint_illv6)
typedef struct cmd_info_s
{
ipif_t *ci_ipif;
sin_t *ci_sin;
sin6_t *ci_sin6;
struct lifreq *ci_lifr;
} cmd_info_t;
extern struct kmem_cache *ire_cache;
extern ipaddr_t ip_g_all_ones;
extern uint_t ip_loopback_mtu;
extern uint_t ip_loopback_mtuplus;
extern uint_t ip_loopback_mtu_v6plus;
extern vmem_t *ip_minor_arena_sa;
extern vmem_t *ip_minor_arena_la;
#define ips_ip_respond_to_address_mask_broadcast \
ips_propinfo_tbl[0].prop_cur_bval
#define ips_ip_g_resp_to_echo_bcast ips_propinfo_tbl[1].prop_cur_bval
#define ips_ip_g_resp_to_echo_mcast ips_propinfo_tbl[2].prop_cur_bval
#define ips_ip_g_resp_to_timestamp ips_propinfo_tbl[3].prop_cur_bval
#define ips_ip_g_resp_to_timestamp_bcast ips_propinfo_tbl[4].prop_cur_bval
#define ips_ip_g_send_redirects ips_propinfo_tbl[5].prop_cur_bval
#define ips_ip_g_forward_directed_bcast ips_propinfo_tbl[6].prop_cur_bval
#define ips_ip_mrtdebug ips_propinfo_tbl[7].prop_cur_uval
#define ips_ip_ire_reclaim_fraction ips_propinfo_tbl[8].prop_cur_uval
#define ips_ip_nce_reclaim_fraction ips_propinfo_tbl[9].prop_cur_uval
#define ips_ip_dce_reclaim_fraction ips_propinfo_tbl[10].prop_cur_uval
#define ips_ip_def_ttl ips_propinfo_tbl[11].prop_cur_uval
#define ips_ip_forward_src_routed ips_propinfo_tbl[12].prop_cur_bval
#define ips_ip_wroff_extra ips_propinfo_tbl[13].prop_cur_uval
#define ips_ip_pathmtu_interval ips_propinfo_tbl[14].prop_cur_uval
#define ips_ip_icmp_return ips_propinfo_tbl[15].prop_cur_uval
#define ips_ip_path_mtu_discovery ips_propinfo_tbl[16].prop_cur_bval
#define ips_ip_pmtu_min ips_propinfo_tbl[17].prop_cur_uval
#define ips_ip_ignore_redirect ips_propinfo_tbl[18].prop_cur_bval
#define ips_ip_arp_icmp_error ips_propinfo_tbl[19].prop_cur_bval
#define ips_ip_broadcast_ttl ips_propinfo_tbl[20].prop_cur_uval
#define ips_ip_icmp_err_interval ips_propinfo_tbl[21].prop_cur_uval
#define ips_ip_icmp_err_burst ips_propinfo_tbl[22].prop_cur_uval
#define ips_ip_reass_queue_bytes ips_propinfo_tbl[23].prop_cur_uval
#define ips_ip_strict_dst_multihoming ips_propinfo_tbl[24].prop_cur_uval
#define ips_ip_addrs_per_if ips_propinfo_tbl[25].prop_cur_uval
#define ips_ipsec_override_persocket_policy ips_propinfo_tbl[26].prop_cur_bval
#define ips_icmp_accept_clear_messages ips_propinfo_tbl[27].prop_cur_bval
#define ips_igmp_accept_clear_messages ips_propinfo_tbl[28].prop_cur_bval
#define ips_delay_first_probe_time ips_propinfo_tbl[29].prop_cur_uval
#define ips_max_unicast_solicit ips_propinfo_tbl[30].prop_cur_uval
#define ips_ipv6_def_hops ips_propinfo_tbl[31].prop_cur_uval
#define ips_ipv6_icmp_return ips_propinfo_tbl[32].prop_cur_uval
#define ips_ipv6_forward_src_routed ips_propinfo_tbl[33].prop_cur_bval
#define ips_ipv6_resp_echo_mcast ips_propinfo_tbl[34].prop_cur_bval
#define ips_ipv6_send_redirects ips_propinfo_tbl[35].prop_cur_bval
#define ips_ipv6_ignore_redirect ips_propinfo_tbl[36].prop_cur_bval
#define ips_ipv6_strict_dst_multihoming ips_propinfo_tbl[37].prop_cur_uval
#define ips_src_check ips_propinfo_tbl[38].prop_cur_uval
#define ips_ipsec_policy_log_interval ips_propinfo_tbl[39].prop_cur_uval
#define ips_pim_accept_clear_messages ips_propinfo_tbl[40].prop_cur_bval
#define ips_ip_ndp_unsolicit_interval ips_propinfo_tbl[41].prop_cur_uval
#define ips_ip_ndp_unsolicit_count ips_propinfo_tbl[42].prop_cur_uval
#define ips_ipv6_ignore_home_address_opt ips_propinfo_tbl[43].prop_cur_bval
#define ips_ip_policy_mask ips_propinfo_tbl[44].prop_cur_uval
#define ips_ip_ecmp_behavior ips_propinfo_tbl[45].prop_cur_uval
#define ips_ip_multirt_ttl ips_propinfo_tbl[46].prop_cur_uval
#define ips_ip_ire_badcnt_lifetime ips_propinfo_tbl[47].prop_cur_uval
#define ips_ip_max_temp_idle ips_propinfo_tbl[48].prop_cur_uval
#define ips_ip_max_temp_defend ips_propinfo_tbl[49].prop_cur_uval
#define ips_ip_max_defend ips_propinfo_tbl[50].prop_cur_uval
#define ips_ip_defend_interval ips_propinfo_tbl[51].prop_cur_uval
#define ips_ip_dup_recovery ips_propinfo_tbl[52].prop_cur_uval
#define ips_ip_restrict_interzone_loopback ips_propinfo_tbl[53].prop_cur_bval
#define ips_ip_lso_outbound ips_propinfo_tbl[54].prop_cur_bval
#define ips_igmp_max_version ips_propinfo_tbl[55].prop_cur_uval
#define ips_mld_max_version ips_propinfo_tbl[56].prop_cur_uval
#define ips_ip_forwarding ips_propinfo_tbl[57].prop_cur_bval
#define ips_ipv6_forwarding ips_propinfo_tbl[58].prop_cur_bval
#define ips_ip_reassembly_timeout ips_propinfo_tbl[59].prop_cur_uval
#define ips_ipv6_reassembly_timeout ips_propinfo_tbl[60].prop_cur_uval
#define ips_ip_cgtp_filter ips_propinfo_tbl[61].prop_cur_bval
#define ips_arp_probe_delay ips_propinfo_tbl[62].prop_cur_uval
#define ips_arp_fastprobe_delay ips_propinfo_tbl[63].prop_cur_uval
#define ips_arp_probe_interval ips_propinfo_tbl[64].prop_cur_uval
#define ips_arp_fastprobe_interval ips_propinfo_tbl[65].prop_cur_uval
#define ips_arp_probe_count ips_propinfo_tbl[66].prop_cur_uval
#define ips_arp_fastprobe_count ips_propinfo_tbl[67].prop_cur_uval
#define ips_ipv4_dad_announce_interval ips_propinfo_tbl[68].prop_cur_uval
#define ips_ipv6_dad_announce_interval ips_propinfo_tbl[69].prop_cur_uval
#define ips_arp_defend_interval ips_propinfo_tbl[70].prop_cur_uval
#define ips_arp_defend_rate ips_propinfo_tbl[71].prop_cur_uval
#define ips_ndp_defend_interval ips_propinfo_tbl[72].prop_cur_uval
#define ips_ndp_defend_rate ips_propinfo_tbl[73].prop_cur_uval
#define ips_arp_defend_period ips_propinfo_tbl[74].prop_cur_uval
#define ips_ndp_defend_period ips_propinfo_tbl[75].prop_cur_uval
#define ips_ipv4_icmp_return_pmtu ips_propinfo_tbl[76].prop_cur_bval
#define ips_ipv6_icmp_return_pmtu ips_propinfo_tbl[77].prop_cur_bval
#define ips_ip_arp_publish_count ips_propinfo_tbl[78].prop_cur_uval
#define ips_ip_arp_publish_interval ips_propinfo_tbl[79].prop_cur_uval
#define ips_ip_strict_src_multihoming ips_propinfo_tbl[80].prop_cur_uval
#define ips_ipv6_strict_src_multihoming ips_propinfo_tbl[81].prop_cur_uval
#define ips_ipv6_drop_inbound_icmpv6 ips_propinfo_tbl[82].prop_cur_bval
#define ips_ip_dce_reclaim_threshold ips_propinfo_tbl[83].prop_cur_uval
extern int dohwcksum;
#ifdef ZC_TEST
extern int noswcksum;
#endif
extern char ipif_loopback_name[];
extern nv_t *ire_nv_tbl;
extern struct module_info ip_mod_info;
#define HOOKS4_INTERESTED_PHYSICAL_IN(ipst) \
((ipst)->ips_ip4_physical_in_event.he_interested)
#define HOOKS6_INTERESTED_PHYSICAL_IN(ipst) \
((ipst)->ips_ip6_physical_in_event.he_interested)
#define HOOKS4_INTERESTED_PHYSICAL_OUT(ipst) \
((ipst)->ips_ip4_physical_out_event.he_interested)
#define HOOKS6_INTERESTED_PHYSICAL_OUT(ipst) \
((ipst)->ips_ip6_physical_out_event.he_interested)
#define HOOKS4_INTERESTED_FORWARDING(ipst) \
((ipst)->ips_ip4_forwarding_event.he_interested)
#define HOOKS6_INTERESTED_FORWARDING(ipst) \
((ipst)->ips_ip6_forwarding_event.he_interested)
#define HOOKS4_INTERESTED_LOOPBACK_IN(ipst) \
((ipst)->ips_ip4_loopback_in_event.he_interested)
#define HOOKS6_INTERESTED_LOOPBACK_IN(ipst) \
((ipst)->ips_ip6_loopback_in_event.he_interested)
#define HOOKS4_INTERESTED_LOOPBACK_OUT(ipst) \
((ipst)->ips_ip4_loopback_out_event.he_interested)
#define HOOKS6_INTERESTED_LOOPBACK_OUT(ipst) \
((ipst)->ips_ip6_loopback_out_event.he_interested)
#define FW_HOOKS(_hook, _event, _ilp, _olp, _iph, _fm, _m, _llm, ipst, _err) \
if ((_hook).he_interested) { \
hook_pkt_event_t info; \
\
_NOTE(CONSTCOND) \
ASSERT((_ilp != NULL) || (_olp != NULL)); \
\
FW_SET_ILL_INDEX(info.hpe_ifp, (ill_t *)_ilp); \
FW_SET_ILL_INDEX(info.hpe_ofp, (ill_t *)_olp); \
info.hpe_protocol = ipst->ips_ipv4_net_data; \
info.hpe_hdr = _iph; \
info.hpe_mp = &(_fm); \
info.hpe_mb = _m; \
info.hpe_flags = _llm; \
_err = hook_run(ipst->ips_ipv4_net_data->netd_hooks, \
_event, (hook_data_t)&info); \
if (_err != 0) { \
ip2dbg(("%s hook dropped mblk chain %p hdr %p\n",\
(_hook).he_name, (void *)_fm, (void *)_m)); \
if (_fm != NULL) { \
freemsg(_fm); \
_fm = NULL; \
} \
_iph = NULL; \
_m = NULL; \
} else { \
_iph = info.hpe_hdr; \
_m = info.hpe_mb; \
} \
}
#define FW_HOOKS6(_hook, _event, _ilp, _olp, _iph, _fm, _m, _llm, ipst, _err) \
if ((_hook).he_interested) { \
hook_pkt_event_t info; \
\
_NOTE(CONSTCOND) \
ASSERT((_ilp != NULL) || (_olp != NULL)); \
\
FW_SET_ILL_INDEX(info.hpe_ifp, (ill_t *)_ilp); \
FW_SET_ILL_INDEX(info.hpe_ofp, (ill_t *)_olp); \
info.hpe_protocol = ipst->ips_ipv6_net_data; \
info.hpe_hdr = _iph; \
info.hpe_mp = &(_fm); \
info.hpe_mb = _m; \
info.hpe_flags = _llm; \
_err = hook_run(ipst->ips_ipv6_net_data->netd_hooks, \
_event, (hook_data_t)&info); \
if (_err != 0) { \
ip2dbg(("%s hook dropped mblk chain %p hdr %p\n",\
(_hook).he_name, (void *)_fm, (void *)_m)); \
if (_fm != NULL) { \
freemsg(_fm); \
_fm = NULL; \
} \
_iph = NULL; \
_m = NULL; \
} else { \
_iph = info.hpe_hdr; \
_m = info.hpe_mb; \
} \
}
#define FW_SET_ILL_INDEX(fp, ill) \
_NOTE(CONSTCOND) \
if ((ill) == NULL || (ill)->ill_phyint == NULL) { \
(fp) = 0; \
_NOTE(CONSTCOND) \
} else if (IS_UNDER_IPMP(ill)) { \
(fp) = ipmp_ill_get_ipmp_ifindex(ill); \
} else { \
(fp) = (ill)->ill_phyint->phyint_ifindex; \
}
#ifdef _BIG_ENDIAN
#define N_IN_CLASSA_NET IN_CLASSA_NET
#define N_IN_CLASSD_NET IN_CLASSD_NET
#define N_INADDR_UNSPEC_GROUP INADDR_UNSPEC_GROUP
#define N_IN_LOOPBACK_NET (ipaddr_t)0x7f000000U
#else
#define N_IN_CLASSA_NET (ipaddr_t)0x000000ffU
#define N_IN_CLASSD_NET (ipaddr_t)0x000000f0U
#define N_INADDR_UNSPEC_GROUP (ipaddr_t)0x000000e0U
#define N_IN_LOOPBACK_NET (ipaddr_t)0x0000007fU
#endif
#define CLASSD(addr) (((addr) & N_IN_CLASSD_NET) == N_INADDR_UNSPEC_GROUP)
#define CLASSE(addr) (((addr) & N_IN_CLASSD_NET) == N_IN_CLASSD_NET)
#define IP_LOOPBACK_ADDR(addr) \
(((addr) & N_IN_CLASSA_NET == N_IN_LOOPBACK_NET))
extern int ip_debug;
extern uint_t ip_thread_data;
extern krwlock_t ip_thread_rwlock;
extern list_t ip_thread_list;
#ifdef IP_DEBUG
#include <sys/debug.h>
#include <sys/promif.h>
#define ip0dbg(a) printf a
#define ip1dbg(a) if (ip_debug > 2) printf a
#define ip2dbg(a) if (ip_debug > 3) printf a
#define ip3dbg(a) if (ip_debug > 4) printf a
#else
#define ip0dbg(a)
#define ip1dbg(a)
#define ip2dbg(a)
#define ip3dbg(a)
#endif
#define MAC_STR_LEN 128
struct mac_header_info_s;
extern void ill_frag_timer(void *);
extern ill_t *ill_first(int, int, ill_walk_context_t *, ip_stack_t *);
extern ill_t *ill_next(ill_walk_context_t *, ill_t *);
extern void ill_frag_timer_start(ill_t *);
extern void ill_nic_event_dispatch(ill_t *, lif_if_t, nic_event_t,
nic_event_data_t, size_t);
extern mblk_t *ip_carve_mp(mblk_t **, ssize_t);
extern mblk_t *ip_dlpi_alloc(size_t, t_uscalar_t);
extern mblk_t *ip_dlnotify_alloc(uint_t, uint_t);
extern mblk_t *ip_dlnotify_alloc2(uint_t, uint_t, uint_t);
extern char *ip_dot_addr(ipaddr_t, char *);
extern const char *mac_colon_addr(const uint8_t *, size_t, char *, size_t);
extern int ip_lwput(queue_t *, mblk_t *);
extern boolean_t icmp_err_rate_limit(ip_stack_t *);
extern void icmp_frag_needed(mblk_t *, int, ip_recv_attr_t *);
extern mblk_t *icmp_inbound_v4(mblk_t *, ip_recv_attr_t *);
extern void icmp_time_exceeded(mblk_t *, uint8_t, ip_recv_attr_t *);
extern void icmp_unreachable(mblk_t *, uint8_t, ip_recv_attr_t *);
extern boolean_t ip_ipsec_policy_inherit(conn_t *, conn_t *, ip_recv_attr_t *);
extern void *ip_pullup(mblk_t *, ssize_t, ip_recv_attr_t *);
extern void ip_setl2src(mblk_t *, ip_recv_attr_t *, ill_t *);
extern mblk_t *ip_check_and_align_header(mblk_t *, uint_t, ip_recv_attr_t *);
extern mblk_t *ip_check_length(mblk_t *, uchar_t *, ssize_t, uint_t, uint_t,
ip_recv_attr_t *);
extern mblk_t *ip_check_optlen(mblk_t *, ipha_t *, uint_t, uint_t,
ip_recv_attr_t *);
extern mblk_t *ip_fix_dbref(mblk_t *, ip_recv_attr_t *);
extern uint_t ip_cksum(mblk_t *, int, uint32_t);
extern int ip_close(queue_t *, int, cred_t *);
extern uint16_t ip_csum_hdr(ipha_t *);
extern void ip_forward_xmit_v4(nce_t *, ill_t *, mblk_t *, ipha_t *,
ip_recv_attr_t *, uint32_t, uint32_t);
extern boolean_t ip_forward_options(mblk_t *, ipha_t *, ill_t *,
ip_recv_attr_t *);
extern int ip_fragment_v4(mblk_t *, nce_t *, iaflags_t, uint_t, uint32_t,
uint32_t, zoneid_t, zoneid_t, pfirepostfrag_t postfragfn,
uintptr_t *cookie);
extern void ip_proto_not_sup(mblk_t *, ip_recv_attr_t *);
extern void ip_ire_g_fini(void);
extern void ip_ire_g_init(void);
extern void ip_ire_fini(ip_stack_t *);
extern void ip_ire_init(ip_stack_t *);
extern void ip_mdata_to_mhi(ill_t *, mblk_t *, struct mac_header_info_s *);
extern int ip_openv4(queue_t *q, dev_t *devp, int flag, int sflag,
cred_t *credp);
extern int ip_openv6(queue_t *q, dev_t *devp, int flag, int sflag,
cred_t *credp);
extern int ip_reassemble(mblk_t *, ipf_t *, uint_t, boolean_t, ill_t *,
size_t);
extern int ip_rput(queue_t *, mblk_t *);
extern void ip_input(ill_t *, ill_rx_ring_t *, mblk_t *,
struct mac_header_info_s *);
extern void ip_input_v6(ill_t *, ill_rx_ring_t *, mblk_t *,
struct mac_header_info_s *);
extern mblk_t *ip_input_common_v4(ill_t *, ill_rx_ring_t *, mblk_t *,
struct mac_header_info_s *, squeue_t *, mblk_t **, uint_t *);
extern mblk_t *ip_input_common_v6(ill_t *, ill_rx_ring_t *, mblk_t *,
struct mac_header_info_s *, squeue_t *, mblk_t **, uint_t *);
extern void ill_input_full_v4(mblk_t *, void *, void *,
ip_recv_attr_t *, rtc_t *);
extern void ill_input_short_v4(mblk_t *, void *, void *,
ip_recv_attr_t *, rtc_t *);
extern void ill_input_full_v6(mblk_t *, void *, void *,
ip_recv_attr_t *, rtc_t *);
extern void ill_input_short_v6(mblk_t *, void *, void *,
ip_recv_attr_t *, rtc_t *);
extern ipaddr_t ip_input_options(ipha_t *, ipaddr_t, mblk_t *,
ip_recv_attr_t *, int *);
extern boolean_t ip_input_local_options(mblk_t *, ipha_t *, ip_recv_attr_t *);
extern mblk_t *ip_input_fragment(mblk_t *, ipha_t *, ip_recv_attr_t *);
extern mblk_t *ip_input_fragment_v6(mblk_t *, ip6_t *, ip6_frag_t *, uint_t,
ip_recv_attr_t *);
extern void ip_input_post_ipsec(mblk_t *, ip_recv_attr_t *);
extern void ip_fanout_v4(mblk_t *, ipha_t *, ip_recv_attr_t *);
extern void ip_fanout_v6(mblk_t *, ip6_t *, ip_recv_attr_t *);
extern void ip_fanout_proto_conn(conn_t *, mblk_t *, ipha_t *, ip6_t *,
ip_recv_attr_t *);
extern void ip_fanout_proto_v4(mblk_t *, ipha_t *, ip_recv_attr_t *);
extern void ip_fanout_send_icmp_v4(mblk_t *, uint_t, uint_t,
ip_recv_attr_t *);
extern void ip_fanout_udp_conn(conn_t *, mblk_t *, ipha_t *, ip6_t *,
ip_recv_attr_t *);
extern void ip_fanout_udp_multi_v4(mblk_t *, ipha_t *, uint16_t, uint16_t,
ip_recv_attr_t *);
extern mblk_t *zero_spi_check(mblk_t *, ip_recv_attr_t *);
extern void ip_build_hdrs_v4(uchar_t *, uint_t, const ip_pkt_t *, uint8_t);
extern int ip_find_hdr_v4(ipha_t *, ip_pkt_t *, boolean_t);
extern int ip_total_hdrs_len_v4(const ip_pkt_t *);
extern mblk_t *ip_accept_tcp(ill_t *, ill_rx_ring_t *, squeue_t *,
mblk_t *, mblk_t **, uint_t *cnt);
extern mblk_t *ip_accept_tcp_v6(ill_t *, ill_rx_ring_t *, squeue_t *,
mblk_t *, mblk_t **, uint_t *cnt);
extern void ip_rput_dlpi(ill_t *, mblk_t *);
extern void ip_rput_notdata(ill_t *, mblk_t *);
extern void ip_mib2_add_ip_stats(mib2_ipIfStatsEntry_t *,
mib2_ipIfStatsEntry_t *);
extern void ip_mib2_add_icmp6_stats(mib2_ipv6IfIcmpEntry_t *,
mib2_ipv6IfIcmpEntry_t *);
extern void ip_rput_other(ipsq_t *, queue_t *, mblk_t *, void *);
extern ire_t *ip_check_multihome(void *, ire_t *, ill_t *);
extern void ip_send_potential_redirect_v4(mblk_t *, ipha_t *, ire_t *,
ip_recv_attr_t *);
extern int ip_set_destination_v4(ipaddr_t *, ipaddr_t, ipaddr_t,
ip_xmit_attr_t *, iulp_t *, uint32_t, uint_t);
extern int ip_set_destination_v6(in6_addr_t *, const in6_addr_t *,
const in6_addr_t *, ip_xmit_attr_t *, iulp_t *, uint32_t, uint_t);
extern int ip_output_simple(mblk_t *, ip_xmit_attr_t *);
extern int ip_output_simple_v4(mblk_t *, ip_xmit_attr_t *);
extern int ip_output_simple_v6(mblk_t *, ip_xmit_attr_t *);
extern int ip_output_options(mblk_t *, ipha_t *, ip_xmit_attr_t *,
ill_t *);
extern void ip_output_local_options(ipha_t *, ip_stack_t *);
extern ip_xmit_attr_t *conn_get_ixa(conn_t *, boolean_t);
extern ip_xmit_attr_t *conn_get_ixa_tryhard(conn_t *, boolean_t);
extern ip_xmit_attr_t *conn_replace_ixa(conn_t *, ip_xmit_attr_t *);
extern ip_xmit_attr_t *conn_get_ixa_exclusive(conn_t *);
extern ip_xmit_attr_t *ip_xmit_attr_duplicate(ip_xmit_attr_t *);
extern void ip_xmit_attr_replace_tsl(ip_xmit_attr_t *, ts_label_t *);
extern void ip_xmit_attr_restore_tsl(ip_xmit_attr_t *, cred_t *);
boolean_t ip_recv_attr_replace_label(ip_recv_attr_t *, ts_label_t *);
extern void ixa_inactive(ip_xmit_attr_t *);
extern void ixa_refrele(ip_xmit_attr_t *);
extern boolean_t ixa_check_drain_insert(conn_t *, ip_xmit_attr_t *);
extern void ixa_cleanup(ip_xmit_attr_t *);
extern void ira_cleanup(ip_recv_attr_t *, boolean_t);
extern void ixa_safe_copy(ip_xmit_attr_t *, ip_xmit_attr_t *);
extern int conn_ip_output(mblk_t *, ip_xmit_attr_t *);
extern boolean_t ip_output_verify_local(ip_xmit_attr_t *);
extern mblk_t *ip_output_process_local(mblk_t *, ip_xmit_attr_t *, boolean_t,
boolean_t, conn_t *);
extern int conn_opt_get(conn_opt_arg_t *, t_scalar_t, t_scalar_t,
uchar_t *);
extern int conn_opt_set(conn_opt_arg_t *, t_scalar_t, t_scalar_t, uint_t,
uchar_t *, boolean_t, cred_t *);
extern boolean_t conn_same_as_last_v4(conn_t *, sin_t *);
extern boolean_t conn_same_as_last_v6(conn_t *, sin6_t *);
extern int conn_update_label(const conn_t *, const ip_xmit_attr_t *,
const in6_addr_t *, ip_pkt_t *);
extern int ip_opt_set_multicast_group(conn_t *, t_scalar_t,
uchar_t *, boolean_t, boolean_t);
extern int ip_opt_set_multicast_sources(conn_t *, t_scalar_t,
uchar_t *, boolean_t, boolean_t);
extern int conn_getsockname(conn_t *, struct sockaddr *, uint_t *);
extern int conn_getpeername(conn_t *, struct sockaddr *, uint_t *);
extern int conn_build_hdr_template(conn_t *, uint_t, uint_t,
const in6_addr_t *, const in6_addr_t *, uint32_t);
extern mblk_t *conn_prepend_hdr(ip_xmit_attr_t *, const ip_pkt_t *,
const in6_addr_t *, const in6_addr_t *, uint8_t, uint32_t, uint_t,
mblk_t *, uint_t, uint_t, uint32_t *, int *);
extern void ip_attr_newdst(ip_xmit_attr_t *);
extern void ip_attr_nexthop(const ip_pkt_t *, const ip_xmit_attr_t *,
const in6_addr_t *, in6_addr_t *);
extern int conn_connect(conn_t *, iulp_t *, uint32_t);
extern int ip_attr_connect(const conn_t *, ip_xmit_attr_t *,
const in6_addr_t *, const in6_addr_t *, const in6_addr_t *, in_port_t,
in6_addr_t *, iulp_t *, uint32_t);
extern int conn_inherit_parent(conn_t *, conn_t *);
extern void conn_ixa_cleanup(conn_t *connp, void *arg);
extern boolean_t conn_wantpacket(conn_t *, ip_recv_attr_t *, ipha_t *);
extern uint_t ip_type_v4(ipaddr_t, ip_stack_t *);
extern uint_t ip_type_v6(const in6_addr_t *, ip_stack_t *);
extern int ip_wput_nondata(queue_t *, mblk_t *);
extern int ip_wsrv(queue_t *);
extern char *ip_nv_lookup(nv_t *, int);
extern boolean_t ip_local_addr_ok_v6(const in6_addr_t *, const in6_addr_t *);
extern boolean_t ip_remote_addr_ok_v6(const in6_addr_t *, const in6_addr_t *);
extern ipaddr_t ip_massage_options(ipha_t *, netstack_t *);
extern ipaddr_t ip_net_mask(ipaddr_t);
extern void arp_bringup_done(ill_t *, int);
extern void arp_replumb_done(ill_t *, int);
extern struct qinit iprinitv6;
extern void ipmp_init(ip_stack_t *);
extern void ipmp_destroy(ip_stack_t *);
extern ipmp_grp_t *ipmp_grp_create(const char *, phyint_t *);
extern void ipmp_grp_destroy(ipmp_grp_t *);
extern void ipmp_grp_info(const ipmp_grp_t *, lifgroupinfo_t *);
extern int ipmp_grp_rename(ipmp_grp_t *, const char *);
extern ipmp_grp_t *ipmp_grp_lookup(const char *, ip_stack_t *);
extern int ipmp_grp_vet_phyint(ipmp_grp_t *, phyint_t *);
extern ipmp_illgrp_t *ipmp_illgrp_create(ill_t *);
extern void ipmp_illgrp_destroy(ipmp_illgrp_t *);
extern ill_t *ipmp_illgrp_add_ipif(ipmp_illgrp_t *, ipif_t *);
extern void ipmp_illgrp_del_ipif(ipmp_illgrp_t *, ipif_t *);
extern ill_t *ipmp_illgrp_next_ill(ipmp_illgrp_t *);
extern ill_t *ipmp_illgrp_hold_next_ill(ipmp_illgrp_t *);
extern ill_t *ipmp_illgrp_hold_cast_ill(ipmp_illgrp_t *);
extern ill_t *ipmp_illgrp_ipmp_ill(ipmp_illgrp_t *);
extern void ipmp_illgrp_refresh_mtu(ipmp_illgrp_t *);
extern ipmp_arpent_t *ipmp_illgrp_create_arpent(ipmp_illgrp_t *,
boolean_t, ipaddr_t, uchar_t *, size_t, uint16_t);
extern void ipmp_illgrp_destroy_arpent(ipmp_illgrp_t *, ipmp_arpent_t *);
extern ipmp_arpent_t *ipmp_illgrp_lookup_arpent(ipmp_illgrp_t *, ipaddr_t *);
extern void ipmp_illgrp_refresh_arpent(ipmp_illgrp_t *);
extern void ipmp_illgrp_mark_arpent(ipmp_illgrp_t *, ipmp_arpent_t *);
extern ill_t *ipmp_illgrp_find_ill(ipmp_illgrp_t *, uchar_t *, uint_t);
extern void ipmp_illgrp_link_grp(ipmp_illgrp_t *, ipmp_grp_t *);
extern int ipmp_illgrp_unlink_grp(ipmp_illgrp_t *);
extern uint_t ipmp_ill_get_ipmp_ifindex(const ill_t *);
extern void ipmp_ill_join_illgrp(ill_t *, ipmp_illgrp_t *);
extern void ipmp_ill_leave_illgrp(ill_t *);
extern ill_t *ipmp_ill_hold_ipmp_ill(ill_t *);
extern ill_t *ipmp_ill_hold_xmit_ill(ill_t *, boolean_t);
extern boolean_t ipmp_ill_is_active(ill_t *);
extern void ipmp_ill_refresh_active(ill_t *);
extern void ipmp_phyint_join_grp(phyint_t *, ipmp_grp_t *);
extern void ipmp_phyint_leave_grp(phyint_t *);
extern void ipmp_phyint_refresh_active(phyint_t *);
extern ill_t *ipmp_ipif_bound_ill(const ipif_t *);
extern ill_t *ipmp_ipif_hold_bound_ill(const ipif_t *);
extern boolean_t ipmp_ipif_is_dataaddr(const ipif_t *);
extern boolean_t ipmp_ipif_is_stubaddr(const ipif_t *);
extern boolean_t ipmp_packet_is_probe(mblk_t *, ill_t *);
extern void ipmp_ncec_delete_nce(ncec_t *);
extern void ipmp_ncec_refresh_nce(ncec_t *);
extern void conn_drain_insert(conn_t *, idl_tx_list_t *);
extern void conn_setqfull(conn_t *, boolean_t *);
extern void conn_clrqfull(conn_t *, boolean_t *);
extern int conn_ipsec_length(conn_t *);
extern ipaddr_t ip_get_dst(ipha_t *);
extern uint_t ip_get_pmtu(ip_xmit_attr_t *);
extern uint_t ip_get_base_mtu(ill_t *, ire_t *);
extern mblk_t *ip_output_attach_policy(mblk_t *, ipha_t *, ip6_t *,
const conn_t *, ip_xmit_attr_t *);
extern int ipsec_out_extra_length(ip_xmit_attr_t *);
extern int ipsec_out_process(mblk_t *, ip_xmit_attr_t *);
extern int ip_output_post_ipsec(mblk_t *, ip_xmit_attr_t *);
extern void ipsec_out_to_in(ip_xmit_attr_t *, ill_t *ill,
ip_recv_attr_t *);
extern void ire_cleanup(ire_t *);
extern void ire_inactive(ire_t *);
extern boolean_t irb_inactive(irb_t *);
extern ire_t *ire_unlink(irb_t *);
#ifdef DEBUG
extern boolean_t th_trace_ref(const void *, ip_stack_t *);
extern void th_trace_unref(const void *);
extern void th_trace_cleanup(const void *, boolean_t);
extern void ire_trace_ref(ire_t *);
extern void ire_untrace_ref(ire_t *);
#endif
extern int ip_srcid_insert(const in6_addr_t *, zoneid_t, ip_stack_t *);
extern int ip_srcid_remove(const in6_addr_t *, zoneid_t, ip_stack_t *);
extern boolean_t ip_srcid_find_id(uint_t, in6_addr_t *, zoneid_t, boolean_t,
netstack_t *);
extern uint_t ip_srcid_find_addr(const in6_addr_t *, zoneid_t, netstack_t *);
extern uint8_t ipoptp_next(ipoptp_t *);
extern uint8_t ipoptp_first(ipoptp_t *, ipha_t *);
extern int ip_opt_get_user(conn_t *, uchar_t *);
extern int ipsec_req_from_conn(conn_t *, ipsec_req_t *, int);
extern int ip_snmp_get(queue_t *q, mblk_t *mctl, int level, boolean_t);
extern int ip_snmp_set(queue_t *q, int, int, uchar_t *, int);
extern void ip_process_ioctl(ipsq_t *, queue_t *, mblk_t *, void *);
extern void ip_quiesce_conn(conn_t *);
extern void ip_reprocess_ioctl(ipsq_t *, queue_t *, mblk_t *, void *);
extern void ip_ioctl_finish(queue_t *, mblk_t *, int, int, ipsq_t *);
extern boolean_t ip_cmpbuf(const void *, uint_t, boolean_t, const void *,
uint_t);
extern boolean_t ip_allocbuf(void **, uint_t *, boolean_t, const void *,
uint_t);
extern void ip_savebuf(void **, uint_t *, boolean_t, const void *, uint_t);
extern boolean_t ipsq_pending_mp_cleanup(ill_t *, conn_t *);
extern void conn_ioctl_cleanup(conn_t *);
extern void ip_unbind(conn_t *);
extern void tnet_init(void);
extern void tnet_fini(void);
extern int (*cl_inet_isclusterwide)(netstackid_t stack_id, uint8_t protocol,
sa_family_t addr_family, uint8_t *laddrp, void *args);
extern uint32_t (*cl_inet_ipident)(netstackid_t stack_id, uint8_t protocol,
sa_family_t addr_family, uint8_t *laddrp, uint8_t *faddrp,
void *args);
extern int (*cl_inet_connect2)(netstackid_t stack_id, uint8_t protocol,
boolean_t is_outgoing, sa_family_t addr_family, uint8_t *laddrp,
in_port_t lport, uint8_t *faddrp, in_port_t fport, void *args);
extern void (*cl_inet_getspi)(netstackid_t, uint8_t, uint8_t *, size_t,
void *);
extern void (*cl_inet_getspi)(netstackid_t stack_id, uint8_t protocol,
uint8_t *ptr, size_t len, void *args);
extern int (*cl_inet_checkspi)(netstackid_t stack_id, uint8_t protocol,
uint32_t spi, void *args);
extern void (*cl_inet_deletespi)(netstackid_t stack_id, uint8_t protocol,
uint32_t spi, void *args);
extern void (*cl_inet_idlesa)(netstackid_t, uint8_t, uint32_t,
sa_family_t, in6_addr_t, in6_addr_t, void *);
#define CGTP_FILTER_REV_1 1
#define CGTP_FILTER_REV_2 2
#define CGTP_FILTER_REV_3 3
#define CGTP_FILTER_REV CGTP_FILTER_REV_3
#define CGTP_IP_PKT_NOT_CGTP 0
#define CGTP_IP_PKT_PREMIUM 1
#define CGTP_IP_PKT_DUPLICATE 2
typedef struct cgtp_filter_ops {
int cfo_filter_rev;
int (*cfo_change_state)(netstackid_t, int);
int (*cfo_add_dest_v4)(netstackid_t, ipaddr_t, ipaddr_t,
ipaddr_t, ipaddr_t);
int (*cfo_del_dest_v4)(netstackid_t, ipaddr_t, ipaddr_t);
int (*cfo_add_dest_v6)(netstackid_t, in6_addr_t *, in6_addr_t *,
in6_addr_t *, in6_addr_t *);
int (*cfo_del_dest_v6)(netstackid_t, in6_addr_t *, in6_addr_t *);
int (*cfo_filter)(netstackid_t, uint_t, mblk_t *);
int (*cfo_filter_v6)(netstackid_t, uint_t, ip6_t *,
ip6_frag_t *);
} cgtp_filter_ops_t;
#define CGTP_MCAST_SUCCESS 1
extern int ip_cgtp_filter_rev;
extern int ip_cgtp_filter_supported(void);
extern int ip_cgtp_filter_register(netstackid_t, cgtp_filter_ops_t *);
extern int ip_cgtp_filter_unregister(netstackid_t);
extern int ip_cgtp_filter_is_registered(netstackid_t);
typedef enum {
RR_FREE,
RR_SQUEUE_UNBOUND,
RR_SQUEUE_BIND_INPROG,
RR_SQUEUE_BOUND,
RR_FREE_INPROG
} ip_ring_state_t;
#define ILL_MAX_RINGS 256
#define ILL_POLLING 0x01
typedef boolean_t (*ip_mac_intr_disable_t)(void *);
typedef int (*ip_mac_intr_enable_t)(void *);
typedef ip_mac_tx_cookie_t (*ip_dld_tx_t)(void *, mblk_t *,
uint64_t, uint16_t);
typedef void (*ip_flow_enable_t)(void *, ip_mac_tx_cookie_t);
typedef void *(*ip_dld_callb_t)(void *,
ip_flow_enable_t, void *);
typedef boolean_t (*ip_dld_fctl_t)(void *, ip_mac_tx_cookie_t);
typedef int (*ip_capab_func_t)(void *, uint_t,
void *, uint_t);
typedef mblk_t *(*ip_mac_rx_t)(void *, size_t);
typedef mblk_t *(*ip_accept_t)(ill_t *, ill_rx_ring_t *,
squeue_t *, mblk_t *, mblk_t **, uint_t *);
struct ill_rx_ring {
ip_mac_intr_disable_t rr_intr_disable;
ip_mac_intr_enable_t rr_intr_enable;
void *rr_intr_handle;
ip_mac_rx_t rr_rx;
ip_accept_t rr_ip_accept;
void *rr_rx_handle;
squeue_t *rr_sqp;
ill_t *rr_ill;
ip_ring_state_t rr_ring_state;
};
typedef struct ill_dld_direct_s {
ip_dld_tx_t idd_tx_df;
void *idd_tx_dh;
ip_dld_callb_t idd_tx_cb_df;
void *idd_tx_cb_dh;
ip_dld_fctl_t idd_tx_fctl_df;
void *idd_tx_fctl_dh;
} ill_dld_direct_t;
typedef struct ill_dld_poll_s {
ill_rx_ring_t idp_ring_tbl[ILL_MAX_RINGS];
} ill_dld_poll_t;
struct ill_dld_capab_s {
ip_capab_func_t idc_capab_df;
void *idc_capab_dh;
ill_dld_direct_t idc_direct;
ill_dld_poll_t idc_poll;
};
extern boolean_t ip_squeue_fanout;
#define IP_SQUEUE_GET(hint) ip_squeue_random(hint)
extern void ip_squeue_init(void (*)(squeue_t *));
extern squeue_t *ip_squeue_random(uint_t);
extern squeue_t *ip_squeue_get(ill_rx_ring_t *);
extern squeue_t *ip_squeue_getfree(pri_t);
extern int ip_squeue_cpu_move(squeue_t *, processorid_t);
extern void *ip_squeue_add_ring(ill_t *, void *);
extern void ip_squeue_bind_ring(ill_t *, ill_rx_ring_t *, processorid_t);
extern void ip_squeue_clean_ring(ill_t *, ill_rx_ring_t *);
extern void ip_squeue_quiesce_ring(ill_t *, ill_rx_ring_t *);
extern void ip_squeue_restart_ring(ill_t *, ill_rx_ring_t *);
extern void ip_squeue_clean_all(ill_t *);
extern boolean_t ip_source_routed(ipha_t *, ip_stack_t *);
extern int tcp_wput(queue_t *, mblk_t *);
extern int ip_fill_mtuinfo(conn_t *, ip_xmit_attr_t *,
struct ip6_mtuinfo *);
extern hook_t *ipobs_register_hook(netstack_t *, pfv_t);
extern void ipobs_unregister_hook(netstack_t *, hook_t *);
extern void ipobs_hook(mblk_t *, int, zoneid_t, zoneid_t, const ill_t *,
ip_stack_t *);
typedef void (*ipsq_func_t)(ipsq_t *, queue_t *, mblk_t *, void *);
extern void dce_g_init(void);
extern void dce_g_destroy(void);
extern void dce_stack_init(ip_stack_t *);
extern void dce_stack_destroy(ip_stack_t *);
extern void dce_cleanup(uint_t, ip_stack_t *);
extern dce_t *dce_get_default(ip_stack_t *);
extern dce_t *dce_lookup_pkt(mblk_t *, ip_xmit_attr_t *, uint_t *);
extern dce_t *dce_lookup_v4(ipaddr_t, ip_stack_t *, uint_t *);
extern dce_t *dce_lookup_v6(const in6_addr_t *, uint_t, ip_stack_t *,
uint_t *);
extern dce_t *dce_lookup_and_add_v4(ipaddr_t, ip_stack_t *);
extern dce_t *dce_lookup_and_add_v6(const in6_addr_t *, uint_t,
ip_stack_t *);
extern int dce_update_uinfo_v4(ipaddr_t, iulp_t *, ip_stack_t *);
extern int dce_update_uinfo_v6(const in6_addr_t *, uint_t, iulp_t *,
ip_stack_t *);
extern int dce_update_uinfo(const in6_addr_t *, uint_t, iulp_t *,
ip_stack_t *);
extern void dce_increment_generation(dce_t *);
extern void dce_increment_all_generations(boolean_t, ip_stack_t *);
extern void dce_refrele(dce_t *);
extern void dce_refhold(dce_t *);
extern void dce_refrele_notr(dce_t *);
extern void dce_refhold_notr(dce_t *);
mblk_t *ip_snmp_get_mib2_ip_dce(queue_t *, mblk_t *, ip_stack_t *ipst);
extern ip_laddr_t ip_laddr_verify_v4(ipaddr_t, zoneid_t,
ip_stack_t *, boolean_t);
extern ip_laddr_t ip_laddr_verify_v6(const in6_addr_t *, zoneid_t,
ip_stack_t *, boolean_t, uint_t);
extern int ip_laddr_fanout_insert(conn_t *);
extern boolean_t ip_verify_src(mblk_t *, ip_xmit_attr_t *, uint_t *);
extern int ip_verify_ire(mblk_t *, ip_xmit_attr_t *);
extern mblk_t *ip_xmit_attr_to_mblk(ip_xmit_attr_t *);
extern boolean_t ip_xmit_attr_from_mblk(mblk_t *, ip_xmit_attr_t *);
extern mblk_t *ip_xmit_attr_free_mblk(mblk_t *);
extern mblk_t *ip_recv_attr_to_mblk(ip_recv_attr_t *);
extern boolean_t ip_recv_attr_from_mblk(mblk_t *, ip_recv_attr_t *);
extern mblk_t *ip_recv_attr_free_mblk(mblk_t *);
extern boolean_t ip_recv_attr_is_mblk(mblk_t *);
#ifdef __PRAGMA_REDEFINE_EXTNAME
#pragma redefine_extname inet_ntop _inet_ntop
#pragma redefine_extname inet_pton _inet_pton
#else
#define inet_ntop _inet_ntop
#define inet_pton _inet_pton
#endif
extern char *inet_ntop(int, const void *, char *, int);
extern int inet_pton(int, char *, void *);
#define SQTAG_IP_INPUT 1
#define SQTAG_TCP_INPUT_ICMP_ERR 2
#define SQTAG_TCP6_INPUT_ICMP_ERR 3
#define SQTAG_IP_TCP_INPUT 4
#define SQTAG_IP6_TCP_INPUT 5
#define SQTAG_IP_TCP_CLOSE 6
#define SQTAG_TCP_OUTPUT 7
#define SQTAG_TCP_TIMER 8
#define SQTAG_TCP_TIMEWAIT 9
#define SQTAG_TCP_ACCEPT_FINISH 10
#define SQTAG_TCP_ACCEPT_FINISH_Q0 11
#define SQTAG_TCP_ACCEPT_PENDING 12
#define SQTAG_TCP_LISTEN_DISCON 13
#define SQTAG_TCP_CONN_REQ_1 14
#define SQTAG_TCP_EAGER_BLOWOFF 15
#define SQTAG_TCP_EAGER_CLEANUP 16
#define SQTAG_TCP_EAGER_CLEANUP_Q0 17
#define SQTAG_TCP_CONN_IND 18
#define SQTAG_TCP_RSRV 19
#define SQTAG_TCP_ABORT_BUCKET 20
#define SQTAG_TCP_REINPUT 21
#define SQTAG_TCP_REINPUT_EAGER 22
#define SQTAG_TCP_INPUT_MCTL 23
#define SQTAG_TCP_RPUTOTHER 24
#define SQTAG_IP_PROTO_AGAIN 25
#define SQTAG_IP_FANOUT_TCP 26
#define SQTAG_IPSQ_CLEAN_RING 27
#define SQTAG_TCP_WPUT_OTHER 28
#define SQTAG_TCP_CONN_REQ_UNBOUND 29
#define SQTAG_TCP_SEND_PENDING 30
#define SQTAG_BIND_RETRY 31
#define SQTAG_UDP_FANOUT 32
#define SQTAG_UDP_INPUT 33
#define SQTAG_UDP_WPUT 34
#define SQTAG_UDP_OUTPUT 35
#define SQTAG_TCP_KSSL_INPUT 36
#define SQTAG_TCP_DROP_Q0 37
#define SQTAG_TCP_CONN_REQ_2 38
#define SQTAG_IP_INPUT_RX_RING 39
#define SQTAG_SQUEUE_CHANGE 40
#define SQTAG_CONNECT_FINISH 41
#define SQTAG_SYNCHRONOUS_OP 42
#define SQTAG_TCP_SHUTDOWN_OUTPUT 43
#define SQTAG_TCP_IXA_CLEANUP 44
#define SQTAG_TCP_SEND_SYNACK 45
extern sin_t sin_null;
extern sin6_t sin6_null;
#endif
#ifdef __cplusplus
}
#endif
#endif