17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 52caf0dcdSrshoaib * Common Development and Distribution License (the "License"). 62caf0dcdSrshoaib * You may not use this file except in compliance with the License. 77c478bd9Sstevel@tonic-gate * 87c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 97c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 107c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 117c478bd9Sstevel@tonic-gate * and limitations under the License. 127c478bd9Sstevel@tonic-gate * 137c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 147c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 157c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 167c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 177c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 187c478bd9Sstevel@tonic-gate * 197c478bd9Sstevel@tonic-gate * CDDL HEADER END 207c478bd9Sstevel@tonic-gate */ 212caf0dcdSrshoaib 227c478bd9Sstevel@tonic-gate /* 2317169044Sbrutus * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 247c478bd9Sstevel@tonic-gate * Use is subject to license terms. 257c478bd9Sstevel@tonic-gate */ 267c478bd9Sstevel@tonic-gate 277c478bd9Sstevel@tonic-gate /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ 287c478bd9Sstevel@tonic-gate /* All Rights Reserved */ 297c478bd9Sstevel@tonic-gate 307c478bd9Sstevel@tonic-gate /* 317c478bd9Sstevel@tonic-gate * University Copyright- Copyright (c) 1982, 1986, 1988 327c478bd9Sstevel@tonic-gate * The Regents of the University of California 337c478bd9Sstevel@tonic-gate * All Rights Reserved 347c478bd9Sstevel@tonic-gate * 357c478bd9Sstevel@tonic-gate * University Acknowledgment- Portions of this document are derived from 367c478bd9Sstevel@tonic-gate * software developed by the University of California, Berkeley, and its 377c478bd9Sstevel@tonic-gate * contributors. 387c478bd9Sstevel@tonic-gate */ 397c478bd9Sstevel@tonic-gate 407c478bd9Sstevel@tonic-gate #ifndef _SYS_SOCKETVAR_H 417c478bd9Sstevel@tonic-gate #define _SYS_SOCKETVAR_H 427c478bd9Sstevel@tonic-gate 437c478bd9Sstevel@tonic-gate #include <sys/types.h> 447c478bd9Sstevel@tonic-gate #include <sys/stream.h> 457c478bd9Sstevel@tonic-gate #include <sys/t_lock.h> 467c478bd9Sstevel@tonic-gate #include <sys/cred.h> 477c478bd9Sstevel@tonic-gate #include <sys/vnode.h> 487c478bd9Sstevel@tonic-gate #include <sys/file.h> 497c478bd9Sstevel@tonic-gate #include <sys/param.h> 507c478bd9Sstevel@tonic-gate #include <sys/zone.h> 5117169044Sbrutus #include <sys/sodirect.h> 52c28749e9Skais #include <inet/kssl/ksslapi.h> 537c478bd9Sstevel@tonic-gate 547c478bd9Sstevel@tonic-gate #ifdef __cplusplus 557c478bd9Sstevel@tonic-gate extern "C" { 567c478bd9Sstevel@tonic-gate #endif 577c478bd9Sstevel@tonic-gate 587c478bd9Sstevel@tonic-gate /* 597c478bd9Sstevel@tonic-gate * Internal representation used for addresses. 607c478bd9Sstevel@tonic-gate */ 617c478bd9Sstevel@tonic-gate struct soaddr { 627c478bd9Sstevel@tonic-gate struct sockaddr *soa_sa; /* Actual address */ 637c478bd9Sstevel@tonic-gate t_uscalar_t soa_len; /* Length in bytes for kmem_free */ 647c478bd9Sstevel@tonic-gate t_uscalar_t soa_maxlen; /* Allocated length */ 657c478bd9Sstevel@tonic-gate }; 667c478bd9Sstevel@tonic-gate /* Maximum size address for transports that have ADDR_size == 1 */ 677c478bd9Sstevel@tonic-gate #define SOA_DEFSIZE 128 687c478bd9Sstevel@tonic-gate 697c478bd9Sstevel@tonic-gate /* 707c478bd9Sstevel@tonic-gate * Internal representation of the address used to represent addresses 717c478bd9Sstevel@tonic-gate * in the loopback transport for AF_UNIX. While the sockaddr_un is used 727c478bd9Sstevel@tonic-gate * as the sockfs layer address for AF_UNIX the pathnames contained in 737c478bd9Sstevel@tonic-gate * these addresses are not unique (due to relative pathnames) thus can not 747c478bd9Sstevel@tonic-gate * be used in the transport. 757c478bd9Sstevel@tonic-gate * 767c478bd9Sstevel@tonic-gate * The transport level address consists of a magic number (used to separate the 777c478bd9Sstevel@tonic-gate * name space for specific and implicit binds). For a specific bind 787c478bd9Sstevel@tonic-gate * this is followed by a "vnode *" which ensures that all specific binds 797c478bd9Sstevel@tonic-gate * have a unique transport level address. For implicit binds the latter 807c478bd9Sstevel@tonic-gate * part of the address is a byte string (of the same length as a pointer) 817c478bd9Sstevel@tonic-gate * that is assigned by the loopback transport. 827c478bd9Sstevel@tonic-gate * 837c478bd9Sstevel@tonic-gate * The uniqueness assumes that the loopback transport has a separate namespace 847c478bd9Sstevel@tonic-gate * for sockets in order to avoid name conflicts with e.g. TLI use of the 857c478bd9Sstevel@tonic-gate * same transport. 867c478bd9Sstevel@tonic-gate */ 877c478bd9Sstevel@tonic-gate struct so_ux_addr { 887c478bd9Sstevel@tonic-gate void *soua_vp; /* vnode pointer or assigned by tl */ 897c478bd9Sstevel@tonic-gate uint_t soua_magic; /* See below */ 907c478bd9Sstevel@tonic-gate }; 917c478bd9Sstevel@tonic-gate 927c478bd9Sstevel@tonic-gate #define SOU_MAGIC_EXPLICIT 0x75787670 /* "uxvp" */ 937c478bd9Sstevel@tonic-gate #define SOU_MAGIC_IMPLICIT 0x616e6f6e /* "anon" */ 947c478bd9Sstevel@tonic-gate 957c478bd9Sstevel@tonic-gate struct sockaddr_ux { 967c478bd9Sstevel@tonic-gate sa_family_t sou_family; /* AF_UNIX */ 977c478bd9Sstevel@tonic-gate struct so_ux_addr sou_addr; 987c478bd9Sstevel@tonic-gate }; 997c478bd9Sstevel@tonic-gate 1007c478bd9Sstevel@tonic-gate typedef struct sonodeops sonodeops_t; 101ff550d0eSmasputra typedef struct sonode sonode_t; 1027c478bd9Sstevel@tonic-gate 1037c478bd9Sstevel@tonic-gate /* 1047c478bd9Sstevel@tonic-gate * The sonode represents a socket. A sonode never exist in the file system 1057c478bd9Sstevel@tonic-gate * name space and can not be opened using open() - only the socket, socketpair 1067c478bd9Sstevel@tonic-gate * and accept calls create sonodes. 1077c478bd9Sstevel@tonic-gate * 1087c478bd9Sstevel@tonic-gate * When an AF_UNIX socket is bound to a pathname the sockfs 1097c478bd9Sstevel@tonic-gate * creates a VSOCK vnode in the underlying file system. However, the vnodeops 1107c478bd9Sstevel@tonic-gate * etc in this VNODE remain those of the underlying file system. 1117c478bd9Sstevel@tonic-gate * Sockfs uses the v_stream pointer in the underlying file system VSOCK node 1127c478bd9Sstevel@tonic-gate * to find the sonode bound to the pathname. The bound pathname vnode 1137c478bd9Sstevel@tonic-gate * is accessed through so_ux_vp. 1147c478bd9Sstevel@tonic-gate * 1157c478bd9Sstevel@tonic-gate * A socket always corresponds to a VCHR stream representing the transport 1167c478bd9Sstevel@tonic-gate * provider (e.g. /dev/tcp). This information is retrieved from the kernel 1177c478bd9Sstevel@tonic-gate * socket configuration table and entered into so_accessvp. sockfs uses 1187c478bd9Sstevel@tonic-gate * this to perform VOP_ACCESS checks before allowing an open of the transport 1197c478bd9Sstevel@tonic-gate * provider. 1207c478bd9Sstevel@tonic-gate * 1217c478bd9Sstevel@tonic-gate * The locking of sockfs uses the so_lock mutex plus the SOLOCKED 1227c478bd9Sstevel@tonic-gate * and SOREADLOCKED flags in so_flag. The mutex protects all the state 1237c478bd9Sstevel@tonic-gate * in the sonode. The SOLOCKED flag is used to single-thread operations from 1247c478bd9Sstevel@tonic-gate * sockfs users to prevent e.g. multiple bind() calls to operate on the 1257c478bd9Sstevel@tonic-gate * same sonode concurrently. The SOREADLOCKED flag is used to ensure that 1267c478bd9Sstevel@tonic-gate * only one thread sleeps in kstrgetmsg for a given sonode. This is needed 1277c478bd9Sstevel@tonic-gate * to ensure atomic operation for things like MSG_WAITALL. 1287c478bd9Sstevel@tonic-gate * 1297c478bd9Sstevel@tonic-gate * Note that so_lock is sometimes held across calls that might go to sleep 1307c478bd9Sstevel@tonic-gate * (kmem_alloc and soallocproto*). This implies that no other lock in 1317c478bd9Sstevel@tonic-gate * the system should be held when calling into sockfs; from the system call 1327c478bd9Sstevel@tonic-gate * side or from strrput. If locks are held while calling into sockfs 1337c478bd9Sstevel@tonic-gate * the system might hang when running low on memory. 1347c478bd9Sstevel@tonic-gate */ 1357c478bd9Sstevel@tonic-gate struct sonode { 1367c478bd9Sstevel@tonic-gate struct vnode *so_vnode; /* vnode associated with this sonode */ 1377c478bd9Sstevel@tonic-gate 1387c478bd9Sstevel@tonic-gate sonodeops_t *so_ops; /* operations vector for this sonode */ 1397c478bd9Sstevel@tonic-gate 1407c478bd9Sstevel@tonic-gate /* 1417c478bd9Sstevel@tonic-gate * These fields are initialized once. 1427c478bd9Sstevel@tonic-gate */ 1437c478bd9Sstevel@tonic-gate dev_t so_dev; /* device the sonode represents */ 1447c478bd9Sstevel@tonic-gate struct vnode *so_accessvp; /* vnode for the /dev entry */ 1457c478bd9Sstevel@tonic-gate 1467c478bd9Sstevel@tonic-gate /* The locks themselves */ 1477c478bd9Sstevel@tonic-gate kmutex_t so_lock; /* protects sonode fields */ 1487c478bd9Sstevel@tonic-gate kmutex_t so_plumb_lock; /* serializes plumbs, and the related */ 1497c478bd9Sstevel@tonic-gate /* fields so_version and so_pushcnt */ 1507c478bd9Sstevel@tonic-gate kcondvar_t so_state_cv; /* synchronize state changes */ 1517c478bd9Sstevel@tonic-gate kcondvar_t so_ack_cv; /* wait for TPI acks */ 1527c478bd9Sstevel@tonic-gate kcondvar_t so_connind_cv; /* wait for T_CONN_IND */ 1537c478bd9Sstevel@tonic-gate kcondvar_t so_want_cv; /* wait due to SOLOCKED */ 1547c478bd9Sstevel@tonic-gate 1557c478bd9Sstevel@tonic-gate /* These fields are protected by so_lock */ 1567c478bd9Sstevel@tonic-gate uint_t so_state; /* internal state flags SS_*, below */ 1577c478bd9Sstevel@tonic-gate uint_t so_mode; /* characteristics on socket. SM_* */ 1587c478bd9Sstevel@tonic-gate 1597c478bd9Sstevel@tonic-gate mblk_t *so_ack_mp; /* TPI ack received from below */ 1607c478bd9Sstevel@tonic-gate mblk_t *so_conn_ind_head; /* b_next list of T_CONN_IND */ 1617c478bd9Sstevel@tonic-gate mblk_t *so_conn_ind_tail; 1627c478bd9Sstevel@tonic-gate mblk_t *so_unbind_mp; /* Preallocated T_UNBIND_REQ message */ 1637c478bd9Sstevel@tonic-gate 1647c478bd9Sstevel@tonic-gate ushort_t so_flag; /* flags, see below */ 1657c478bd9Sstevel@tonic-gate dev_t so_fsid; /* file system identifier */ 1667c478bd9Sstevel@tonic-gate time_t so_atime; /* time of last access */ 1677c478bd9Sstevel@tonic-gate time_t so_mtime; /* time of last modification */ 1687c478bd9Sstevel@tonic-gate time_t so_ctime; /* time of last attributes change */ 1697c478bd9Sstevel@tonic-gate int so_count; /* count of opened references */ 1707c478bd9Sstevel@tonic-gate 1717c478bd9Sstevel@tonic-gate /* Needed to recreate the same socket for accept */ 1727c478bd9Sstevel@tonic-gate short so_family; 1737c478bd9Sstevel@tonic-gate short so_type; 1747c478bd9Sstevel@tonic-gate short so_protocol; 1757c478bd9Sstevel@tonic-gate short so_version; /* From so_socket call */ 1767c478bd9Sstevel@tonic-gate short so_pushcnt; /* Number of modules above "sockmod" */ 1777c478bd9Sstevel@tonic-gate 1787c478bd9Sstevel@tonic-gate /* Options */ 1797c478bd9Sstevel@tonic-gate short so_options; /* From socket call, see socket.h */ 1807c478bd9Sstevel@tonic-gate struct linger so_linger; /* SO_LINGER value */ 1817c478bd9Sstevel@tonic-gate int so_sndbuf; /* SO_SNDBUF value */ 1827c478bd9Sstevel@tonic-gate int so_rcvbuf; /* SO_RCVBUF value */ 1837c478bd9Sstevel@tonic-gate int so_sndlowat; /* send low water mark */ 1847c478bd9Sstevel@tonic-gate int so_rcvlowat; /* receive low water mark */ 1857c478bd9Sstevel@tonic-gate #ifdef notyet 1867c478bd9Sstevel@tonic-gate int so_sndtimeo; /* Not yet implemented */ 1877c478bd9Sstevel@tonic-gate int so_rcvtimeo; /* Not yet implemented */ 1887c478bd9Sstevel@tonic-gate #endif /* notyet */ 1897c478bd9Sstevel@tonic-gate ushort_t so_error; /* error affecting connection */ 1907c478bd9Sstevel@tonic-gate ushort_t so_delayed_error; /* From T_uderror_ind */ 1917c478bd9Sstevel@tonic-gate int so_backlog; /* Listen backlog */ 1927c478bd9Sstevel@tonic-gate 1937c478bd9Sstevel@tonic-gate /* 1947c478bd9Sstevel@tonic-gate * The counts (so_oobcnt and so_oobsigcnt) track the number of 1957c478bd9Sstevel@tonic-gate * urgent indicates that are (logically) queued on the stream head 1967c478bd9Sstevel@tonic-gate * read queue. The urgent data is queued on the stream head 1977c478bd9Sstevel@tonic-gate * as follows. 1987c478bd9Sstevel@tonic-gate * 1997c478bd9Sstevel@tonic-gate * In the normal case the SIGURG is not generated until 2007c478bd9Sstevel@tonic-gate * the T_EXDATA_IND arrives at the stream head. However, transports 2017c478bd9Sstevel@tonic-gate * that have an early indication that urgent data is pending 2027c478bd9Sstevel@tonic-gate * (e.g. TCP receiving a "new" urgent pointer value) can send up 2037c478bd9Sstevel@tonic-gate * an M_PCPROTO/SIGURG message to generate the signal early. 2047c478bd9Sstevel@tonic-gate * 2057c478bd9Sstevel@tonic-gate * The mark is indicated by either: 2067c478bd9Sstevel@tonic-gate * - a T_EXDATA_IND (with no M_DATA b_cont) with MSGMARK set. 2077c478bd9Sstevel@tonic-gate * When this message is consumed by sorecvmsg the socket layer 2087c478bd9Sstevel@tonic-gate * sets SS_RCVATMARK until data has been consumed past the mark. 2097c478bd9Sstevel@tonic-gate * - a message with MSGMARKNEXT set (indicating that the 2107c478bd9Sstevel@tonic-gate * first byte of the next message constitutes the mark). When 2117c478bd9Sstevel@tonic-gate * the last byte of the MSGMARKNEXT message is consumed in 2127c478bd9Sstevel@tonic-gate * the stream head the stream head sets STRATMARK. This flag 2137c478bd9Sstevel@tonic-gate * is cleared when at least one byte is read. (Note that 2147c478bd9Sstevel@tonic-gate * the MSGMARKNEXT messages can be of zero length when there 2157c478bd9Sstevel@tonic-gate * is no previous data to which the marknext can be attached.) 2167c478bd9Sstevel@tonic-gate * 2177c478bd9Sstevel@tonic-gate * While the T_EXDATA_IND method is the common case which is used 2187c478bd9Sstevel@tonic-gate * with all TPI transports, the MSGMARKNEXT method is needed to 2197c478bd9Sstevel@tonic-gate * indicate the mark when e.g. the TCP urgent byte has not been 2207c478bd9Sstevel@tonic-gate * received yet but the TCP urgent pointer has made TCP generate 2217c478bd9Sstevel@tonic-gate * the M_PCSIG/SIGURG. 2227c478bd9Sstevel@tonic-gate * 2237c478bd9Sstevel@tonic-gate * The signal (the M_PCSIG carrying the SIGURG) and the mark 2247c478bd9Sstevel@tonic-gate * indication can not be delivered as a single message, since 2257c478bd9Sstevel@tonic-gate * the signal should be delivered as high priority and any mark 2267c478bd9Sstevel@tonic-gate * indication must flow with the data. This implies that immediately 2277c478bd9Sstevel@tonic-gate * when the SIGURG has been delivered if the stream head queue is 2287c478bd9Sstevel@tonic-gate * empty it is impossible to determine if this will be the position 2297c478bd9Sstevel@tonic-gate * of the mark. This race condition is resolved by using MSGNOTMARKNEXT 2307c478bd9Sstevel@tonic-gate * messages and the STRNOTATMARK flag in the stream head. The 2317c478bd9Sstevel@tonic-gate * SIOCATMARK code calls the stream head to wait for either a 2327c478bd9Sstevel@tonic-gate * non-empty queue or one of the STR*ATMARK flags being set. 2337c478bd9Sstevel@tonic-gate * This implies that any transport that is sending M_PCSIG(SIGURG) 2347c478bd9Sstevel@tonic-gate * should send the appropriate MSGNOTMARKNEXT message (which can be 2357c478bd9Sstevel@tonic-gate * zero length) after sending an M_PCSIG to prevent SIOCATMARK 2367c478bd9Sstevel@tonic-gate * from sleeping unnecessarily. 2377c478bd9Sstevel@tonic-gate */ 2387c478bd9Sstevel@tonic-gate mblk_t *so_oobmsg; /* outofline oob data */ 2397c478bd9Sstevel@tonic-gate uint_t so_oobsigcnt; /* Number of SIGURG generated */ 2407c478bd9Sstevel@tonic-gate uint_t so_oobcnt; /* Number of T_EXDATA_IND queued */ 2417c478bd9Sstevel@tonic-gate pid_t so_pgrp; /* pgrp for signals */ 2427c478bd9Sstevel@tonic-gate 2437c478bd9Sstevel@tonic-gate /* From T_info_ack */ 2447c478bd9Sstevel@tonic-gate t_uscalar_t so_tsdu_size; 2457c478bd9Sstevel@tonic-gate t_uscalar_t so_etsdu_size; 2467c478bd9Sstevel@tonic-gate t_scalar_t so_addr_size; 2477c478bd9Sstevel@tonic-gate t_uscalar_t so_opt_size; 2487c478bd9Sstevel@tonic-gate t_uscalar_t so_tidu_size; 2497c478bd9Sstevel@tonic-gate t_scalar_t so_serv_type; 2507c478bd9Sstevel@tonic-gate 2517c478bd9Sstevel@tonic-gate /* From T_capability_ack */ 2527c478bd9Sstevel@tonic-gate t_uscalar_t so_acceptor_id; 2537c478bd9Sstevel@tonic-gate 2547c478bd9Sstevel@tonic-gate /* Internal provider information */ 2557c478bd9Sstevel@tonic-gate struct tpi_provinfo *so_provinfo; 2567c478bd9Sstevel@tonic-gate 2577c478bd9Sstevel@tonic-gate /* 2587c478bd9Sstevel@tonic-gate * The local and remote addresses have multiple purposes 2597c478bd9Sstevel@tonic-gate * but one of the key reasons for their existence and careful 2607c478bd9Sstevel@tonic-gate * tracking in sockfs is to support getsockname and getpeername 2617c478bd9Sstevel@tonic-gate * when the transport does not handle the TI_GET*NAME ioctls 262da6c28aaSamw * and caching when it does (signaled by valid bits in so_state). 2637c478bd9Sstevel@tonic-gate * When all transports support the new TPI (with T_ADDR_REQ) 2647c478bd9Sstevel@tonic-gate * we can revisit this code. 2657c478bd9Sstevel@tonic-gate * The other usage of so_faddr is to keep the "connected to" 2667c478bd9Sstevel@tonic-gate * address for datagram sockets. 2677c478bd9Sstevel@tonic-gate * Finally, for AF_UNIX both local and remote addresses are used 2687c478bd9Sstevel@tonic-gate * to record the sockaddr_un since we use a separate namespace 2697c478bd9Sstevel@tonic-gate * in the loopback transport. 2707c478bd9Sstevel@tonic-gate */ 2717c478bd9Sstevel@tonic-gate struct soaddr so_laddr; /* Local address */ 2727c478bd9Sstevel@tonic-gate struct soaddr so_faddr; /* Peer address */ 2737c478bd9Sstevel@tonic-gate #define so_laddr_sa so_laddr.soa_sa 2747c478bd9Sstevel@tonic-gate #define so_faddr_sa so_faddr.soa_sa 2757c478bd9Sstevel@tonic-gate #define so_laddr_len so_laddr.soa_len 2767c478bd9Sstevel@tonic-gate #define so_faddr_len so_faddr.soa_len 2777c478bd9Sstevel@tonic-gate #define so_laddr_maxlen so_laddr.soa_maxlen 2787c478bd9Sstevel@tonic-gate #define so_faddr_maxlen so_faddr.soa_maxlen 2797c478bd9Sstevel@tonic-gate mblk_t *so_eaddr_mp; /* for so_delayed_error */ 2807c478bd9Sstevel@tonic-gate 2817c478bd9Sstevel@tonic-gate /* 2827c478bd9Sstevel@tonic-gate * For AF_UNIX sockets: 2837c478bd9Sstevel@tonic-gate * so_ux_laddr/faddr records the internal addresses used with the 2847c478bd9Sstevel@tonic-gate * transport. 2857c478bd9Sstevel@tonic-gate * so_ux_vp and v_stream->sd_vnode form the cross- 2867c478bd9Sstevel@tonic-gate * linkage between the underlying fs vnode corresponding to 2877c478bd9Sstevel@tonic-gate * the bound sockaddr_un and the socket node. 2887c478bd9Sstevel@tonic-gate */ 2897c478bd9Sstevel@tonic-gate struct so_ux_addr so_ux_laddr; /* laddr bound with the transport */ 2907c478bd9Sstevel@tonic-gate struct so_ux_addr so_ux_faddr; /* temporary peer address */ 2917c478bd9Sstevel@tonic-gate struct vnode *so_ux_bound_vp; /* bound AF_UNIX file system vnode */ 2927c478bd9Sstevel@tonic-gate struct sonode *so_next; /* next sonode on socklist */ 2937c478bd9Sstevel@tonic-gate struct sonode *so_prev; /* previous sonode on socklist */ 2947c478bd9Sstevel@tonic-gate mblk_t *so_discon_ind_mp; /* T_DISCON_IND received from below */ 2957c478bd9Sstevel@tonic-gate 2967c478bd9Sstevel@tonic-gate /* put here for delayed processing */ 2977c478bd9Sstevel@tonic-gate void *so_priv; /* sonode private data */ 2987c478bd9Sstevel@tonic-gate cred_t *so_peercred; /* connected socket peer cred */ 2997c478bd9Sstevel@tonic-gate pid_t so_cpid; /* connected socket peer cached pid */ 3007c478bd9Sstevel@tonic-gate zoneid_t so_zoneid; /* opener's zoneid */ 3017c478bd9Sstevel@tonic-gate 3027c478bd9Sstevel@tonic-gate kmem_cache_t *so_cache; /* object cache of this "sonode". */ 3037c478bd9Sstevel@tonic-gate void *so_obj; /* object to free */ 3047c478bd9Sstevel@tonic-gate 3057c478bd9Sstevel@tonic-gate /* 3067c478bd9Sstevel@tonic-gate * For NL7C sockets: 3077c478bd9Sstevel@tonic-gate * 3087c478bd9Sstevel@tonic-gate * so_nl7c_flags the NL7C state of URL processing. 3097c478bd9Sstevel@tonic-gate * 3107c478bd9Sstevel@tonic-gate * so_nl7c_rcv_mp mblk_t chain of already received data to be 3117c478bd9Sstevel@tonic-gate * passed up to the app after NL7C gives up on 3127c478bd9Sstevel@tonic-gate * a socket. 3137c478bd9Sstevel@tonic-gate * 3147c478bd9Sstevel@tonic-gate * so_nl7c_rcv_rval returned rval for last mblk_t from above. 3157c478bd9Sstevel@tonic-gate * 3167c478bd9Sstevel@tonic-gate * so_nl7c_uri the URI currently being processed. 3177c478bd9Sstevel@tonic-gate * 3187c478bd9Sstevel@tonic-gate * so_nl7c_rtime URI request gethrestime_sec(). 3192c9e429eSbrutus * 3202c9e429eSbrutus * so_nl7c_addr pointer returned by nl7c_addr_lookup(). 3217c478bd9Sstevel@tonic-gate */ 3227c478bd9Sstevel@tonic-gate uint64_t so_nl7c_flags; 3237c478bd9Sstevel@tonic-gate mblk_t *so_nl7c_rcv_mp; 3247c478bd9Sstevel@tonic-gate int64_t so_nl7c_rcv_rval; 3257c478bd9Sstevel@tonic-gate void *so_nl7c_uri; 3267c478bd9Sstevel@tonic-gate time_t so_nl7c_rtime; 3272c9e429eSbrutus void *so_nl7c_addr; 328c28749e9Skais 329c28749e9Skais /* For sockets acting as an in-kernel SSL proxy */ 330c28749e9Skais kssl_endpt_type_t so_kssl_type; /* is proxy/is proxied/none */ 331c28749e9Skais kssl_ent_t so_kssl_ent; /* SSL config entry */ 332c28749e9Skais kssl_ctx_t so_kssl_ctx; /* SSL session context */ 33317169044Sbrutus 33417169044Sbrutus /* != NULL for sodirect_t enabled socket */ 33517169044Sbrutus sodirect_t *so_direct; 3367c478bd9Sstevel@tonic-gate }; 3377c478bd9Sstevel@tonic-gate 3387c478bd9Sstevel@tonic-gate /* flags */ 3397c478bd9Sstevel@tonic-gate #define SOMOD 0x0001 /* update socket modification time */ 3407c478bd9Sstevel@tonic-gate #define SOACC 0x0002 /* update socket access time */ 3417c478bd9Sstevel@tonic-gate 3427c478bd9Sstevel@tonic-gate #define SOLOCKED 0x0010 /* use to serialize open/closes */ 3437c478bd9Sstevel@tonic-gate #define SOREADLOCKED 0x0020 /* serialize kstrgetmsg calls */ 3447c478bd9Sstevel@tonic-gate #define SOWANT 0x0040 /* some process waiting on lock */ 3457c478bd9Sstevel@tonic-gate #define SOCLONE 0x0080 /* child of clone driver */ 3467c478bd9Sstevel@tonic-gate #define SOASYNC_UNBIND 0x0100 /* wait for ACK of async unbind */ 3477c478bd9Sstevel@tonic-gate 3487c478bd9Sstevel@tonic-gate /* 3497c478bd9Sstevel@tonic-gate * Socket state bits. 3507c478bd9Sstevel@tonic-gate */ 3517c478bd9Sstevel@tonic-gate #define SS_ISCONNECTED 0x00000001 /* socket connected to a peer */ 3527c478bd9Sstevel@tonic-gate #define SS_ISCONNECTING 0x00000002 /* in process, connecting to peer */ 3537c478bd9Sstevel@tonic-gate #define SS_ISDISCONNECTING 0x00000004 /* in process of disconnecting */ 3547c478bd9Sstevel@tonic-gate #define SS_CANTSENDMORE 0x00000008 /* can't send more data to peer */ 3557c478bd9Sstevel@tonic-gate 3567c478bd9Sstevel@tonic-gate #define SS_CANTRCVMORE 0x00000010 /* can't receive more data */ 3577c478bd9Sstevel@tonic-gate #define SS_ISBOUND 0x00000020 /* socket is bound */ 3587c478bd9Sstevel@tonic-gate #define SS_NDELAY 0x00000040 /* FNDELAY non-blocking */ 3597c478bd9Sstevel@tonic-gate #define SS_NONBLOCK 0x00000080 /* O_NONBLOCK non-blocking */ 3607c478bd9Sstevel@tonic-gate 3617c478bd9Sstevel@tonic-gate #define SS_ASYNC 0x00000100 /* async i/o notify */ 3627c478bd9Sstevel@tonic-gate #define SS_ACCEPTCONN 0x00000200 /* listen done */ 3637c478bd9Sstevel@tonic-gate #define SS_HASCONNIND 0x00000400 /* T_CONN_IND for poll */ 3647c478bd9Sstevel@tonic-gate #define SS_SAVEDEOR 0x00000800 /* Saved MSG_EOR rcv side state */ 3657c478bd9Sstevel@tonic-gate 3667c478bd9Sstevel@tonic-gate #define SS_RCVATMARK 0x00001000 /* at mark on input */ 3677c478bd9Sstevel@tonic-gate #define SS_OOBPEND 0x00002000 /* OOB pending or present - poll */ 3687c478bd9Sstevel@tonic-gate #define SS_HAVEOOBDATA 0x00004000 /* OOB data present */ 3697c478bd9Sstevel@tonic-gate #define SS_HADOOBDATA 0x00008000 /* OOB data consumed */ 3707c478bd9Sstevel@tonic-gate 3717c478bd9Sstevel@tonic-gate #define SS_FADDR_NOXLATE 0x00020000 /* No xlation of faddr for AF_UNIX */ 3727c478bd9Sstevel@tonic-gate 3737c478bd9Sstevel@tonic-gate #define SS_HASDATA 0x00040000 /* NCAfs: data available */ 3747c478bd9Sstevel@tonic-gate #define SS_DONEREAD 0x00080000 /* NCAfs: all data read */ 3757c478bd9Sstevel@tonic-gate #define SS_MOREDATA 0x00100000 /* NCAfs: NCA has more data */ 3767c478bd9Sstevel@tonic-gate 377ff550d0eSmasputra #define SS_DIRECT 0x00200000 /* transport is directly below */ 37817169044Sbrutus #define SS_SODIRECT 0x00400000 /* transport supports sodirect */ 3797c478bd9Sstevel@tonic-gate 3807c478bd9Sstevel@tonic-gate #define SS_LADDR_VALID 0x01000000 /* so_laddr valid for user */ 3817c478bd9Sstevel@tonic-gate #define SS_FADDR_VALID 0x02000000 /* so_faddr valid for user */ 3827c478bd9Sstevel@tonic-gate 3837c478bd9Sstevel@tonic-gate /* Set of states when the socket can't be rebound */ 3847c478bd9Sstevel@tonic-gate #define SS_CANTREBIND (SS_ISCONNECTED|SS_ISCONNECTING|SS_ISDISCONNECTING|\ 3857c478bd9Sstevel@tonic-gate SS_CANTSENDMORE|SS_CANTRCVMORE|SS_ACCEPTCONN) 3867c478bd9Sstevel@tonic-gate 3877c478bd9Sstevel@tonic-gate /* 3887c478bd9Sstevel@tonic-gate * Characteristics of sockets. Not changed after the socket is created. 3897c478bd9Sstevel@tonic-gate */ 3907c478bd9Sstevel@tonic-gate #define SM_PRIV 0x001 /* privileged for broadcast, raw... */ 3917c478bd9Sstevel@tonic-gate #define SM_ATOMIC 0x002 /* atomic data transmission */ 3927c478bd9Sstevel@tonic-gate #define SM_ADDR 0x004 /* addresses given with messages */ 3937c478bd9Sstevel@tonic-gate #define SM_CONNREQUIRED 0x008 /* connection required by protocol */ 3947c478bd9Sstevel@tonic-gate 3957c478bd9Sstevel@tonic-gate #define SM_FDPASSING 0x010 /* passes file descriptors */ 3967c478bd9Sstevel@tonic-gate #define SM_EXDATA 0x020 /* Can handle T_EXDATA_REQ */ 3977c478bd9Sstevel@tonic-gate #define SM_OPTDATA 0x040 /* Can handle T_OPTDATA_REQ */ 3987c478bd9Sstevel@tonic-gate #define SM_BYTESTREAM 0x080 /* Byte stream - can use M_DATA */ 3997c478bd9Sstevel@tonic-gate 4007c478bd9Sstevel@tonic-gate #define SM_ACCEPTOR_ID 0x100 /* so_acceptor_id is valid */ 4017c478bd9Sstevel@tonic-gate 4027c478bd9Sstevel@tonic-gate /* 4037c478bd9Sstevel@tonic-gate * Socket versions. Used by the socket library when calling _so_socket(). 4047c478bd9Sstevel@tonic-gate */ 4057c478bd9Sstevel@tonic-gate #define SOV_STREAM 0 /* Not a socket - just a stream */ 4067c478bd9Sstevel@tonic-gate #define SOV_DEFAULT 1 /* Select based on so_default_version */ 4077c478bd9Sstevel@tonic-gate #define SOV_SOCKSTREAM 2 /* Socket plus streams operations */ 4087c478bd9Sstevel@tonic-gate #define SOV_SOCKBSD 3 /* Socket with no streams operations */ 4097c478bd9Sstevel@tonic-gate #define SOV_XPG4_2 4 /* Xnet socket */ 4107c478bd9Sstevel@tonic-gate 4117c478bd9Sstevel@tonic-gate #if defined(_KERNEL) || defined(_KMEMUSER) 4127c478bd9Sstevel@tonic-gate /* 4137c478bd9Sstevel@tonic-gate * Used for mapping family/type/protocol to vnode. 4147c478bd9Sstevel@tonic-gate * Defined here so that crash can use it. 4157c478bd9Sstevel@tonic-gate */ 4167c478bd9Sstevel@tonic-gate struct sockparams { 4177c478bd9Sstevel@tonic-gate int sp_domain; 4187c478bd9Sstevel@tonic-gate int sp_type; 4197c478bd9Sstevel@tonic-gate int sp_protocol; 4207c478bd9Sstevel@tonic-gate char *sp_devpath; 4217c478bd9Sstevel@tonic-gate int sp_devpathlen; /* Is 0 if sp_devpath is a static string */ 4227c478bd9Sstevel@tonic-gate vnode_t *sp_vnode; 4237c478bd9Sstevel@tonic-gate struct sockparams *sp_next; 4247c478bd9Sstevel@tonic-gate }; 4257c478bd9Sstevel@tonic-gate 4267c478bd9Sstevel@tonic-gate extern struct sockparams *sphead; 4277c478bd9Sstevel@tonic-gate 4287c478bd9Sstevel@tonic-gate /* 4297c478bd9Sstevel@tonic-gate * Used to traverse the list of AF_UNIX sockets to construct the kstat 4307c478bd9Sstevel@tonic-gate * for netstat(1m). 4317c478bd9Sstevel@tonic-gate */ 4327c478bd9Sstevel@tonic-gate struct socklist { 4337c478bd9Sstevel@tonic-gate kmutex_t sl_lock; 4347c478bd9Sstevel@tonic-gate struct sonode *sl_list; 4357c478bd9Sstevel@tonic-gate }; 4367c478bd9Sstevel@tonic-gate 4377c478bd9Sstevel@tonic-gate extern struct socklist socklist; 4387c478bd9Sstevel@tonic-gate /* 4397c478bd9Sstevel@tonic-gate * ss_full_waits is the number of times the reader thread 4407c478bd9Sstevel@tonic-gate * waits when the queue is full and ss_empty_waits is the number 4417c478bd9Sstevel@tonic-gate * of times the consumer thread waits when the queue is empty. 4427c478bd9Sstevel@tonic-gate * No locks for these as they are just indicators of whether 4437c478bd9Sstevel@tonic-gate * disk or network or both is slow or fast. 4447c478bd9Sstevel@tonic-gate */ 4457c478bd9Sstevel@tonic-gate struct sendfile_stats { 4467c478bd9Sstevel@tonic-gate uint32_t ss_file_cached; 4477c478bd9Sstevel@tonic-gate uint32_t ss_file_not_cached; 4487c478bd9Sstevel@tonic-gate uint32_t ss_full_waits; 4497c478bd9Sstevel@tonic-gate uint32_t ss_empty_waits; 4507c478bd9Sstevel@tonic-gate uint32_t ss_file_segmap; 4517c478bd9Sstevel@tonic-gate }; 4527c478bd9Sstevel@tonic-gate 4537c478bd9Sstevel@tonic-gate /* 4547c478bd9Sstevel@tonic-gate * A single sendfile request is represented by snf_req. 4557c478bd9Sstevel@tonic-gate */ 4567c478bd9Sstevel@tonic-gate typedef struct snf_req { 4577c478bd9Sstevel@tonic-gate struct snf_req *sr_next; 4587c478bd9Sstevel@tonic-gate mblk_t *sr_mp_head; 4597c478bd9Sstevel@tonic-gate mblk_t *sr_mp_tail; 4607c478bd9Sstevel@tonic-gate kmutex_t sr_lock; 4617c478bd9Sstevel@tonic-gate kcondvar_t sr_cv; 4627c478bd9Sstevel@tonic-gate uint_t sr_qlen; 4637c478bd9Sstevel@tonic-gate int sr_hiwat; 4647c478bd9Sstevel@tonic-gate int sr_lowat; 4657c478bd9Sstevel@tonic-gate int sr_operation; 4667c478bd9Sstevel@tonic-gate struct vnode *sr_vp; 4677c478bd9Sstevel@tonic-gate file_t *sr_fp; 4687c478bd9Sstevel@tonic-gate ssize_t sr_maxpsz; 4697c478bd9Sstevel@tonic-gate u_offset_t sr_file_off; 4707c478bd9Sstevel@tonic-gate u_offset_t sr_file_size; 4717c478bd9Sstevel@tonic-gate #define SR_READ_DONE 0x80000000 4727c478bd9Sstevel@tonic-gate int sr_read_error; 4737c478bd9Sstevel@tonic-gate int sr_write_error; 4747c478bd9Sstevel@tonic-gate } snf_req_t; 4757c478bd9Sstevel@tonic-gate 4767c478bd9Sstevel@tonic-gate /* A queue of sendfile requests */ 4777c478bd9Sstevel@tonic-gate struct sendfile_queue { 4787c478bd9Sstevel@tonic-gate snf_req_t *snfq_req_head; 4797c478bd9Sstevel@tonic-gate snf_req_t *snfq_req_tail; 4807c478bd9Sstevel@tonic-gate kmutex_t snfq_lock; 4817c478bd9Sstevel@tonic-gate kcondvar_t snfq_cv; 4827c478bd9Sstevel@tonic-gate int snfq_svc_threads; /* # of service threads */ 4837c478bd9Sstevel@tonic-gate int snfq_idle_cnt; /* # of idling threads */ 4847c478bd9Sstevel@tonic-gate int snfq_max_threads; 4857c478bd9Sstevel@tonic-gate int snfq_req_cnt; /* Number of requests */ 4867c478bd9Sstevel@tonic-gate }; 4877c478bd9Sstevel@tonic-gate 4887c478bd9Sstevel@tonic-gate #define READ_OP 1 4897c478bd9Sstevel@tonic-gate #define SNFQ_TIMEOUT (60 * 5 * hz) /* 5 minutes */ 4907c478bd9Sstevel@tonic-gate 4917c478bd9Sstevel@tonic-gate /* Socket network operations switch */ 4927c478bd9Sstevel@tonic-gate struct sonodeops { 4937c478bd9Sstevel@tonic-gate int (*sop_accept)(struct sonode *, int, struct sonode **); 4947c478bd9Sstevel@tonic-gate int (*sop_bind)(struct sonode *, struct sockaddr *, socklen_t, 4957c478bd9Sstevel@tonic-gate int); 4967c478bd9Sstevel@tonic-gate int (*sop_listen)(struct sonode *, int); 4977c478bd9Sstevel@tonic-gate int (*sop_connect)(struct sonode *, const struct sockaddr *, 4987c478bd9Sstevel@tonic-gate socklen_t, int, int); 4997c478bd9Sstevel@tonic-gate int (*sop_recvmsg)(struct sonode *, struct msghdr *, 5007c478bd9Sstevel@tonic-gate struct uio *); 5017c478bd9Sstevel@tonic-gate int (*sop_sendmsg)(struct sonode *, struct msghdr *, 5027c478bd9Sstevel@tonic-gate struct uio *); 5037c478bd9Sstevel@tonic-gate int (*sop_getpeername)(struct sonode *); 5047c478bd9Sstevel@tonic-gate int (*sop_getsockname)(struct sonode *); 5057c478bd9Sstevel@tonic-gate int (*sop_shutdown)(struct sonode *, int); 5067c478bd9Sstevel@tonic-gate int (*sop_getsockopt)(struct sonode *, int, int, void *, 5077c478bd9Sstevel@tonic-gate socklen_t *, int); 5087c478bd9Sstevel@tonic-gate int (*sop_setsockopt)(struct sonode *, int, int, const void *, 5097c478bd9Sstevel@tonic-gate socklen_t); 5107c478bd9Sstevel@tonic-gate }; 5117c478bd9Sstevel@tonic-gate 5127c478bd9Sstevel@tonic-gate #define SOP_ACCEPT(so, fflag, nsop) \ 5137c478bd9Sstevel@tonic-gate ((so)->so_ops->sop_accept((so), (fflag), (nsop))) 5147c478bd9Sstevel@tonic-gate #define SOP_BIND(so, name, namelen, flags) \ 5157c478bd9Sstevel@tonic-gate ((so)->so_ops->sop_bind((so), (name), (namelen), (flags))) 5167c478bd9Sstevel@tonic-gate #define SOP_LISTEN(so, backlog) \ 5177c478bd9Sstevel@tonic-gate ((so)->so_ops->sop_listen((so), (backlog))) 5187c478bd9Sstevel@tonic-gate #define SOP_CONNECT(so, name, namelen, fflag, flags) \ 5197c478bd9Sstevel@tonic-gate ((so)->so_ops->sop_connect((so), (name), (namelen), (fflag), (flags))) 5207c478bd9Sstevel@tonic-gate #define SOP_RECVMSG(so, msg, uiop) \ 5217c478bd9Sstevel@tonic-gate ((so)->so_ops->sop_recvmsg((so), (msg), (uiop))) 5227c478bd9Sstevel@tonic-gate #define SOP_SENDMSG(so, msg, uiop) \ 5237c478bd9Sstevel@tonic-gate ((so)->so_ops->sop_sendmsg((so), (msg), (uiop))) 5247c478bd9Sstevel@tonic-gate #define SOP_GETPEERNAME(so) \ 5257c478bd9Sstevel@tonic-gate ((so)->so_ops->sop_getpeername((so))) 5267c478bd9Sstevel@tonic-gate #define SOP_GETSOCKNAME(so) \ 5277c478bd9Sstevel@tonic-gate ((so)->so_ops->sop_getsockname((so))) 5287c478bd9Sstevel@tonic-gate #define SOP_SHUTDOWN(so, how) \ 5297c478bd9Sstevel@tonic-gate ((so)->so_ops->sop_shutdown((so), (how))) 5307c478bd9Sstevel@tonic-gate #define SOP_GETSOCKOPT(so, level, optionname, optval, optlenp, flags) \ 5317c478bd9Sstevel@tonic-gate ((so)->so_ops->sop_getsockopt((so), (level), (optionname), \ 5327c478bd9Sstevel@tonic-gate (optval), (optlenp), (flags))) 5337c478bd9Sstevel@tonic-gate #define SOP_SETSOCKOPT(so, level, optionname, optval, optlen) \ 5347c478bd9Sstevel@tonic-gate ((so)->so_ops->sop_setsockopt((so), (level), (optionname), \ 5357c478bd9Sstevel@tonic-gate (optval), (optlen))) 5367c478bd9Sstevel@tonic-gate 5377c478bd9Sstevel@tonic-gate #endif /* defined(_KERNEL) || defined(_KMEMUSER) */ 5387c478bd9Sstevel@tonic-gate 5397c478bd9Sstevel@tonic-gate #ifdef _KERNEL 5407c478bd9Sstevel@tonic-gate 5417c478bd9Sstevel@tonic-gate #define ISALIGNED_cmsghdr(addr) \ 5427c478bd9Sstevel@tonic-gate (((uintptr_t)(addr) & (_CMSG_HDR_ALIGNMENT - 1)) == 0) 5437c478bd9Sstevel@tonic-gate 5447c478bd9Sstevel@tonic-gate #define ROUNDUP_cmsglen(len) \ 5457c478bd9Sstevel@tonic-gate (((len) + _CMSG_HDR_ALIGNMENT - 1) & ~(_CMSG_HDR_ALIGNMENT - 1)) 5467c478bd9Sstevel@tonic-gate 5477c478bd9Sstevel@tonic-gate /* 5489acbbeafSnn35248 * Macros that operate on struct cmsghdr. 5499acbbeafSnn35248 * Used in parsing msg_control. 5509acbbeafSnn35248 * The CMSG_VALID macro does not assume that the last option buffer is padded. 5517c478bd9Sstevel@tonic-gate */ 5527c478bd9Sstevel@tonic-gate #define CMSG_NEXT(cmsg) \ 5537c478bd9Sstevel@tonic-gate (struct cmsghdr *)((uintptr_t)(cmsg) + \ 5547c478bd9Sstevel@tonic-gate ROUNDUP_cmsglen((cmsg)->cmsg_len)) 5559acbbeafSnn35248 #define CMSG_CONTENT(cmsg) (&((cmsg)[1])) 5569acbbeafSnn35248 #define CMSG_CONTENTLEN(cmsg) ((cmsg)->cmsg_len - sizeof (struct cmsghdr)) 5579acbbeafSnn35248 #define CMSG_VALID(cmsg, start, end) \ 5589acbbeafSnn35248 (ISALIGNED_cmsghdr(cmsg) && \ 5599acbbeafSnn35248 ((uintptr_t)(cmsg) >= (uintptr_t)(start)) && \ 5609acbbeafSnn35248 ((uintptr_t)(cmsg) < (uintptr_t)(end)) && \ 5619acbbeafSnn35248 ((ssize_t)(cmsg)->cmsg_len >= sizeof (struct cmsghdr)) && \ 5629acbbeafSnn35248 ((uintptr_t)(cmsg) + (cmsg)->cmsg_len <= (uintptr_t)(end))) 5637c478bd9Sstevel@tonic-gate 5647c478bd9Sstevel@tonic-gate /* 5657c478bd9Sstevel@tonic-gate * Maximum size of any argument that is copied in (addresses, options, 5667c478bd9Sstevel@tonic-gate * access rights). MUST be at least MAXPATHLEN + 3. 5677c478bd9Sstevel@tonic-gate * BSD and SunOS 4.X limited this to MLEN or MCLBYTES. 5687c478bd9Sstevel@tonic-gate */ 5697c478bd9Sstevel@tonic-gate #define SO_MAXARGSIZE 8192 5707c478bd9Sstevel@tonic-gate 5717c478bd9Sstevel@tonic-gate /* 5727c478bd9Sstevel@tonic-gate * Convert between vnode and sonode 5737c478bd9Sstevel@tonic-gate */ 5747c478bd9Sstevel@tonic-gate #define VTOSO(vp) ((struct sonode *)((vp)->v_data)) 5757c478bd9Sstevel@tonic-gate #define SOTOV(sp) ((sp)->so_vnode) 5767c478bd9Sstevel@tonic-gate 5777c478bd9Sstevel@tonic-gate /* 5787c478bd9Sstevel@tonic-gate * Internal flags for sobind() 5797c478bd9Sstevel@tonic-gate */ 5807c478bd9Sstevel@tonic-gate #define _SOBIND_REBIND 0x01 /* Bind to existing local address */ 5817c478bd9Sstevel@tonic-gate #define _SOBIND_UNSPEC 0x02 /* Bind to unspecified address */ 5827c478bd9Sstevel@tonic-gate #define _SOBIND_LOCK_HELD 0x04 /* so_excl_lock held by caller */ 5837c478bd9Sstevel@tonic-gate #define _SOBIND_NOXLATE 0x08 /* No addr translation for AF_UNIX */ 5847c478bd9Sstevel@tonic-gate #define _SOBIND_XPG4_2 0x10 /* xpg4.2 semantics */ 5857c478bd9Sstevel@tonic-gate #define _SOBIND_SOCKBSD 0x20 /* BSD semantics */ 5867c478bd9Sstevel@tonic-gate #define _SOBIND_LISTEN 0x40 /* Make into SS_ACCEPTCONN */ 5877c478bd9Sstevel@tonic-gate #define _SOBIND_SOCKETPAIR 0x80 /* Internal flag for so_socketpair() */ 5887c478bd9Sstevel@tonic-gate /* to enable listen with backlog = 1 */ 5897c478bd9Sstevel@tonic-gate 5907c478bd9Sstevel@tonic-gate /* 5917c478bd9Sstevel@tonic-gate * Internal flags for sounbind() 5927c478bd9Sstevel@tonic-gate */ 5937c478bd9Sstevel@tonic-gate #define _SOUNBIND_REBIND 0x01 /* Don't clear fields - will rebind */ 5947c478bd9Sstevel@tonic-gate 5957c478bd9Sstevel@tonic-gate /* 5967c478bd9Sstevel@tonic-gate * Internal flags for soconnect() 5977c478bd9Sstevel@tonic-gate */ 5987c478bd9Sstevel@tonic-gate #define _SOCONNECT_NOXLATE 0x01 /* No addr translation for AF_UNIX */ 5997c478bd9Sstevel@tonic-gate #define _SOCONNECT_DID_BIND 0x02 /* Unbind when connect fails */ 6007c478bd9Sstevel@tonic-gate #define _SOCONNECT_XPG4_2 0x04 /* xpg4.2 semantics */ 6017c478bd9Sstevel@tonic-gate 6027c478bd9Sstevel@tonic-gate /* 6037c478bd9Sstevel@tonic-gate * Internal flags for sodisconnect() 6047c478bd9Sstevel@tonic-gate */ 6057c478bd9Sstevel@tonic-gate #define _SODISCONNECT_LOCK_HELD 0x01 /* so_excl_lock held by caller */ 6067c478bd9Sstevel@tonic-gate 6077c478bd9Sstevel@tonic-gate /* 6087c478bd9Sstevel@tonic-gate * Internal flags for sotpi_getsockopt(). 6097c478bd9Sstevel@tonic-gate */ 6107c478bd9Sstevel@tonic-gate #define _SOGETSOCKOPT_XPG4_2 0x01 /* xpg4.2 semantics */ 6117c478bd9Sstevel@tonic-gate 6127c478bd9Sstevel@tonic-gate /* 6137c478bd9Sstevel@tonic-gate * Internal flags for soallocproto*() 6147c478bd9Sstevel@tonic-gate */ 6157c478bd9Sstevel@tonic-gate #define _ALLOC_NOSLEEP 0 /* Don't sleep for memory */ 6167c478bd9Sstevel@tonic-gate #define _ALLOC_INTR 1 /* Sleep until interrupt */ 6177c478bd9Sstevel@tonic-gate #define _ALLOC_SLEEP 2 /* Sleep forever */ 6187c478bd9Sstevel@tonic-gate 6197c478bd9Sstevel@tonic-gate /* 6207c478bd9Sstevel@tonic-gate * Internal structure for handling AF_UNIX file descriptor passing 6217c478bd9Sstevel@tonic-gate */ 6227c478bd9Sstevel@tonic-gate struct fdbuf { 6237c478bd9Sstevel@tonic-gate int fd_size; /* In bytes, for kmem_free */ 6247c478bd9Sstevel@tonic-gate int fd_numfd; /* Number of elements below */ 6257c478bd9Sstevel@tonic-gate char *fd_ebuf; /* Extra buffer to free */ 6267c478bd9Sstevel@tonic-gate int fd_ebuflen; 6277c478bd9Sstevel@tonic-gate frtn_t fd_frtn; 6287c478bd9Sstevel@tonic-gate struct file *fd_fds[1]; /* One or more */ 6297c478bd9Sstevel@tonic-gate }; 6307c478bd9Sstevel@tonic-gate #define FDBUF_HDRSIZE (sizeof (struct fdbuf) - sizeof (struct file *)) 6317c478bd9Sstevel@tonic-gate 6327c478bd9Sstevel@tonic-gate /* 6337c478bd9Sstevel@tonic-gate * Variable that can be patched to set what version of socket socket() 6347c478bd9Sstevel@tonic-gate * will create. 6357c478bd9Sstevel@tonic-gate */ 6367c478bd9Sstevel@tonic-gate extern int so_default_version; 6377c478bd9Sstevel@tonic-gate 6387c478bd9Sstevel@tonic-gate #ifdef DEBUG 6397c478bd9Sstevel@tonic-gate /* Turn on extra testing capabilities */ 6407c478bd9Sstevel@tonic-gate #define SOCK_TEST 6417c478bd9Sstevel@tonic-gate #endif /* DEBUG */ 6427c478bd9Sstevel@tonic-gate 6437c478bd9Sstevel@tonic-gate #ifdef DEBUG 6447c478bd9Sstevel@tonic-gate char *pr_state(uint_t, uint_t); 6457c478bd9Sstevel@tonic-gate char *pr_addr(int, struct sockaddr *, t_uscalar_t); 6467c478bd9Sstevel@tonic-gate int so_verify_oobstate(struct sonode *); 6477c478bd9Sstevel@tonic-gate #endif /* DEBUG */ 6487c478bd9Sstevel@tonic-gate 6497c478bd9Sstevel@tonic-gate /* 6507c478bd9Sstevel@tonic-gate * DEBUG macros 6517c478bd9Sstevel@tonic-gate */ 652*8793b36bSNick Todd #if defined(DEBUG) 6537c478bd9Sstevel@tonic-gate #define SOCK_DEBUG 6547c478bd9Sstevel@tonic-gate 6557c478bd9Sstevel@tonic-gate extern int sockdebug; 6567c478bd9Sstevel@tonic-gate extern int sockprinterr; 6577c478bd9Sstevel@tonic-gate 6587c478bd9Sstevel@tonic-gate #define eprint(args) printf args 6597c478bd9Sstevel@tonic-gate #define eprintso(so, args) \ 6607c478bd9Sstevel@tonic-gate { if (sockprinterr && ((so)->so_options & SO_DEBUG)) printf args; } 6617c478bd9Sstevel@tonic-gate #define eprintline(error) \ 6627c478bd9Sstevel@tonic-gate { \ 6637c478bd9Sstevel@tonic-gate if (error != EINTR && (sockprinterr || sockdebug > 0)) \ 6647c478bd9Sstevel@tonic-gate printf("socket error %d: line %d file %s\n", \ 6657c478bd9Sstevel@tonic-gate (error), __LINE__, __FILE__); \ 6667c478bd9Sstevel@tonic-gate } 6677c478bd9Sstevel@tonic-gate 6687c478bd9Sstevel@tonic-gate #define eprintsoline(so, error) \ 6697c478bd9Sstevel@tonic-gate { if (sockprinterr && ((so)->so_options & SO_DEBUG)) \ 6707c478bd9Sstevel@tonic-gate printf("socket(%p) error %d: line %d file %s\n", \ 671*8793b36bSNick Todd (void *)(so), (error), __LINE__, __FILE__); \ 6727c478bd9Sstevel@tonic-gate } 6737c478bd9Sstevel@tonic-gate #define dprint(level, args) { if (sockdebug > (level)) printf args; } 6747c478bd9Sstevel@tonic-gate #define dprintso(so, level, args) \ 6757c478bd9Sstevel@tonic-gate { if (sockdebug > (level) && ((so)->so_options & SO_DEBUG)) printf args; } 6767c478bd9Sstevel@tonic-gate 677*8793b36bSNick Todd #else /* define(DEBUG) */ 6787c478bd9Sstevel@tonic-gate 6797c478bd9Sstevel@tonic-gate #define eprint(args) {} 6807c478bd9Sstevel@tonic-gate #define eprintso(so, args) {} 6817c478bd9Sstevel@tonic-gate #define eprintline(error) {} 6827c478bd9Sstevel@tonic-gate #define eprintsoline(so, error) {} 6837c478bd9Sstevel@tonic-gate #define dprint(level, args) {} 6847c478bd9Sstevel@tonic-gate #define dprintso(so, level, args) {} 6857c478bd9Sstevel@tonic-gate 686*8793b36bSNick Todd #endif /* defined(DEBUG) */ 6877c478bd9Sstevel@tonic-gate 6887c478bd9Sstevel@tonic-gate extern struct vfsops sock_vfsops; 6897c478bd9Sstevel@tonic-gate extern struct vnodeops *socktpi_vnodeops; 6907c478bd9Sstevel@tonic-gate extern const struct fs_operation_def socktpi_vnodeops_template[]; 6917c478bd9Sstevel@tonic-gate 6927c478bd9Sstevel@tonic-gate extern sonodeops_t sotpi_sonodeops; 6937c478bd9Sstevel@tonic-gate 6947c478bd9Sstevel@tonic-gate extern dev_t sockdev; 6957c478bd9Sstevel@tonic-gate 6967c478bd9Sstevel@tonic-gate /* 6977c478bd9Sstevel@tonic-gate * sockfs functions 6987c478bd9Sstevel@tonic-gate */ 6997c478bd9Sstevel@tonic-gate extern int sock_getmsg(vnode_t *, struct strbuf *, struct strbuf *, 7007c478bd9Sstevel@tonic-gate uchar_t *, int *, int, rval_t *); 7017c478bd9Sstevel@tonic-gate extern int sock_putmsg(vnode_t *, struct strbuf *, struct strbuf *, 7027c478bd9Sstevel@tonic-gate uchar_t, int, int); 7037c478bd9Sstevel@tonic-gate struct sonode *sotpi_create(vnode_t *, int, int, int, int, struct sonode *, 7047c478bd9Sstevel@tonic-gate int *); 705da6c28aaSamw extern int socktpi_open(struct vnode **, int, struct cred *, 706da6c28aaSamw caller_context_t *); 7077c478bd9Sstevel@tonic-gate extern int so_sock2stream(struct sonode *); 7087c478bd9Sstevel@tonic-gate extern void so_stream2sock(struct sonode *); 7097c478bd9Sstevel@tonic-gate extern int sockinit(int, char *); 7107c478bd9Sstevel@tonic-gate extern struct vnode 7117c478bd9Sstevel@tonic-gate *makesockvp(struct vnode *, int, int, int); 7127c478bd9Sstevel@tonic-gate extern void sockfree(struct sonode *); 7137c478bd9Sstevel@tonic-gate extern void so_update_attrs(struct sonode *, int); 7147c478bd9Sstevel@tonic-gate extern int soconfig(int, int, int, char *, int); 7157c478bd9Sstevel@tonic-gate extern struct vnode 7167c478bd9Sstevel@tonic-gate *solookup(int, int, int, char *, int *); 7177c478bd9Sstevel@tonic-gate extern void so_lock_single(struct sonode *); 7187c478bd9Sstevel@tonic-gate extern void so_unlock_single(struct sonode *, int); 7197c478bd9Sstevel@tonic-gate extern int so_lock_read(struct sonode *, int); 7207c478bd9Sstevel@tonic-gate extern int so_lock_read_intr(struct sonode *, int); 7217c478bd9Sstevel@tonic-gate extern void so_unlock_read(struct sonode *); 7227c478bd9Sstevel@tonic-gate extern void *sogetoff(mblk_t *, t_uscalar_t, t_uscalar_t, uint_t); 7237c478bd9Sstevel@tonic-gate extern void so_getopt_srcaddr(void *, t_uscalar_t, 7247c478bd9Sstevel@tonic-gate void **, t_uscalar_t *); 7257c478bd9Sstevel@tonic-gate extern int so_getopt_unix_close(void *, t_uscalar_t); 7267c478bd9Sstevel@tonic-gate extern int so_addr_verify(struct sonode *, const struct sockaddr *, 7277c478bd9Sstevel@tonic-gate socklen_t); 7287c478bd9Sstevel@tonic-gate extern int so_ux_addr_xlate(struct sonode *, struct sockaddr *, 7297c478bd9Sstevel@tonic-gate socklen_t, int, void **, socklen_t *); 7307c478bd9Sstevel@tonic-gate extern void fdbuf_free(struct fdbuf *); 7317c478bd9Sstevel@tonic-gate extern mblk_t *fdbuf_allocmsg(int, struct fdbuf *); 7327c478bd9Sstevel@tonic-gate extern int fdbuf_create(void *, int, struct fdbuf **); 7337c478bd9Sstevel@tonic-gate extern void so_closefds(void *, t_uscalar_t, int, int); 7347c478bd9Sstevel@tonic-gate extern int so_getfdopt(void *, t_uscalar_t, int, void **, int *); 7357c478bd9Sstevel@tonic-gate t_uscalar_t so_optlen(void *, t_uscalar_t, int); 7367c478bd9Sstevel@tonic-gate extern void so_cmsg2opt(void *, t_uscalar_t, int, mblk_t *); 7377c478bd9Sstevel@tonic-gate extern t_uscalar_t 7387c478bd9Sstevel@tonic-gate so_cmsglen(mblk_t *, void *, t_uscalar_t, int); 7397c478bd9Sstevel@tonic-gate extern int so_opt2cmsg(mblk_t *, void *, t_uscalar_t, int, 7407c478bd9Sstevel@tonic-gate void *, t_uscalar_t); 7417c478bd9Sstevel@tonic-gate extern void soisconnecting(struct sonode *); 7427c478bd9Sstevel@tonic-gate extern void soisconnected(struct sonode *); 7437c478bd9Sstevel@tonic-gate extern void soisdisconnected(struct sonode *, int); 7447c478bd9Sstevel@tonic-gate extern void socantsendmore(struct sonode *); 7457c478bd9Sstevel@tonic-gate extern void socantrcvmore(struct sonode *); 7467c478bd9Sstevel@tonic-gate extern void soseterror(struct sonode *, int); 7477c478bd9Sstevel@tonic-gate extern int sogeterr(struct sonode *); 7487c478bd9Sstevel@tonic-gate extern int sogetrderr(vnode_t *, int, int *); 7497c478bd9Sstevel@tonic-gate extern int sogetwrerr(vnode_t *, int, int *); 7507c478bd9Sstevel@tonic-gate extern void so_unix_close(struct sonode *); 7517c478bd9Sstevel@tonic-gate extern mblk_t *soallocproto(size_t, int); 7527c478bd9Sstevel@tonic-gate extern mblk_t *soallocproto1(const void *, ssize_t, ssize_t, int); 7537c478bd9Sstevel@tonic-gate extern void soappendmsg(mblk_t *, const void *, ssize_t); 7547c478bd9Sstevel@tonic-gate extern mblk_t *soallocproto2(const void *, ssize_t, const void *, ssize_t, 7557c478bd9Sstevel@tonic-gate ssize_t, int); 7567c478bd9Sstevel@tonic-gate extern mblk_t *soallocproto3(const void *, ssize_t, const void *, ssize_t, 7577c478bd9Sstevel@tonic-gate const void *, ssize_t, ssize_t, int); 7587c478bd9Sstevel@tonic-gate extern int sowaitprim(struct sonode *, t_scalar_t, t_scalar_t, 7597c478bd9Sstevel@tonic-gate t_uscalar_t, mblk_t **, clock_t); 7607c478bd9Sstevel@tonic-gate extern int sowaitokack(struct sonode *, t_scalar_t); 7617c478bd9Sstevel@tonic-gate extern int sowaitack(struct sonode *, mblk_t **, clock_t); 7627c478bd9Sstevel@tonic-gate extern void soqueueack(struct sonode *, mblk_t *); 7637c478bd9Sstevel@tonic-gate extern int sowaitconnind(struct sonode *, int, mblk_t **); 7647c478bd9Sstevel@tonic-gate extern void soqueueconnind(struct sonode *, mblk_t *); 7657c478bd9Sstevel@tonic-gate extern int soflushconnind(struct sonode *, t_scalar_t); 7667c478bd9Sstevel@tonic-gate extern void so_drain_discon_ind(struct sonode *); 7677c478bd9Sstevel@tonic-gate extern void so_flush_discon_ind(struct sonode *); 7687c478bd9Sstevel@tonic-gate extern int sowaitconnected(struct sonode *, int, int); 7697c478bd9Sstevel@tonic-gate 770ff550d0eSmasputra extern int sostream_direct(struct sonode *, struct uio *, 771ff550d0eSmasputra mblk_t *, cred_t *); 7727c478bd9Sstevel@tonic-gate extern int sosend_dgram(struct sonode *, struct sockaddr *, 7737c478bd9Sstevel@tonic-gate socklen_t, struct uio *, int); 7747c478bd9Sstevel@tonic-gate extern int sosend_svc(struct sonode *, struct uio *, t_scalar_t, int, int); 7757c478bd9Sstevel@tonic-gate extern void so_installhooks(struct sonode *); 7767c478bd9Sstevel@tonic-gate extern int so_strinit(struct sonode *, struct sonode *); 7777c478bd9Sstevel@tonic-gate extern int sotpi_recvmsg(struct sonode *, struct nmsghdr *, 7787c478bd9Sstevel@tonic-gate struct uio *); 7797c478bd9Sstevel@tonic-gate extern int sotpi_getpeername(struct sonode *); 7807c478bd9Sstevel@tonic-gate extern int sotpi_getsockopt(struct sonode *, int, int, void *, 7817c478bd9Sstevel@tonic-gate socklen_t *, int); 7827c478bd9Sstevel@tonic-gate extern int sotpi_setsockopt(struct sonode *, int, int, const void *, 7837c478bd9Sstevel@tonic-gate socklen_t); 7847c478bd9Sstevel@tonic-gate extern int socktpi_ioctl(struct vnode *, int, intptr_t, int, 785da6c28aaSamw struct cred *, int *, caller_context_t *); 7867c478bd9Sstevel@tonic-gate extern int sodisconnect(struct sonode *, t_scalar_t, int); 7877c478bd9Sstevel@tonic-gate extern ssize_t soreadfile(file_t *, uchar_t *, u_offset_t, int *, size_t); 7887c478bd9Sstevel@tonic-gate extern int so_set_asyncsigs(vnode_t *, pid_t, int, int, cred_t *); 7897c478bd9Sstevel@tonic-gate extern int so_set_events(struct sonode *, vnode_t *, cred_t *); 7907c478bd9Sstevel@tonic-gate extern int so_flip_async(struct sonode *, vnode_t *, int, cred_t *); 7917c478bd9Sstevel@tonic-gate extern int so_set_siggrp(struct sonode *, vnode_t *, pid_t, int, cred_t *); 7927c478bd9Sstevel@tonic-gate extern void *sock_kstat_init(zoneid_t); 7937c478bd9Sstevel@tonic-gate extern void sock_kstat_fini(zoneid_t, void *); 794745b2690Stz204579 extern struct sonode *getsonode(int, int *, file_t **); 7957c478bd9Sstevel@tonic-gate 7967c478bd9Sstevel@tonic-gate /* 797da6c28aaSamw * Function wrappers (mostly around the sonode switch) for 7987c478bd9Sstevel@tonic-gate * backward compatibility. 7997c478bd9Sstevel@tonic-gate */ 8007c478bd9Sstevel@tonic-gate extern int soaccept(struct sonode *, int, struct sonode **); 8017c478bd9Sstevel@tonic-gate extern int sobind(struct sonode *, struct sockaddr *, socklen_t, 8027c478bd9Sstevel@tonic-gate int, int); 8037c478bd9Sstevel@tonic-gate extern int solisten(struct sonode *, int); 8047c478bd9Sstevel@tonic-gate extern int soconnect(struct sonode *, const struct sockaddr *, socklen_t, 8057c478bd9Sstevel@tonic-gate int, int); 8067c478bd9Sstevel@tonic-gate extern int sorecvmsg(struct sonode *, struct nmsghdr *, struct uio *); 8077c478bd9Sstevel@tonic-gate extern int sosendmsg(struct sonode *, struct nmsghdr *, struct uio *); 8087c478bd9Sstevel@tonic-gate extern int sogetpeername(struct sonode *); 8097c478bd9Sstevel@tonic-gate extern int sogetsockname(struct sonode *); 8107c478bd9Sstevel@tonic-gate extern int soshutdown(struct sonode *, int); 8117c478bd9Sstevel@tonic-gate extern int sogetsockopt(struct sonode *, int, int, void *, socklen_t *, 8127c478bd9Sstevel@tonic-gate int); 8137c478bd9Sstevel@tonic-gate extern int sosetsockopt(struct sonode *, int, int, const void *, 8147c478bd9Sstevel@tonic-gate t_uscalar_t); 8157c478bd9Sstevel@tonic-gate 8167c478bd9Sstevel@tonic-gate extern struct sonode *socreate(vnode_t *, int, int, int, int, 8177c478bd9Sstevel@tonic-gate struct sonode *, int *); 8187c478bd9Sstevel@tonic-gate 8197c478bd9Sstevel@tonic-gate extern int so_copyin(const void *, void *, size_t, int); 8207c478bd9Sstevel@tonic-gate extern int so_copyout(const void *, void *, size_t, int); 8217c478bd9Sstevel@tonic-gate 822da6c28aaSamw extern int socktpi_access(struct vnode *, int, int, struct cred *, 823da6c28aaSamw caller_context_t *); 824da6c28aaSamw extern int socktpi_fid(struct vnode *, struct fid *, caller_context_t *); 825da6c28aaSamw extern int socktpi_fsync(struct vnode *, int, struct cred *, 826da6c28aaSamw caller_context_t *); 8277c478bd9Sstevel@tonic-gate extern int socktpi_getattr(struct vnode *, struct vattr *, int, 828da6c28aaSamw struct cred *, caller_context_t *); 829da6c28aaSamw extern int socktpi_seek(struct vnode *, offset_t, offset_t *, 830da6c28aaSamw caller_context_t *); 8317c478bd9Sstevel@tonic-gate extern int socktpi_setattr(struct vnode *, struct vattr *, int, 8327c478bd9Sstevel@tonic-gate struct cred *, caller_context_t *); 833da6c28aaSamw extern int socktpi_setfl(vnode_t *, int, int, cred_t *, 834da6c28aaSamw caller_context_t *); 8357c478bd9Sstevel@tonic-gate 8367c478bd9Sstevel@tonic-gate /* SCTP sockfs */ 8377c478bd9Sstevel@tonic-gate extern struct sonode *sosctp_create(vnode_t *, int, int, int, int, 8387c478bd9Sstevel@tonic-gate struct sonode *, int *); 8397c478bd9Sstevel@tonic-gate extern int sosctp_init(void); 8407c478bd9Sstevel@tonic-gate 84174e20cfeSnh145002 /* SDP sockfs */ 84274e20cfeSnh145002 extern struct sonode *sosdp_create(vnode_t *, int, int, int, int, 84374e20cfeSnh145002 struct sonode *, int *); 84474e20cfeSnh145002 extern int sosdp_init(void); 84574e20cfeSnh145002 8467c478bd9Sstevel@tonic-gate #endif 8477c478bd9Sstevel@tonic-gate 8487c478bd9Sstevel@tonic-gate /* 8497c478bd9Sstevel@tonic-gate * Internal structure for obtaining sonode information from the socklist. 8507c478bd9Sstevel@tonic-gate * These types match those corresponding in the sonode structure. 8517c478bd9Sstevel@tonic-gate * This is not a published interface, and may change at any time. 8527c478bd9Sstevel@tonic-gate */ 8537c478bd9Sstevel@tonic-gate struct sockinfo { 8547c478bd9Sstevel@tonic-gate uint_t si_size; /* real length of this struct */ 8557c478bd9Sstevel@tonic-gate short si_family; 8567c478bd9Sstevel@tonic-gate short si_type; 8577c478bd9Sstevel@tonic-gate ushort_t si_flag; 8587c478bd9Sstevel@tonic-gate uint_t si_state; 8597c478bd9Sstevel@tonic-gate uint_t si_ux_laddr_sou_magic; 8607c478bd9Sstevel@tonic-gate uint_t si_ux_faddr_sou_magic; 8617c478bd9Sstevel@tonic-gate t_scalar_t si_serv_type; 8627c478bd9Sstevel@tonic-gate t_uscalar_t si_laddr_soa_len; 8637c478bd9Sstevel@tonic-gate t_uscalar_t si_faddr_soa_len; 8647c478bd9Sstevel@tonic-gate uint16_t si_laddr_family; 8657c478bd9Sstevel@tonic-gate uint16_t si_faddr_family; 8667c478bd9Sstevel@tonic-gate char si_laddr_sun_path[MAXPATHLEN + 1]; /* NULL terminated */ 8677c478bd9Sstevel@tonic-gate char si_faddr_sun_path[MAXPATHLEN + 1]; 8687c478bd9Sstevel@tonic-gate zoneid_t si_szoneid; 8697c478bd9Sstevel@tonic-gate }; 8707c478bd9Sstevel@tonic-gate 8717c478bd9Sstevel@tonic-gate 8727c478bd9Sstevel@tonic-gate #ifdef __cplusplus 8737c478bd9Sstevel@tonic-gate } 8747c478bd9Sstevel@tonic-gate #endif 8757c478bd9Sstevel@tonic-gate 8767c478bd9Sstevel@tonic-gate #endif /* _SYS_SOCKETVAR_H */ 877