/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* Copyright 2011 Nexenta Systems, Inc. All rights reserved.
* Copyright (c) 2012 by Delphix. All rights reserved.
* Copyright 2015 Joyent, Inc.
*/
/*
* Multithreaded STREAMS Local Transport Provider.
*
* OVERVIEW
* ========
*
* This driver provides TLI as well as socket semantics. It provides
* connectionless, connection oriented, and connection oriented with orderly
* release transports for TLI and sockets. Each transport type has separate name
* spaces (i.e. it is not possible to connect from a socket to a TLI endpoint) -
* this removes any name space conflicts when binding to socket style transport
* addresses.
*
* NOTE: There is one exception: Socket ticots and ticotsord transports share
* the same namespace. In fact, sockets always use ticotsord type transport.
*
* The driver mode is specified during open() by the minor number used for
* open.
*
* The sockets in addition have the following semantic differences:
* No support for passing up credentials (TL_SET[U]CRED).
*
* Options are passed through transparently on T_CONN_REQ to T_CONN_IND,
* from T_UNITDATA_REQ to T_UNIDATA_IND, and from T_OPTDATA_REQ to
* T_OPTDATA_IND.
*
* The T_CONN_CON is generated when processing the T_CONN_REQ i.e. before
* a T_CONN_RES is received from the acceptor. This means that a socket
* connect will complete before the peer has called accept.
*
*
* MULTITHREADING
* ==============
*
* The driver does not use STREAMS protection mechanisms. Instead it uses a
* generic "serializer" abstraction. Most of the operations are executed behind
* the serializer and are, essentially single-threaded. All functions executed
* behind the same serializer are strictly serialized. So if one thread calls
* serializer_enter(serializer, foo, mp1, arg1); and another thread calls
* serializer_enter(serializer, bar, mp2, arg1); then (depending on which one
* was called) the actual sequence will be foo(mp1, arg1); bar(mp1, arg2) or
* bar(mp1, arg2); foo(mp1, arg1); But foo() and bar() will never run at the
* same time.
*
* Connectionless transport use a single serializer per transport type (one for
* TLI and one for sockets. Connection-oriented transports use finer-grained
* serializers.
*
* All COTS-type endpoints start their life with private serializers. During
* connection request processing the endpoint serializer is switched to the
* listener's serializer and the rest of T_CONN_REQ processing is done on the
* listener serializer. During T_CONN_RES processing the eager serializer is
* switched from listener to acceptor serializer and after that point all
* processing for eager and acceptor happens on this serializer. To avoid races
* with endpoint closes while its serializer may be changing closes are blocked
* while serializers are manipulated.
*
* References accounting
* ---------------------
*
* Endpoints are reference counted and freed when the last reference is
* dropped. Functions within the serializer may access an endpoint state even
* after an endpoint closed. The te_closing being set on the endpoint indicates
* that the endpoint entered its close routine.
*
* One reference is held for each opened endpoint instance. The reference
* counter is incremented when the endpoint is linked to another endpoint and
* decremented when the link disappears. It is also incremented when the
* endpoint is found by the hash table lookup. This increment is atomic with the
* lookup itself and happens while the hash table read lock is held.
*
* Close synchronization
* ---------------------
*
* During close the endpoint as marked as closing using te_closing flag. It is
* usually enough to check for te_closing flag since all other state changes
* happen after this flag is set and the close entered serializer. Immediately
* after setting te_closing flag tl_close() enters serializer and waits until
* the callback finishes. This allows all functions called within serializer to
* simply check te_closing without any locks.
*
* Serializer management.
* ---------------------
*
* For COTS transports serializers are created when the endpoint is constructed
* and destroyed when the endpoint is destructed. CLTS transports use global
* serializers - one for sockets and one for TLI.
*
* COTS serializers have separate reference counts to deal with several
* endpoints sharing the same serializer. There is a subtle problem related to
* the serializer destruction. The serializer should never be destroyed by any
* function executed inside serializer. This means that close has to wait till
* all serializer activity for this endpoint is finished before it can drop the
* last reference on the endpoint (which may as well free the serializer). This
* is only relevant for COTS transports which manage serializers
* dynamically. For CLTS transports close may complete without waiting for all
* serializer activity to finish since serializer is only destroyed at driver
* detach time.
*
* COTS endpoints keep track of the number of outstanding requests on the
* serializer for the endpoint. The code handling accept() avoids changing
* client serializer if it has any pending messages on the serializer and
* instead moves acceptor to listener's serializer.
*
*
* Use of hash tables
* ------------------
*
* The driver uses modhash hash table implementation. Each transport uses two
* hash tables - one for finding endpoints by acceptor ID and another one for
* finding endpoints by address. For sockets TICOTS and TICOTSORD share the same
* pair of hash tables since sockets only use TICOTSORD.
*
* All hash tables lookups increment a reference count for returned endpoints,
* so we may safely check the endpoint state even when the endpoint is removed
* from the hash by another thread immediately after it is found.
*
*
* CLOSE processing
* ================
*
* The driver enters serializer twice on close(). The close sequence is the
* following:
*
* 1) Wait until closing is safe (te_closewait becomes zero)
* This step is needed to prevent close during serializer switches. In most
* cases (close happening after connection establishment) te_closewait is
* zero.
* 1) Set te_closing.
* 2) Call tl_close_ser() within serializer and wait for it to complete.
*
* te_close_ser simply marks endpoint and wakes up waiting tl_close().
* It also needs to clear write-side q_next pointers - this should be done
* before qprocsoff().
*
* This synchronous serializer entry during close is needed to ensure that
* the queue is valid everywhere inside the serializer.
*
* Note that in many cases close will execute tl_close_ser() synchronously,
* so it will not wait at all.
*
* 3) Calls qprocsoff().
* 4) Calls tl_close_finish_ser() within the serializer and waits for it to
* complete (for COTS transports). For CLTS transport there is no wait.
*
* tl_close_finish_ser() Finishes the close process and wakes up waiting
* close if there is any.
*
* Note that in most cases close will enter te_close_ser_finish()
* synchronously and will not wait at all.
*
*
* Flow Control
* ============
*
* The driver implements both read and write side service routines. No one calls
* putq() on the read queue. The read side service routine tl_rsrv() is called
* when the read side stream is back-enabled. It enters serializer synchronously
* (waits till serializer processing is complete). Within serializer it
* back-enables all endpoints blocked by the queue for connection-less
* transports and enables write side service processing for the peer for
* connection-oriented transports.
*
* Read and write side service routines use special mblk_sized space in the
* endpoint structure to enter perimeter.
*
* Write-side flow control
* -----------------------
*
* Write side flow control is a bit tricky. The driver needs to deal with two
* message queues - the explicit STREAMS message queue maintained by
* putq()/getq()/putbq() and the implicit queue within the serializer. These two
* queues should be synchronized to preserve message ordering and should
* maintain a single order determined by the order in which messages enter
* tl_wput(). In order to maintain the ordering between these two queues the
* STREAMS queue is only manipulated within the serializer, so the ordering is
* provided by the serializer.
*
* Functions called from the tl_wsrv() sometimes may call putbq(). To
* immediately stop any further processing of the STREAMS message queues the
* code calling putbq() also sets the te_nowsrv flag in the endpoint. The write
* side service processing stops when the flag is set.
*
* The tl_wsrv() function enters serializer synchronously and waits for it to
* complete. The serializer call-back tl_wsrv_ser() either drains all messages
* on the STREAMS queue or terminates when it notices the te_nowsrv flag
* set. Note that the maximum amount of messages processed by tl_wput_ser() is
* always bounded by the amount of messages on the STREAMS queue at the time
* tl_wsrv_ser() is entered. Any new messages may only appear on the STREAMS
* queue from another serialized entry which can't happen in parallel. This
* guarantees that tl_wput_ser() is complete in bounded time (there is no risk
* of it draining forever while writer places new messages on the STREAMS
* queue).
*
* Note that a closing endpoint never sets te_nowsrv and never calls putbq().
*
*
* Unix Domain Sockets
* ===================
*
* The driver knows the structure of Unix Domain sockets addresses and treats
* them differently from generic TLI addresses. For sockets implicit binds are
* requested by setting SOU_MAGIC_IMPLICIT in the soua_magic part of the address
* instead of using address length of zero. Explicit binds specify
* SOU_MAGIC_EXPLICIT as magic.
*
* For implicit binds we always use minor number as soua_vp part of the address
* and avoid any hash table lookups. This saves two hash tables lookups per
* anonymous bind.
*
* For explicit address we hash the vnode pointer instead of hashing the
* full-scale address+zone+length. Hashing by pointer is more efficient then
* hashing by the full address.
*
* For unix domain sockets the te_ap is always pointing to te_uxaddr part of the
* tep structure, so it should be never freed.
*
* Also for sockets the driver always uses minor number as acceptor id.
*
* TPI VIOLATIONS
* --------------
*
* This driver violates TPI in several respects for Unix Domain Sockets:
*
* 1) It treats O_T_BIND_REQ as T_BIND_REQ and refuses bind if an explicit bind
* is requested and the endpoint is already in use. There is no point in
* generating an unused address since this address will be rejected by
* sockfs anyway. For implicit binds it always generates a new address
* (sets soua_vp to its minor number).
*
* 2) It always uses minor number as acceptor ID and never uses queue
* pointer. It is ok since sockets get acceptor ID from T_CAPABILITY_REQ
* message and they do not use the queue pointer.
*
* 3) For Listener sockets the usual sequence is to issue bind() zero backlog
* followed by listen(). The listen() should be issued with non-zero
* backlog, so sotpi_listen() issues unbind request followed by bind
* request to the same address but with a non-zero qlen value. Both
* tl_bind() and tl_unbind() require write lock on the hash table to
* the hash for endpoints that are bound to the explicit address and have
* backlog of zero. During T_BIND_REQ processing if the address requested
* is equal to the address the endpoint already has it updates the backlog
* without reinserting the address in the hash table. This optimization
* avoids two hash table updates for each listener created. It always
* avoids the problem of a "stolen" address when another listener may use
* the same address between the unbind and bind and suddenly listen() fails
* because address is in use even though the bind() succeeded.
*
*
* CONNECTIONLESS TRANSPORTS
* =========================
*
* Connectionless transports all share the same serializer (one for TLI and one
* for Sockets). Functions executing behind serializer can check or modify state
* of any endpoint.
*
* When endpoint X talks to another endpoint Y it caches the pointer to Y in the
* te_lastep field. The next time X talks to some address A it checks whether A
* is the same as Y's address and if it is there is no need to lookup Y. If the
* address is different or the state of Y is not appropriate (e.g. closed or not
* idle) X does a lookup using tl_find_peer() and caches the new address.
* NOTE: tl_find_peer() never returns closing endpoint and it places a refhold
* on the endpoint found.
*
* During close of endpoint Y it doesn't try to remove itself from other
* endpoints caches. They will detect that Y is gone and will search the peer
* endpoint again.
*
* Flow Control Handling.
* ----------------------
*
* Each connectionless endpoint keeps a list of endpoints which are
* flow-controlled by its queue. It also keeps a pointer to the queue which
* flow-controls itself. Whenever flow control releases for endpoint X it
* enables all queues from the list. During close it also back-enables everyone
* in the list. If X is flow-controlled when it is closing it removes it from
* the peers list.
*
* DATA STRUCTURES
* ===============
*
* Each endpoint is represented by the tl_endpt_t structure which keeps all the
* endpoint state. For connection-oriented transports it has a keeps a list
* of pending connections (tl_icon_t). For connectionless transports it keeps a
* list of endpoints flow controlled by this one.
*
* Each transport type is represented by a per-transport data structure
* tl_transport_state_t. It contains a pointer to an acceptor ID hash and the
* endpoint address hash tables for each transport. It also contains pointer to
* transport serializer for connectionless transports.
*
* Each endpoint keeps a link to its transport structure, so the code can find
* all per-transport information quickly.
*/
#include <sys/inttypes.h>
#include <sys/id_space.h>
#include <sys/socketvar.h>
#include <sys/sysmacros.h>
#include <sys/xti_xtiopt.h>
#include <sys/serializer.h>
/*
* TBD List
* 14 Eliminate state changes through table
* 16. AF_UNIX socket options
* 17. connect() for ticlts
* 18. support for "netstat" to show AF_UNIX plus TLI local
* transport connections
* 21. sanity check to flushing on sending M_ERROR
*/
/*
* CONSTANT DECLARATIONS
* --------------------
*/
/*
* Local declarations
*/
/*
* Hash tables size.
*/
/*
* Definitions for module_info
*/
/*
* We view the socket use as a separate mode to get a separate name space.
*/
/*
* LOCAL MACROS
*/
/*
* EXTERNAL VARIABLE DECLARATIONS
* -----------------------------
*/
/*
* state table defined in the OS space.c
*/
/*
* STREAMS DRIVER ENTRY POINTS PROTOTYPES
*/
/*
* GLOBAL DATA STRUCTURES AND VARIABLES
* -----------------------------------
*/
/*
* Table representing database of all options managed by T_SVR4_OPTMGMT_REQ
* For now, we only manage the SO_RECVUCRED option but we also have
* harmless dummy options to make things work with some common code we access.
*/
/* The SO_TYPE is needed for the hack below */
{
OA_R,
OA_R,
0,
sizeof (t_scalar_t),
0
},
{
0,
sizeof (int),
0
}
};
/*
* Table of all supported levels
* Note: Some levels (e.g. XTI_GENERIC) may be valid but may not have
* any supported options so we need this info separately.
*
* This is needed only for topmost tpi providers.
*/
};
/*
* Current upper bound on the amount of space needed to return all options.
* Additional options with data size of sizeof(long) are handled automatically.
* Others need hand job.
*/
#define TL_MAX_OPT_BUF_LEN \
+ 64 + sizeof (struct T_optmgmt_ack))
/*
* transport addr structure
*/
typedef struct tl_addr {
} tl_addr_t;
/*
* Refcounted version of serializer.
*/
typedef struct tl_serializer {
/*
* Each transport type has a separate state.
* Per-transport state.
*/
typedef struct tl_transport_state {
char *tr_name;
};
struct tl_endpt;
/*
* Data structure used to represent pending connects.
* Records enough information so that the connecting peer can close
* before the connection gets accepted.
*/
typedef struct tl_icon {
} tl_icon_t;
/*
* Maximum number of unaccepted connection indications allowed per listener.
*/
/*
* transport endpoint structure
*/
struct tl_endpt {
/*
* State specific for connection-oriented and connectionless transports.
*/
union {
/* Connection-oriented state. */
struct {
#ifndef _ILP32
void *_te_pad;
#endif
/* Connection-less state. */
struct {
/*
* Pieces of the endpoint state needed for closing.
*/
/*
* Pieces of the endpoint state needed for serializer transitions.
*/
};
/*
* Flag values. Lower 4 bits specify that transport used.
* TL_LISTENER, TL_ACCEPTOR, TL_ACCEPTED and TL_EAGER are for debugging only,
* they allow to identify the endpoint more easily.
*/
/*
* Boolean checks for the endpoint type.
*/
/*
* Certain operations are always used together. These macros reduce the chance
* of missing a part of a combination.
*/
}
/*
* STREAMS driver glue data structures.
*/
TL_ID, /* mi_idnum */
TL_NAME, /* mi_idname */
TL_MINPSZ, /* mi_minpsz */
TL_MAXPSZ, /* mi_maxpsz */
TL_HIWAT, /* mi_hiwat */
TL_LOWAT /* mi_lowat */
};
NULL, /* qi_putp */
(int (*)())tl_rsrv, /* qi_srvp */
tl_open, /* qi_qopen */
tl_close, /* qi_qclose */
NULL, /* qi_qadmin */
&tl_minfo, /* qi_minfo */
NULL /* qi_mstat */
};
(int (*)())tl_wput, /* qi_putp */
(int (*)())tl_wsrv, /* qi_srvp */
NULL, /* qi_qopen */
NULL, /* qi_qclose */
NULL, /* qi_qadmin */
&tl_minfo, /* qi_minfo */
NULL /* qi_mstat */
};
&tl_rinit, /* st_rdinit */
&tl_winit, /* st_wrinit */
NULL, /* st_muxrinit */
NULL /* st_muxwrinit */
};
&mod_driverops, /* Type of module -- pseudo driver here */
"TPI Local Transport (tl)",
&tl_devops, /* driver ops */
};
/*
* Module linkage information for the kernel.
*/
&modldrv,
};
/*
* Templates for response to info request
* Check sanity of unlimited connect data etc.
*/
{
T_INFO_ACK, /* PRIM_type -always T_INFO_ACK */
T_INFINITE, /* TSDU size */
T_INFINITE, /* ETSDU size */
T_INFINITE, /* CDATA_size */
T_INFINITE, /* DDATA_size */
T_INFINITE, /* ADDR_size */
T_INFINITE, /* OPT_size */
0, /* TIDU_size - fill at run time */
T_COTS, /* SERV_type */
-1, /* CURRENT_state */
TL_COTS_PROVIDER_FLAG /* PROVIDER_flag */
};
{
T_INFO_ACK, /* PRIM_type - always T_INFO_ACK */
0, /* TSDU_size - fill at run time */
-2, /* ETSDU_size -2 => not supported */
-2, /* CDATA_size -2 => not supported */
-2, /* DDATA_size -2 => not supported */
-1, /* ADDR_size -1 => infinite */
-1, /* OPT_size */
0, /* TIDU_size - fill at run time */
T_CLTS, /* SERV_type */
-1, /* CURRENT_state */
TL_CLTS_PROVIDER_FLAG /* PROVIDER_flag */
};
/*
* private copy of devinfo pointer used in tl_info
*/
/*
* Endpoints cache.
*/
/*
* Minor number space.
*/
/*
* Default Data Unit size.
*/
/*
* Size of hash tables.
*/
/*
* Debug and test variable ONLY. Turn off T_CONN_IND queueing
* for sockets.
*/
static int tl_disable_early_connect = 0;
static int tl_client_closing_when_accepting;
static int tl_serializer_noswitch;
/*
* LOCAL FUNCTION PROTOTYPES
* -------------------------
*/
static void tl_cl_backenable(tl_endpt_t *);
static void tl_co_unconnect(tl_endpt_t *);
static mblk_t *tl_ordrel_ind_alloc(void);
static void tl_icon_freemsgs(mblk_t **);
static void tl_free(tl_endpt_t *);
static int tl_constructor(void *, void *, int);
static void tl_destructor(void *, void *);
static tl_serializer_t *tl_serializer_alloc(int);
static void tl_serializer_refhold(tl_serializer_t *);
static void tl_serializer_refrele(tl_serializer_t *);
static void tl_serializer_exit(tl_endpt_t *);
static void tl_closeok(tl_endpt_t *);
static void tl_refhold(tl_endpt_t *);
static void tl_refrele(tl_endpt_t *);
static void tl_addr_unbind(tl_endpt_t *);
/*
* Intialize option database object for TL
*/
tl_default_opt, /* TL default value function pointer */
tl_get_opt, /* TL get function pointer */
tl_set_opt, /* TL set function pointer */
TL_OPT_ARR_CNT, /* TL option database count of entries */
tl_opt_arr, /* TL option database */
TL_VALID_LEVELS_CNT, /* TL valid level count of entries */
tl_valid_levels_arr /* TL valid level array */
};
/*
* LOCAL FUNCTIONS AND DRIVER ENTRY POINTS
* ---------------------------------------
*/
/*
* Loadable module routines
*/
int
_init(void)
{
return (mod_install(&modlinkage));
}
int
_fini(void)
{
return (mod_remove(&modlinkage));
}
int
{
}
/*
* Driver Entry Points and Other routines
*/
static int
{
int i;
/*
* Resume from a checkpoint state.
*/
if (cmd == DDI_RESUME)
return (DDI_SUCCESS);
if (cmd != DDI_ATTACH)
return (DDI_FAILURE);
/*
* Deduce TIDU size to use. Note: "strmsgsz" being 0 has semantics that
* streams message sizes can be unlimited. We use a defined constant
* instead.
*/
/*
* Create subdevices for each transport.
*/
for (i = 0; i < TL_UNUSED; i++) {
tl_transports[i].tr_name,
return (DDI_FAILURE);
}
}
return (DDI_FAILURE);
}
/*
* Create ID space for minor numbers
*/
for (i = 0; i < TL_MAXTRANSPORT; i++) {
tl_transport_state_t *t = &tl_transports[i];
if (i == TL_UNUSED)
continue;
/* Socket COTSORD shares namespace with COTS */
if (i == TL_SOCK_COTSORD) {
t->tr_ai_hash =
t->tr_addr_hash =
continue;
}
/*
* Create hash tables.
*/
t->tr_name);
#ifdef _ILP32
if (i & TL_SOCKET)
t->tr_ai_hash =
else
t->tr_ai_hash =
mod_hash_null_valdtor, sizeof (queue_t));
#else
t->tr_ai_hash =
#endif /* _ILP32 */
if (i & TL_SOCKET) {
t->tr_name);
sizeof (uintptr_t));
} else {
t->tr_name);
}
/* Create serializer for connectionless transports. */
if (i & TL_TICLTS)
}
return (DDI_SUCCESS);
}
static int
{
int i;
if (cmd == DDI_SUSPEND)
return (DDI_SUCCESS);
if (cmd != DDI_DETACH)
return (DDI_FAILURE);
/*
* Destroy arenas and hash tables.
*/
for (i = 0; i < TL_MAXTRANSPORT; i++) {
tl_transport_state_t *t = &tl_transports[i];
if ((i == TL_UNUSED) || (i == TL_SOCK_COTSORD))
continue;
if (t->tr_serializer != NULL) {
t->tr_serializer = NULL;
}
#ifdef _ILP32
if (i & TL_SOCKET)
else
#else
#endif /* _ILP32 */
t->tr_ai_hash = NULL;
if (i & TL_SOCKET)
else
t->tr_addr_hash = NULL;
}
return (DDI_SUCCESS);
}
/* ARGSUSED */
static int
{
switch (infocmd) {
case DDI_INFO_DEVT2DEVINFO:
}
break;
case DDI_INFO_DEVT2INSTANCE:
*result = (void *)0;
break;
default:
break;
}
return (retcode);
}
/*
* Endpoint reference management.
*/
static void
{
}
static void
{
}
/*ARGSUSED*/
static int
{
return (0);
}
/*ARGSUSED*/
static void
{
}
static void
{
} else {
}
} else {
}
tep->te_acceptor_id = 0;
tep->te_closing = 0;
}
/*
*/
static tl_serializer_t *
{
if (s == NULL)
return (NULL);
kmem_free(s, sizeof (tl_serializer_t));
return (NULL);
}
s->ts_refcnt = 1;
s->ts_serializer = ser;
return (s);
}
static void
{
atomic_inc_32(&s->ts_refcnt);
}
static void
{
if (atomic_dec_32_nv(&s->ts_refcnt) == 0) {
kmem_free(s, sizeof (tl_serializer_t));
}
}
/*
* Post a request on the endpoint serializer. For COTS transports keep track of
* the number of pending requests.
*/
static void
{
tep->te_ser_count++;
}
}
/*
* Complete processing the request on the serializer. Decrement the counter for
* pending requests for COTS transports.
*/
static void
{
tep->te_ser_count--;
}
}
/*
* Hash management functions.
*/
/*
* Return TRUE if two addresses are equal, false otherwise.
*/
static boolean_t
{
}
/*
* This function is called whenever an endpoint is found in the hash table.
*/
/* ARGSUSED0 */
static void
{
}
/*
* Address hash function.
*/
/* ARGSUSED */
static uint_t
{
uint_t i, g;
i = (i << 4) + (*p);
if ((g = (i & 0xf0000000U)) != 0) {
i ^= (g >> 24);
i ^= g;
}
}
return (i);
}
/*
* This function is used by hash lookups. It compares two generic addresses.
*/
static int
{
#ifdef DEBUG
#endif
}
/*
* Prevent endpoint from closing if possible.
* Return B_TRUE on success, B_FALSE on failure.
*/
static boolean_t
{
if (! tep->te_closing) {
tep->te_closewait++;
}
return (rc);
}
/*
* Allow endpoint to close if needed.
*/
static void
{
tep->te_closewait--;
}
/*
* STREAMS open entry point.
*/
/* ARGSUSED */
static int
{
/*
* Driver is called directly. Both CLONEOPEN and MODOPEN
* are illegal
*/
return (ENXIO);
return (0);
/* Minor number should specify the mode used for the driver. */
return (ENXIO);
if (oflag & SO_SOCKSTR) {
}
/* Allocate a unique minor number for this instance. */
/* Reserve hash handle for bind(). */
/* Transport-specific initialization */
/* Use private serializer */
/* Create list for pending connections */
} else {
/* Use shared serializer */
/* Create list for flow control */
}
/* Initialize endpoint address */
/* Socket-specific address handling. */
} else {
}
/* clone the driver */
#ifdef _ILP32
else
#else
#endif /* _ILP32 */
/*
* Insert acceptor ID in the hash. The AI hash always sleeps on
* insertion so insertion can't fail.
*/
return (0);
}
/* ARGSUSED1 */
static int
{
int rc;
/*
* Remove the endpoint from acceptor hash.
*/
(mod_hash_val_t *)&elp);
"tl_close:inconsistency in AI hash"));
}
/*
* Wait till close is safe, then mark endpoint as closing.
*/
while (tep->te_closewait)
/*
* Will wait for the serializer part of the close to finish, so set
* te_closewait now.
*/
/*
* tl_close_ser doesn't drop reference, so no need to tl_refhold.
* It is safe because close will wait for tl_close_ser to finish.
*/
/*
* Wait for the first phase of close to complete before qprocsoff().
*/
while (tep->te_closewait)
}
if (tep->te_timoutid) {
tep->te_timoutid = 0;
}
/*
* Finish close behind serializer.
*
* For a CLTS endpoint increase a refcount and continue close processing
* with serializer protection. This processing may happen asynchronously
* with the completion of tl_close().
*
* Fot a COTS endpoint wait before destroying tep since the serializer
* may go away together with tep and we need to destroy serializer
* outside of serializer context.
*/
else
/*
* For connection-oriented transports wait for all serializer activity
* to settle down.
*/
while (tep->te_closewait)
}
/*
* tep is likely to be destroyed now, so can't reference it any more.
*/
return (0);
}
/*
* First phase of close processing done behind the serializer.
*
* Do not drop the reference in the end - tl_close() wants this reference to
* stay.
*/
/* ARGSUSED0 */
static void
{
/*
* Drain out all messages on queue except for TL_TICOTS where the
* abortive release semantics permit discarding of data on close
*/
}
/* Remove address from hash table. */
/*
* qprocsoff() gets confused when q->q_next is not NULL on the write
* queue of the driver, so clear these before qprocsoff() is called.
* Also clear q_next for the peer since this queue is going away.
*/
}
/* wake up tl_close() */
}
/*
* Second phase of tl_close(). Should wakeup tl_close() for COTS mode and drop
* the reference for CLTS.
*
* Called from serializer. Should drop reference count for CLTS only.
*/
/* ARGSUSED0 */
static void
{
} else {
/* Connectionless specific cleanup */
/*
* Backenable anybody that is flow controlled waiting for
* this endpoint.
*/
}
}
else
}
/*
* STREAMS write-side put procedure.
* Enter serializer for most of the processing.
*
* The T_CONN_REQ is processed outside of serializer.
*/
static void
{
case M_DATA:
/* Only valid for connection-oriented transports */
"tl_wput:M_DATA invalid for ticlts driver"));
return;
}
break;
case M_IOCTL:
case TL_IOC_CREDOPT:
/* FALLTHROUGH */
case TL_IOC_UCREDOPT:
/*
* Serialize endpoint state change.
*/
break;
default:
return;
}
break;
case M_FLUSH:
/*
* do canonical M_FLUSH processing
*/
}
} else {
}
return;
case M_PROTO:
"tl_wput:M_PROTO data too short"));
return;
}
case T_OPTMGMT_REQ:
case T_SVR4_OPTMGMT_REQ:
/*
* Process TPI option management requests immediately
* in put procedure regardless of in-order processing
* of already queued messages.
* (Note: This driver supports AF_UNIX socket
* implementation. Unless we implement this processing,
* setsockopt() on socket endpoint will block on flow
* controlled endpoints which it should not. That is
* required for successful execution of VSU socket tests
* and is consistent with BSD socket behavior).
*/
return;
case O_T_BIND_REQ:
case T_BIND_REQ:
break;
case T_CONN_REQ:
return;
}
return;
case T_DATA_REQ:
case T_OPTDATA_REQ:
case T_EXDATA_REQ:
case T_ORDREL_REQ:
break;
case T_UNITDATA_REQ:
(msz < sizeof (struct T_unitdata_req))) {
return;
}
} else {
}
break;
default:
/*
* process in service procedure if message already
* queued (maintain in-order processing)
*/
} else {
}
break;
}
break;
case M_PCPROTO:
/*
* Check that the message has enough data to figure out TPI
* primitive.
*/
"tl_wput:M_PCROTO data too short"));
return;
}
case T_CAPABILITY_REQ:
return;
case T_INFO_REQ:
break;
case T_ADDR_REQ:
break;
default:
"tl_wput:unknown TPI msg primitive"));
return;
}
break;
default:
"tl_wput:default:unexpected Streams message"));
return;
}
/*
* Continue processing via serializer.
*/
}
/*
* Place message on the queue while preserving order.
*/
static void
{
if (tep->te_closing) {
} else {
}
}
static void
{
case M_DATA:
break;
case M_PROTO:
break;
default:
break;
}
}
/*
* Write side put procedure called from serializer.
*/
static void
{
}
/*
* M_DATA processing. Called from serializer.
*/
static void
{
/*
* fastpath for data. Ignore flow control if tep is closing.
*/
!peer_tep->te_closing &&
} else if (tep->te_closing) {
/*
* It is possible that by the time we got here tep started to
* close. If the write queue is not empty, and the state is
* TS_DATA_XFER the data should be delivered in order, so we
* call putq() instead of freeing the data.
*/
} else {
}
} else {
}
}
/*
* Write side service routine.
*
* All actual processing happens within serializer which is entered
* synchronously. It is possible that by the time tl_wsrv() wakes up, some new
* messages that need processing may have arrived, so tl_wsrv repeats until
* queue is empty or te_nowsrv is set.
*/
static void
{
/*
* Wait for serializer job to complete.
*/
while (tep->te_wsrv_active) {
}
}
}
/*
* Serialized write side processing of the STREAMS queue.
* May be called either from tl_wsrv() or from tl_close() in which case ser_mp
* is NULL.
*/
static void
{
}
/*
* Wakeup service routine unless called from close.
* If ser_mp is specified, the caller is tl_wsrv().
* Otherwise, the caller is tl_close_ser(). Since tl_close_ser() doesn't
* call tl_serializer_enter() before calling tl_wsrv_ser(), there should
* be no matching tl_serializer_exit() in this case.
* Also, there is no need to wakeup anyone since tl_close_ser() is not
* waiting on te_srv_cv.
*/
/*
* We are called from tl_wsrv.
*/
}
}
/*
* Called when the stream is backenabled. Enter serializer and qenable everyone
* flow controlled by tep.
*
* NOTE: The service routine should enter serializer synchronously. Otherwise it
* is possible that two instances of tl_rsrv will be running reusing the same
* rsrv mblk.
*/
static void
{
/*
* Wait for serializer job to complete.
*/
while (tep->te_rsrv_active) {
}
}
/* ARGSUSED */
static void
{
} else if (
!peer_tep->te_closing &&
}
/*
* Wakeup read side service routine.
*/
}
/*
* process M_PROTO messages. Always called from serializer.
*/
static void
{
/* Message size was validated by tl_wput(). */
case T_UNBIND_REQ:
break;
case T_ADDR_REQ:
break;
case O_T_CONN_RES:
case T_CONN_RES:
break;
}
break;
case T_DISCON_REQ:
break;
}
break;
case T_DATA_REQ:
break;
}
break;
case T_OPTDATA_REQ:
break;
}
break;
case T_EXDATA_REQ:
break;
}
break;
case T_ORDREL_REQ:
if (! IS_COTSORD(tep)) {
break;
}
break;
case T_UNITDATA_REQ:
break;
}
break;
default:
break;
}
}
/*
* Process ioctl from serializer.
* This is a wrapper around tl_do_ioctl().
*/
static void
{
if (! tep->te_closing)
else
}
static void
{
int error;
switch (cmd) {
case TL_IOC_CREDOPT:
if (cmd == TL_IOC_CREDOPT) {
} else {
/* FALLTHROUGH */
case TL_IOC_UCREDOPT:
}
/*
* The credentials passing does not apply to sockets.
* Only one of the cred options can be set at a given time.
*/
return;
}
/*
* Turn on generation of credential options for
* T_conn_req, T_conn_con, T_unidata_ind.
*/
if (error != 0) {
return;
}
return;
}
else
break;
default:
/* Should not be here */
break;
}
}
/*
* send T_ERROR_ACK
* Note: assumes enough memory or caller passed big enough mp
* - no recovery from allocb failures
*/
static void
{
"tl_error_ack:out of mblk memory"));
return;
}
/*
* send error ack message
*/
}
/*
* send T_OK_ACK
* Note: assumes enough memory or caller passed big enough mp
* - no recovery from allocb failures
*/
static void
{
return;
}
}
/*
* Process T_BIND_REQ and O_T_BIND_REQ from serializer.
* This is a wrapper around tl_bind().
*/
static void
{
if (! tep->te_closing)
else
}
/*
* Process T_BIND_REQ and O_T_BIND_REQ TPI requests.
* Assumes that the endpoint is in the unbound.
*/
static void
{
void *addr_startp;
"tl_wput:bind_request:out of state, state=%d",
goto error;
}
if (msz < sizeof (struct T_bind_req)) {
goto error;
}
/* negotiate max conn req pending */
if (qlen > tl_maxqlen)
qlen = tl_maxqlen;
}
/*
* Reserve hash handle. It can only be NULL if the endpoint is unbound
* and bound again.
*/
&tep->te_hash_hndl) != 0) {
goto error;
}
/*
* Verify address correctness.
*/
if ((alen != TL_SOUX_ADDRLEN) ||
(aoff < 0) ||
"tl_bind: invalid socket addr"));
goto error;
}
/* Copy address from message to local buffer. */
/*
* Check that we got correct address from sockets
*/
"tl_bind: invalid socket magic"));
goto error;
}
"tl_bind: implicit addr non-empty"));
goto error;
}
"tl_bind: explicit addr empty"));
goto error;
}
} else {
"tl_bind: invalid message"));
goto error;
}
"tl_bind: bad addr in message"));
goto error;
}
#ifdef DEBUG
/*
* Mild form of ASSERT()ion to detect broken TPI apps.
* if (! assertion)
* log warning;
*/
"tl_bind: addr overlaps TPI message"));
}
#endif
}
/*
* Bind the address provided or allocate one if requested.
* Allow rebinds with a new qlen value.
*/
/*
* For anonymous requests the te_ap is already set up properly
* so use minor number as an address.
* For explicit requests need to check whether the address is
* already in use.
*/
int rc;
goto skip_addr_bind;
else /* Rebind to a new address. */
}
/*
* Insert address in the hash if it is not already
* there. Since we use preallocated handle, the insert
* can fail only if the key is already present.
*/
if (rc != 0) {
/*
* Violate O_T_BIND_REQ semantics and fail with
* TADDRBUSY - sockets will not use any address
* other than supplied one for explicit binds.
*/
"tl_bind:requested addr %p is busy",
goto error;
}
}
} else if (alen == 0) {
/*
* assign any free address
*/
"tl_bind:failed to get buffer for any "
"address"));
goto error;
}
} else {
goto error;
}
tep->te_hash_hndl) != 0) {
if (save_prim_type == T_BIND_REQ) {
/*
* The bind semantics for this primitive
* require a failure if the exact address
* requested is busy
*/
"tl_bind:requested addr is busy"));
goto error;
}
/*
* O_T_BIND_REQ semantics say if address if requested
* address is busy, bind to any available free address
*/
"tl_bind:unable to get any addr buf"));
goto error;
}
} else {
}
}
/*
* prepare T_BIND_ACK TPI message
*/
"tl_wput:tl_bind: allocb failed"));
/*
* roll back state changes
*/
return;
}
if (qlen > 0)
}
/*
* send T_BIND_ACK message
*/
return;
/*
* roll back state changes
*/
return;
}
}
/*
* Process T_UNBIND_REQ.
* Called from serializer.
*/
static void
{
if (tep->te_closing) {
return;
}
/*
* preallocate memory for max of T_OK_ACK and T_ERROR_ACK
* ==> allocate for T_ERROR_ACK (known max)
*/
return;
}
/*
* memory resources committed
* Note: no message validation. T_UNBIND_REQ message is
* same size as PRIM_type field so already verified earlier.
*/
/*
* validate state
*/
"tl_wput:T_UNBIND_REQ:out of state, state=%d",
return;
}
/*
* TPI says on T_UNBIND_REQ:
* send up a M_FLUSH to flush both
* read and write queues
*/
/*
* Sockets use bind with qlen==0 followed by bind() to
* the same address with qlen > 0 for listeners.
* We allow rebind with a new qlen value.
*/
}
/*
* send T_OK_ACK
*/
}
/*
* Note: TL_PROT_LEVEL/TL_IOC_CREDOPT option is not part of tl_opt_arr
* database of options. So optcom_req() will fail T_SVR4_OPTMGMT_REQ.
* However, that is what we want as that option is 'unorthodox'
* and only valid in T_CONN_IND, T_CONN_CON and T_UNITDATA_IND
* and not in T_SVR4_OPTMGMT_REQ/ACK
* Note2: use of optcom_req means this routine is an exception to
* recovery from allocb() failures.
*/
static void
{
/*
* All Solaris components should pass a db_credp
* for this TPI message, hence we ASSERT.
* But in case there is some other M_PROTO that looks
* like a TPI message sent by some other kernel
* component, we check and return an error.
*/
return;
}
/* all states OK for AF_UNIX options ? */
/*
* Broken TLI semantics that options can only be managed
* in TS_IDLE state. Needed for Sparc ABI test suite that
* tests this TLI (mis)feature using this device driver.
*/
"tl_wput:T_SVR4_OPTMGMT_REQ:out of state, state=%d",
/*
* preallocate memory for T_ERROR_ACK
*/
if (! ackmp) {
return;
}
return;
}
/*
*/
} else {
}
}
/*
* Handle T_conn_req - the driver part of accept().
* If TL_SET[U]CRED generate the credentials options.
* If this is a socket pass through options unmodified.
* For sockets generate the T_CONN_CON here instead of
* waiting for the T_CONN_RES.
*/
static void
{
if (tep->te_closing) {
return;
}
/*
* preallocate memory for:
* 1. max of T_ERROR_ACK and T_OK_ACK
* ==> known max T_ERROR_ACK
* 2. max of T_DISCON_IND and T_CONN_IND
*/
if (! ackmp) {
return;
}
/*
* memory committed for T_OK_ACK/T_ERROR_ACK now
* will be committed for T_DISCON_IND/T_CONN_IND later
*/
"tl_wput:T_CONN_REQ:out of state, state=%d",
return;
}
/*
* validate the message
* Note: dereference fields in struct inside message only
* after validating the message length.
*/
if (msz < sizeof (struct T_conn_req)) {
"tl_conn_req:invalid message length"));
return;
}
if (olen == 0)
ooff = 0;
if ((alen != TL_SOUX_ADDRLEN) ||
(aoff < 0) ||
"tl_conn_req: invalid socket addr"));
return;
}
"tl_conn_req: invalid socket magic"));
return;
}
} else {
"tl_conn_req:invalid message"));
return;
}
"tl_conn_req:bad addr in message, "
"alen=%d, msz=%ld",
return;
}
#ifdef DEBUG
/*
* Mild form of ASSERT()ion to detect broken TPI apps.
* if (! assertion)
* log warning;
*/
"tl_conn_req: addr overlaps TPI message"));
}
#endif
if (olen) {
/*
* no opts in connect req
* supported in this provider except for sockets.
*/
"tl_conn_req:options not supported "
"in message"));
return;
}
}
/*
* Prevent tep from closing on us.
*/
if (! tl_noclose(tep)) {
"tl_conn_req:endpoint is closing"));
return;
}
/*
* get endpoint to connect to
* check that peer with DEST addr is bound to addr
* and has CONIND_number > 0
*/
/*
* Verify if remote addr is in use
*/
"tl_conn_req:no one at connect address"));
err = ECONNREFUSED;
/*
* validate that number of incoming connection is
* not to capacity on destination endpoint
*/
"tl_conn_req: qlen overflow connection refused"));
err = ECONNREFUSED;
}
/*
* Send T_DISCON_IND in case of error
*/
if (err != 0) {
/* We are still expected to send T_OK_ACK */
return;
}
/*
* send T_DISCON_IND message
*/
return;
}
/*
* Found the listener. At this point processing will continue on
* listener serializer. Close of the endpoint should be blocked while we
* switch serializers.
*/
/*
* It is safe to close now. Close may continue on listener serializer.
*/
/*
* Pass ackmp to tl_conn_req_ser. Note that mp->b_cont may contain user
* data, so we link mp to ackmp.
*/
}
/*
* Finish T_CONN_REQ processing on listener serializer.
*/
static void
{
void *addr_startp;
if (tep->te_closing) {
return;
}
/*
* Extract preallocated ackmp from mp.
*/
if (olen == 0)
ooff = 0;
if (peer_tep->te_closing ||
"tl_conn_req:peer in bad state (%d)",
return;
}
/*
* preallocate now for T_DISCON_IND or T_CONN_IND
*/
/*
* calculate length of T_CONN_IND message
*/
ooff = 0;
OPTLEN(sizeof (tl_credopt_t));
/* 1 option only */
} else {
ooff = 0;
/* 1 option only */
}
}
/*
* Save options from mp - we'll need them for T_CONN_IND.
*/
if (ooff != 0) {
/*
* roll back state changes
*/
return;
}
/* Copy options to a temp buffer */
}
/*
* Generate a T_CONN_CON that has the identical address
* (and options) as the T_CONN_REQ.
* NOTE: assumes that the T_conn_req and T_conn_con structures
* are isomorphic.
*/
if (! confmp) {
/*
* roll back state changes
*/
return;
}
} else {
}
/*
* roll back state changes
*/
return;
}
/*
* roll back state changes
*/
return;
}
/*
* memory is now committed for T_DISCON_IND/T_CONN_IND/T_CONN_CON
* and tl_icon_t cell.
*/
/*
* ack validity of request and send the peer credential in the ACK.
*/
}
/*
* prepare message to send T_CONN_IND
*/
/*
* allocate the message - original data blocks retained
* in the returned mblk
*/
if (! cimp) {
"tl_conn_req:con_ind:allocb failure"));
return;
}
ci->SRC_length);
} else if (ooff != 0) {
/* Copy option from T_CONN_REQ */
ci->SRC_length);
} else {
ci->OPT_offset = 0;
ci->OPT_length = 0;
}
/*
* register connection request with server peer
* append to list of incoming connections
* increment references for both peer_tep and tep: peer_tep is placed on
* te_oconp and tep is placed on listeners queue.
*/
/*
* send the T_CONN_IND message
*/
/*
* Send a T_CONN_CON message for sockets.
* Disable the queues until we have reached the correct state!
*/
}
/*
* Now we need to increment tep reference because tep is referenced by
* server list of pending connections. We also need to decrement
* reference before exiting serializer. Two operations void each other
* so we don't modify reference at all.
*/
}
/*
* Handle T_conn_res on listener stream. Called on listener serializer.
* tl_conn_req has already generated the T_CONN_CON.
* tl_conn_res is called on listener serializer.
* No one accesses acceptor at this point, so it is safe to modify acceptor.
* Switch eager serializer to acceptor's.
*
* If TL_SET[U]CRED generate the credentials options.
* For sockets tl_conn_req has already generated the T_CONN_CON.
*/
static void
{
if (tep->te_closing) {
return;
}
/*
* preallocate memory for:
* 1. max of T_ERROR_ACK and T_OK_ACK
* ==> known max T_ERROR_ACK
* 2. max of T_DISCON_IND and T_CONN_CON
*/
if (! ackmp) {
return;
}
/*
* memory committed for T_OK_ACK/T_ERROR_ACK now
* will be committed for T_DISCON_IND/T_CONN_CON later
*/
/*
* validate state
*/
"tl_wput:T_CONN_RES:out of state, state=%d",
return;
}
/*
* validate the message
* Note: dereference fields in struct inside message only
* after validating the message length.
*/
if (msz < sizeof (struct T_conn_res)) {
"tl_conn_res:invalid message length"));
return;
}
"tl_conn_res:invalid message"));
return;
}
if (olen) {
/*
* no opts in connect res
* supported in this provider
*/
"tl_conn_res:options not supported in message"));
return;
}
"tl_conn_res:remote endpoint sequence number bad"));
return;
}
/*
* find accepting endpoint. Will have extra reference if found.
*/
"tl_conn_res:bad accepting endpoint"));
return;
}
/*
* Prevent acceptor from closing.
*/
if (! tl_noclose(acc_ep)) {
"tl_conn_res:bad accepting endpoint"));
return;
}
/*
* validate that accepting endpoint, if different from listening
* has address bound => state is TS_IDLE
* TROUBLE in XPG4 !!?
*/
"tl_conn_res:accepting endpoint has no address bound,"
return;
}
/*
* validate if accepting endpt same as listening, then
* no other incoming connection should be on the queue
*/
"tl_conn_res: > 1 conn_ind on listener-acceptor"));
return;
}
/*
* Mark for deletion, the entry corresponding to client
* on list of pending connections made by the listener
* search list to see if client is one of the
* recorded as a listener.
*/
"tl_conn_res:no client in listener list"));
return;
}
/*
* If ti_tep is NULL the client has already closed. In this case
* the code below will avoid any action on the client side
* but complete the server and acceptor state transitions.
*/
/*
* If the client is present it is switched from listener's to acceptor's
* serializer. We should block client closes while serializers are
* being switched.
*
* It is possible that the client is present but is currently being
* closed. There are two possible cases:
*
* 1) The client has already entered tl_close_finish_ser() and sent
* T_ORDREL_IND. In this case we can just ignore the client (but we
* still need to send all messages from tip->ti_mp to the acceptor).
*
* 2) The client started the close but has not entered
* tl_close_finish_ser() yet. In this case, the client is already
* proceeding asynchronously on the listener's serializer, so we're
* forced to change the acceptor to use the listener's serializer to
* ensure that any operations on the acceptor are serialized with
* respect to the close that's in-progress.
*/
if (tl_noclose(cl_ep)) {
} else {
/*
* Client is closing. If it it has sent the
* T_ORDREL_IND, we can simply ignore it - otherwise,
* we have to let let the client continue until it is
* sent.
*
* If we do continue using the client, acceptor will
* switch to client's serializer which is used by client
* for its close.
*/
}
}
/*
* validate client state to be TS_WCON_CREQ or TS_DATA_XFER
* (latter for sockets only)
*/
err = ECONNREFUSED;
/*
* T_DISCON_IND sent later after committing memory
* and acking validity of request
*/
"tl_conn_res:peer in bad state"));
}
/*
* preallocate now for T_DISCON_IND or T_CONN_CONN
* ack validity of request (T_OK_ACK) after memory committed
*/
if (err)
size = sizeof (struct T_discon_ind);
else {
/*
* calculate length of T_CONN_CON message
*/
olen = 0;
OPTLEN(sizeof (tl_credopt_t));
}
}
/*
* roll back state changes
*/
if (client_noclose_set)
return;
}
}
/*
* Now ack validity of request
*/
else
} else
/*
* send T_DISCON_IND now if client state validation failed earlier
*/
if (err) {
/*
* flush the queues - why always ?
*/
if (! dimp) {
"tl_conn_res:con_ind:allocb failure"));
if (client_noclose_set)
return;
}
/* no user data in provider generated discon ind */
}
/*
* send T_DISCON_IND message
*/
if (client_noclose_set)
return;
}
/*
* now start connecting the accepting endpoint
*/
/*
* The client has already closed. Send up any queued messages
* and change the state accordingly.
*/
/*
* remove endpoint from incoming connection
* delete client from list of incoming connections
*/
return;
/*
* The client could have queued a T_DISCON_IND which needs
* to be sent up.
* Note that t_discon_req can not operate the same as
* t_data_req since it is not possible for it to putbq
* the message and return -1 due to the use of qwriter.
*/
}
/*
* prepare connect confirm T_CONN_CON message
*/
/*
* allocate the message - original data blocks
* retained in the returned mblk
*/
"tl_conn_res:conn_con:allocb failure"));
if (client_noclose_set)
return;
}
cc->RES_length);
} else {
cc->OPT_offset = 0;
cc->OPT_length = 0;
}
/*
* Forward the credential in the packet so it can be picked up
* at the higher layers for more complete credential processing
*/
} else {
}
/*
* make connection linking
* accepting and client endpoints
* No need to increment references:
* on client: it should already have one from tip->ti_tep linkage.
* on acceptor is should already have one from the table lookup.
*
* At this point both client and acceptor can't close. Set client
* serializer to acceptor's.
*/
if (switch_client_serializer) {
if (cl_ep->te_ser_count > 0) {
} else {
/*
* Move client to the acceptor's serializer.
*/
}
}
if (!switch_client_serializer) {
/*
* It is not possible to switch client to use acceptor's.
* Move acceptor to client's serializer (which is the same as
* listener's).
*/
}
/*
* remove endpoint from incoming connection
* delete client from list of incoming connections
*/
/*
* data blocks already linked in reallocb()
*/
/*
* link queues so that I_SENDFD will work
*/
}
/*
* send T_CONN_CON up on client side unless it was already
* done (for a socket). In cases any data or ordrel req has been
* queued make sure that the service procedure runs.
*/
} else {
/*
* change client state on TE_CONN_CON event
*/
}
/* Mark the both endpoints as accepted */
/*
* Allow client and acceptor to close.
*/
if (client_noclose_set)
}
static void
{
if (tep->te_closing) {
return;
}
}
}
/*
* preallocate memory for:
* 1. max of T_ERROR_ACK and T_OK_ACK
* ==> known max T_ERROR_ACK
* 2. for T_DISCON_IND
*/
if (! ackmp) {
return;
}
/*
* memory committed for T_OK_ACK/T_ERROR_ACK now
* will be committed for T_DISCON_IND later
*/
/*
* validate the state
*/
"tl_wput:T_DISCON_REQ:out of state, state=%d",
return;
}
/*
* Defer committing the state change until it is determined if
* the message will be queued with the tl_icon or not.
*/
/* validate the message */
if (msz < sizeof (struct T_discon_req)) {
"tl_discon_req:invalid message"));
return;
}
/*
* if server, then validate that client exists
* by connection sequence number etc.
*/
/*
* search server list for disconnect client
*/
"tl_discon_req:no disconnect endpoint"));
return;
}
/*
* If ti_tep is NULL the client has already closed. In this case
* the code below will avoid any action on the client side.
*/
}
/*
* preallocate now for T_DISCON_IND
* ack validity of request (T_OK_ACK) after memory committed
*/
size = sizeof (struct T_discon_ind);
return;
}
/*
* prepare message to ack validity of request
*/
else
else
/*
* Flushing queues according to TPI. Using the old state.
*/
((save_state == TS_DATA_XFER) ||
(save_state == TS_WIND_ORDREL) ||
(save_state == TS_WREQ_ORDREL)))
/* send T_OK_ACK up */
/*
* now do disconnect business
*/
/*
* disconnect incoming connect request pending to tep
*/
"tl_discon_req: reallocb failed"));
return;
}
} else {
}
/*
* remove endpoint from incoming connection list
* - remove disconnect client from list on server
*/
/*
* disconnect an outgoing request pending from tep
*/
"tl_discon_req: reallocb failed"));
return;
}
/*
* If this is a socket the T_DISCON_IND is queued with
* the T_CONN_IND. Otherwise the T_CONN_IND is removed
* from the list of pending connections.
* Note that when te_oconp is set the peer better have
* a t_connind_t for the client.
*/
/*
* No need to check that
* ti_tep == NULL since the T_DISCON_IND
* takes precedence over other queued
* messages.
*/
/*
* Can't clear te_oconp since tl_co_unconnect needs
* it as a hint not to free the tep.
* Keep the state unchanged since tl_conn_res inspects
* it.
*/
} else {
/* Found - delete it */
else
}
}
"tl_discon_req: reallocb failed"));
return;
}
} else {
/* Not connected */
return;
}
/* Commit state changes */
goto done;
}
/*
* Flush queues on peer before sending up
* T_DISCON_IND according to TPI
*/
if ((save_state == TS_DATA_XFER) ||
(save_state == TS_WIND_ORDREL) ||
(save_state == TS_WREQ_ORDREL))
/*
* data blocks already linked into dimp by reallocb()
*/
/*
* send indication message to peer user module
*/
done:
/*
* Messages may be queued on peer's write queue
* waiting to be processed by its write service
* procedure. Before the pointer to the peer transport
* structure is set to NULL, qenable the peer's write
* queue so that the queued up messages are processed.
*/
if ((save_state == TS_DATA_XFER) ||
(save_state == TS_WIND_ORDREL) ||
(save_state == TS_WREQ_ORDREL))
/*
* unlink the streams
*/
}
}
}
static void
{
if (!tep->te_closing)
else
}
static void
{
if (tep->te_closing) {
return;
}
/*
* Note: T_ADDR_REQ message has only PRIM_type field
* so it is already validated earlier.
*/
/*
* Either connectionless or connection oriented but not
* in connected data transfer state or half-closed states.
*/
ack_sz = sizeof (struct T_addr_ack);
/* is bound */
"tl_addr_req: reallocb failed"));
return;
}
/* endpoint is bound */
}
} else {
/* connection oriented in data transfer */
}
}
static void
{
if (tep->te_closing) {
return;
}
return;
}
ack_sz = sizeof (struct T_addr_ack);
"tl_connected_cots_addr_req: reallocb failed"));
return;
}
/* endpoint is bound */
}
static void
{
*ia = tl_clts_info_ack;
} else {
*ia = tl_cots_info_ack;
if (IS_COTSORD(tep))
}
}
/*
* This routine responds to T_CAPABILITY_REQ messages. It is called by
* tl_wput.
*/
static void
{
if (tep->te_closing) {
return;
}
"tl_capability_req: reallocb failed"));
sizeof (struct T_capability_ack));
return;
}
}
if (cap_bits1 & TC1_ACCEPTOR_ID) {
}
}
static void
{
if (! tep->te_closing)
else
}
static void
{
"tl_info_req: reallocb failed"));
return;
}
/*
* fill in T_INFO_ACK contents
*/
/*
* send ack message
*/
}
/*
* Handle M_DATA, T_data_req and T_optdata_req.
* If this is a socket pass through T_optdata_req options unmodified.
*/
static void
{
"tl_wput:clts:unattached M_DATA"));
if (!closing) {
} else {
}
return;
}
/*
* If the endpoint is closing it should still forward any data to the
* peer (if it has one). If it is not allowed to forward it can just
* free the message.
*/
if (closing &&
return;
}
msz < sizeof (struct T_data_req)) {
"tl_data:T_DATA_REQ:invalid message"));
if (!closing) {
} else {
}
return;
"tl_data:T_OPTDATA_REQ:invalid message"));
if (!closing) {
} else {
}
return;
}
}
/*
* connection oriented provider
*/
case TS_IDLE:
/*
* Other end not here - do nothing.
*/
"tl_data:cots with endpoint idle"));
return;
case TS_DATA_XFER:
/* valid states */
break;
if (!closing) {
} else {
}
return;
}
/*
* For a socket the T_CONN_CON is sent early thus
* the peer might not yet have accepted the connection.
* If we are closing queue the packet with the T_CONN_IND.
* Otherwise defer processing the packet until the peer
* accepts the connection.
* Note that the queue is noenabled when we go into this
* state.
*/
if (!closing) {
"tl_data: ocon"));
return;
}
if (msz < sizeof (t_scalar_t)) {
return;
}
/* reuse message block - just change REQ to IND */
else
}
return;
case TS_WREQ_ORDREL:
/*
* Other end closed - generate discon_ind
* with reason 0 to cause an EPIPE but no
* read side error on AF_UNIX sockets.
*/
"tl_data: WREQ_ORDREL and no peer"));
tl_discon_ind(tep, 0);
return;
}
break;
default:
/* invalid state for event TE_DATA_REQ */
"tl_data:cots:out of state"));
return;
}
/*
* tep->te_state = NEXTSTATE(TE_DATA_REQ, tep->te_state);
* (State stays same on this event)
*/
/*
* get connected endpoint
*/
/* Peer closed */
"tl_data: peer gone"));
return;
}
/*
* Put it back if flow controlled
* Note: Messages already on queue when we are closing is bounded
* so we can ignore flow control.
*/
return;
}
/*
* validate peer state
*/
case TS_DATA_XFER:
case TS_WIND_ORDREL:
/* valid states */
break;
default:
"tl_data:rx side:invalid state"));
return;
}
/* reuse message block - just change REQ to IND */
else
}
/*
* peer_tep->te_state = NEXTSTATE(TE_DATA_IND, peer_tep->te_state);
* (peer state stays same on this event)
*/
/*
* send data to connected peer
*/
}
static void
{
if (msz < sizeof (struct T_exdata_req)) {
"tl_exdata:invalid message"));
if (!closing) {
} else {
}
return;
}
/*
* If the endpoint is closing it should still forward any data to the
* peer (if it has one). If it is not allowed to forward it can just
* free the message.
*/
if (closing &&
return;
}
/*
* validate state
*/
case TS_IDLE:
/*
* Other end not here - do nothing.
*/
"tl_exdata:cots with endpoint idle"));
return;
case TS_DATA_XFER:
/* valid states */
break;
if (!closing) {
} else {
}
return;
}
/*
* For a socket the T_CONN_CON is sent early thus
* the peer might not yet have accepted the connection.
* If we are closing queue the packet with the T_CONN_IND.
* Otherwise defer processing the packet until the peer
* accepts the connection.
* Note that the queue is noenabled when we go into this
* state.
*/
if (!closing) {
"tl_exdata: ocon"));
return;
}
"tl_exdata: closing socket ocon"));
return;
case TS_WREQ_ORDREL:
/*
* Other end closed - generate discon_ind
* with reason 0 to cause an EPIPE but no
* read side error on AF_UNIX sockets.
*/
"tl_exdata: WREQ_ORDREL and no peer"));
tl_discon_ind(tep, 0);
return;
}
break;
default:
"tl_wput:T_EXDATA_REQ:out of state, state=%d",
return;
}
/*
* tep->te_state = NEXTSTATE(TE_EXDATA_REQ, tep->te_state);
* (state stays same on this event)
*/
/*
* get connected endpoint
*/
/* Peer closed */
"tl_exdata: peer gone"));
return;
}
/*
* Put it back if flow controlled
* Note: Messages already on queue when we are closing is bounded
* so we can ignore flow control.
*/
return;
}
/*
* validate state on peer
*/
case TS_DATA_XFER:
case TS_WIND_ORDREL:
/* valid states */
break;
default:
"tl_exdata:rx side:invalid state"));
return;
}
/*
* peer_tep->te_state = NEXTSTATE(TE_DATA_IND, peer_tep->te_state);
* (peer state stays same on this event)
*/
/*
* reuse message block
*/
/*
* send data to connected peer
*/
}
static void
{
if (msz < sizeof (struct T_ordrel_req)) {
"tl_ordrel:invalid message"));
if (!closing) {
} else {
}
return;
}
/*
* validate state
*/
case TS_DATA_XFER:
case TS_WREQ_ORDREL:
/* valid states */
break;
break;
/*
* For a socket the T_CONN_CON is sent early thus
* the peer might not yet have accepted the connection.
* If we are closing queue the packet with the T_CONN_IND.
* Otherwise defer processing the packet until the peer
* accepts the connection.
* Note that the queue is noenabled when we go into this
* state.
*/
if (!closing) {
"tl_ordlrel: ocon"));
return;
}
"tl_ordlrel: closing socket ocon"));
return;
default:
"tl_wput:T_ORDREL_REQ:out of state, state=%d",
if (!closing) {
} else {
}
return;
}
/*
* get connected endpoint
*/
/* Peer closed */
"tl_ordrel: peer gone"));
return;
}
/*
* Put it back if flow controlled except when we are closing.
* Note: Messages already on queue when we are closing is bounded
* so we can ignore flow control.
*/
return;
}
/*
* validate state on peer
*/
case TS_DATA_XFER:
case TS_WIND_ORDREL:
/* valid states */
break;
default:
"tl_ordrel:rx side:invalid state"));
return;
}
/*
* reuse message block
*/
"tl_ordrel: send ordrel_ind"));
/*
* send data to connected peer
*/
}
/*
*/
static void
{
err_sz = sizeof (struct T_uderror_ind);
if (alen > 0)
if (olen > 0)
if (! err_mp) {
"tl_uderr:allocb failure"));
/*
* Note: no rollback of state needed as it does
* not change in connectionless transport
*/
return;
}
if (alen <= 0) {
uderr->DEST_offset = 0;
} else {
uderr->DEST_offset =
(t_scalar_t)sizeof (struct T_uderror_ind);
}
if (olen <= 0) {
uderr->OPT_offset = 0;
} else {
uderr->OPT_offset =
uderr->DEST_length);
}
/*
* send indication message
*/
}
static void
{
else
}
/*
* Handle T_unitdata_req.
* If TL_SET[U]CRED or TL_SOCKUCRED generate the credentials options.
* If this is a socket pass through options unmodified.
*/
static void
{
/*
* validate the state
*/
"tl_wput:T_CONN_REQ:out of state"));
return;
}
/*
* tep->te_state = NEXTSTATE(TE_UNITDATA_REQ, tep->te_state);
* (state does not change on this event)
*/
/*
* validate the message
* Note: dereference fields in struct inside message only
* after validating the message length.
*/
if (msz < sizeof (struct T_unitdata_req)) {
"tl_unitdata:invalid message length"));
return;
}
if (olen == 0)
ooff = 0;
if ((alen != TL_SOUX_ADDRLEN) ||
(aoff < 0) ||
"tl_unitdata_req: invalid socket addr "
"(msz=%d, al=%d, ao=%d, ol=%d, oo = %d)",
return;
}
"tl_conn_req: invalid socket magic"));
return;
}
} else {
if ((alen < 0) ||
(aoff < 0) ||
(olen < 0) ||
(ooff < 0) ||
"tl_unitdata:invalid unit data message"));
return;
}
}
/* Options not supported unless it's a socket */
"tl_unitdata:option use(unsupported) or zero len addr"));
return;
}
#ifdef DEBUG
/*
* Mild form of ASSERT()ion to detect broken TPI apps.
* if (! assertion)
* log warning;
*/
"tl_unitdata:addr overlaps TPI message"));
}
#endif
/*
* get destination endpoint
*/
/*
* Check whether the destination is the same that was used previously
* and the destination endpoint is in the right state. If something is
* wrong, find destination again and cache it.
*/
/*
* Not the same as cached destination , need to find the right
* destination.
*/
"tl_unitdata:no one at destination address"));
return;
}
/*
* Cache the new peer.
*/
}
"tl_unitdata:provider in invalid state"));
return;
}
/*
* Put it back if flow controlled except when we are closing.
* Note: Messages already on queue when we are closing is bounded
* so we can ignore flow control.
*/
/* record what we are flow controlled on */
}
return;
}
/*
* prepare indication message
*/
/*
* calculate length of message
*/
OPTLEN(sizeof (tl_credopt_t));
/* 1 option only */
/* 1 option only */
} else {
/* Possibly more than one option */
}
}
/*
* If the unitdata_ind fits and we are not adding options
* reuse the udreq mblk.
*
* Otherwise, it is possible we need to append an option if one of the
* te_flag bits is set. This requires extra space in the data block for
* the additional option but the traditional technique used below to
* allocate a new block and copy into it will not work when there is a
* message block with a free pointer (since we don't know anything
* about the layout of the data, pointers referencing or within the
* data, etc.). To handle this possibility the upper layers may have
* preallocated some space to use for appending an option. We check the
* overall mblock size against the size we need ('reuse_mb_sz' with the
* original address length [alen] to ensure we won't overrun the
* current mblk data size) to see if there is free space and thus
* avoid allocating a new message block.
*/
/*
* Reuse the original mblk. Leave options in place.
*/
/*
* We have a message block with a free pointer, but extra space
* has been pre-allocated for us in case we need to append an
* option. Reuse the original mblk, leaving existing options in
* place.
*/
/*
* We're appending one new option here after the
* original ones.
*/
}
/*
* The next block creates a new mp and tries to copy the data
* block into it, but that cannot handle a message with a free
* pointer (for more details see the comment in kstrputmsg()
* where dupmsg() is called). Since we can never properly
* duplicate the mp while also extending the data, just error
* out now.
*/
return;
} else {
/* Allocate a new T_unitdata_ind message */
if (! ui_mp) {
"tl_unitdata:allocb failure:message queued"));
return;
}
/*
* fill in T_UNITDATA_IND contents
*/
udind->OPT_offset =
if (oldolen != 0) {
udind->OPT_offset),
oldolen);
}
} else {
olen);
}
/*
* relink data blocks from mp to ui_mp
*/
}
/*
* send indication message
*/
}
/*
* Check if a given addr is in use.
* Endpoint ptr returned or NULL if not found.
* The name space is separate for each mode. This implies that
* sockets get their own name space.
*/
static tl_endpt_t *
{
}
return (peer_tep);
}
/*
* Find peer for a socket based on unix domain address.
* For implicit addresses our peer can be found by minor number in ai hash. For
* explicit binds we look vnode address at addr_hash.
*/
static tl_endpt_t *
{
/* Don't attempt to use closing peer. */
if (peer_tep->te_closing)
goto errout;
/*
* Cross-zone unix sockets are permitted, but for Trusted
* Extensions only, the "server" for these must be in the
* global zone.
*/
is_system_labeled() &&
goto errout;
}
return (peer_tep);
return (NULL);
}
/*
* Generate a free addr and return it in struct pointed by ap
* but allocating space for address buffer.
* The generated address will be at least 4 bytes long and, if req->ta_alen
* exceeds 4 bytes, be req->ta_alen bytes long.
*
* If address is found it will be inserted in the hash.
*
* If req->ta_alen is larger than the default alen (4 bytes) the last
* alen-4 bytes will always be the same as in req.
*
* Return 0 for failure.
* Return non-zero for success.
*/
static boolean_t
{
return (B_FALSE);
/*
* check if default addr is in use
* if it is - bump it and try again
*/
} else {
}
/*
* Not enough space in tep->ta_ap to hold the address,
* allocate a bigger space.
*/
return (B_FALSE);
}
/* Copy in the address in req */
}
/*
* First try minor number then try default addresses.
*/
tep->te_hash_hndl) == 0) {
/*
* found free address
*/
return (B_TRUE); /* successful return */
}
/*
* Use default address.
*/
}
/*
* Failed to find anything.
*/
"tl_get_any_addr:looped 2^32 times"));
return (B_FALSE);
}
/*
* reallocb + set r/w ptrs to reflect size.
*/
static mblk_t *
{
return (NULL);
return (mp);
}
static void
{
if (! elp->te_closing)
list_remove(l, elp);
}
}
/*
* Unconnect endpoints.
*/
static void
{
list_t *l;
/*
* If our peer is closing, don't use it.
*/
}
}
/*
* If incoming requests pending, change state
* of clients on disconnect ind event and send
* discon_ind pdu to modules above them
* for server: all clients get disconnect
*/
continue;
}
}
if (cl_tep->te_closing) {
continue;
}
} else {
"tl_co_unconnect:icmng: "
"allocb failure"));
}
}
/*
* If outgoing request pending, change state
* of server on discon ind event
*/
IS_COTSORD(srv_tep) &&
/*
* Queue ordrel_ind for server to be picked up
* when the connection is accepted.
*/
d_mp = tl_ordrel_ind_alloc();
} else {
/*
* send discon_ind to server
*/
}
"tl_co_unconnect:outgoing:allocb failure"));
goto discon_peer;
}
/*
* If this is a socket the T_DISCON_IND is queued with
* the T_CONN_IND. Otherwise the T_CONN_IND is removed
* from the list of pending connections.
* Note that when te_oconp is set the peer better have
* a t_connind_t for the client.
*/
/*
* Queue the disconnection message.
*/
} else {
} else {
/*
* Delete tip from the server list.
*/
} else {
}
}
}
/*
* unconnect existing connection
* If connected, change state of peer on
* discon ind event and send discon ind pdu
* to module above it
*/
if (IS_COTSORD(peer_tep) &&
/*
* send ordrel ind
*/
"tl_co_unconnect:connected: ordrel_ind state %d->%d",
d_mp = tl_ordrel_ind_alloc();
if (! d_mp) {
"tl_co_unconnect:connected:"
"allocb failure"));
/*
* Continue with cleaning up peer as
* this side may go away with the close
*/
goto discon_peer;
}
/*
* Handle flow control case. This will generate
* a t_discon_ind message with reason 0 if there
* is data queued on the write side.
*/
} else if (IS_COTSORD(peer_tep) &&
/*
* Sent an ordrel_ind. We send a discon with
* with error 0 to inform that the peer is gone.
*/
"tl_co_unconnect: discon in state %d",
tl_discon_ind(peer_tep, 0);
} else {
}
/*
* Disconnect cross-pointers only for close
*/
if (tep->te_closing) {
}
}
}
/*
* Note: The following routine does not recover from allocb()
* failures
*/
static void
{
if (tep->te_closing)
return;
/*
* flush the queues.
*/
/*
* send discon ind
*/
if (! d_mp) {
"tl_discon_ind:allocb failure"));
return;
}
}
/*
* Note: The following routine does not recover from allocb()
* failures
*/
static mblk_t *
{
}
return (mp);
}
/*
* Note: The following routine does not recover from allocb()
* failures
*/
static mblk_t *
tl_ordrel_ind_alloc(void)
{
}
return (mp);
}
/*
* Lookup the seqno in the list of queued connections.
*/
static tl_icon_t *
{
;
return (tip);
}
/*
* Queue data for a given T_CONN_IND while verifying that redundant
* messages, such as a T_ORDREL_IND after a T_DISCON_IND, are not queued.
* Used when the originator of the connection closes.
*/
static void
{
else
return;
}
else
/*
* Allow nothing after a T_DISCON_IND
*/
if (prim == T_DISCON_IND) {
return;
}
/*
* Only allow a T_DISCON_IND after an T_ORDREL_IND
*/
return;
}
}
}
/*
* Verify if a certain TPI primitive exists on the connind queue.
* Use prim -1 for M_DATA.
* Return non-zero if found.
*/
static boolean_t
{
}
}
return (found);
}
/*
* Send the b_next mblk chain that has accumulated before the connection
* was accepted. Perform the necessary state transitions.
*/
static void
{
if (tep->te_closing) {
return;
}
default:
break;
case M_DATA:
break;
case M_PROTO:
case T_UNITDATA_IND:
case T_DATA_IND:
case T_OPTDATA_IND:
case T_EXDATA_IND:
break;
case T_ORDREL_IND:
break;
case T_DISCON_IND:
break;
default:
#ifdef DEBUG
"tl_icon_sendmsgs: unknown primitive");
#endif /* DEBUG */
break;
}
break;
}
}
}
/*
* Free the b_next mblk chain that has accumulated before the connection
* was accepted.
*/
static void
{
}
}
/*
* Send M_ERROR
* Note: assumes caller ensured enough space in mp or enough
* memory available. Does not attempt recovery from allocb()
* failures
*/
static void
{
if (tep->te_closing) {
return;
}
/*
* flush all messages on queue. we are shutting
* the stream down on fatal error
*/
/* connection oriented - unconnect endpoints */
}
}
if (!mp) {
"tl_merror:M_PROTO: out of memory"));
return;
}
}
if (mp) {
} else {
}
}
static void
{
if (flag & TL_SETCRED) {
} else if (flag & TL_SETUCRED) {
} else {
}
}
/* ARGSUSED */
static int
{
/* no default value processed in protocol specific code currently */
return (-1);
}
/* ARGSUSED */
static int
{
int len;
int *valp;
len = 0;
/*
* Assumes: option level and name sanity check done elsewhere
*/
switch (level) {
case SOL_SOCKET:
break;
switch (name) {
case SO_RECVUCRED:
len = sizeof (int);
break;
default:
break;
}
break;
case TL_PROT_LEVEL:
switch (name) {
case TL_OPT_PEER_CRED:
case TL_OPT_PEER_UCRED:
/*
* option not supposed to retrieved directly
* Only sent in T_CON_{IND,CON}, T_UNITDATA_IND
* when some internal flags set by other options
* Direct retrieval always designed to fail(ignored)
* for this option.
*/
break;
}
}
return (len);
}
/* ARGSUSED */
static int
int level,
int name,
void *thisdg_attrs,
{
int error;
error = 0; /* NOERROR */
/*
* Assumes: option level and name sanity checks done elsewhere
*/
switch (level) {
case SOL_SOCKET:
break;
}
/*
* TBD: fill in other AF_UNIX socket options and then stop
* returning error.
*/
switch (name) {
case SO_RECVUCRED:
/*
* We only support this for datagram sockets;
* getpeerucred handles the connection oriented
* transports.
*/
break;
}
if (*(int *)invalp == 0)
else
break;
default:
break;
}
break;
case TL_PROT_LEVEL:
switch (name) {
case TL_OPT_PEER_CRED:
case TL_OPT_PEER_UCRED:
/*
* option not supposed to be set directly
* Its value in initialized for each endpoint at
* driver open time.
* Direct setting always designed to fail for this
* option.
*/
"tl_set_opt: option is not supported"));
break;
}
}
return (error);
}
static void
{
tep->te_timoutid = 0;
/*
* Note: can call wsrv directly here and save context switch
* Consider change when qtimeout (not timeout) is active
*/
}
static void
{
/*
* Note: can call wsrv directly here and save context switch
* Consider change when qbufcall (not bufcall) is active
*/
}
static void
{
if (tep->te_closing) {
return;
}
"tl_memrecover:recover %p pending", (void *)wq));
return;
}
}
}
static void
{
}
}
}
/*
* Remove address from address hash.
*/
static void
{
(mod_hash_val_t *)&elp);
} else {
(mod_hash_val_t *)&elp);
}
}
}