ip_helper_stream.c revision de8c4a14ec9a49bad5e62b2cfa6c1ba21de1c708
/*
* 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 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <inet/ipclassifier.h>
#include <inet/proto_set.h>
#include <sys/pathname.h>
static int ip_helper_stream_close(queue_t *, int);
static struct module_info ip_helper_stream_info = {
};
static struct qinit ip_helper_stream_rinit = {
};
static struct qinit ip_helper_stream_winit = {
};
/*
* set the q_ptr of the 'q' to the conn_t pointer passed in
*/
static void
{
/*
* This operation is allowed only on helper streams with kcred
*/
return;
}
if (IP_USE_HELPER_CACHE) {
ip_helper_info = *((ip_helper_stream_info_t **)
} else {
}
}
void
{
} else {
if (connp->conn_af_isv6) {
ip_wput_v6(q, mp);
} else {
}
}
}
/* ARGSUSED */
int
{
return (ENOMEM);
}
ip_minfop->ip_minfo_dev = 0;
/*
* Clone the device, allocate minor device number
*/
if (ip_minor_arena_la != NULL)
if (ip_minfop->ip_minfo_dev == 0) {
/*
* numbers in the large arena are exhausted
* Try small arena.
* Or this is a 32 bit system, 32 bit systems do not have
* ip_minor_arena_la
*/
if (ip_minfop->ip_minfo_dev == 0) {
return (EBUSY);
}
} else {
}
q->q_qinfo = &ip_helper_stream_rinit;
qprocson(q);
return (0);
}
/* ARGSUSED */
static int
{
qprocsoff(q);
return (0);
}
/*
* Public interface for creating an IP stream with shared conn_t
*/
/* ARGSUSED */
int
{
int error;
int ret;
error = 0;
if (IP_USE_HELPER_CACHE) {
return (EAGAIN);
/*
* Doesn't need to hold the QLOCK for there is no one else
* should have a pointer to this queue.
*/
} else {
sizeof (ip_helper_stream_info_t), KM_SLEEP);
/*
* open ip device via the layered interface.
* pass in kcred as some threads do not have the
* secpolicy_spec_open() will fail the open
*/
if (error != 0) {
(sizeof (ip_helper_stream_info_t)));
return (error);
}
/*
* Share connp with the helper stream
*/
if (error != 0) {
/*
* Passing in a zero flag indicates that an error
* occured and stream was not shared
*/
0, kcred);
(sizeof (ip_helper_stream_info_t)));
}
}
return (error);
}
/*
* Public interface for freeing IP helper stream
*/
/* ARGSUSED */
void
{
if (IP_USE_HELPER_CACHE) {
return;
/* Prevent service procedures from being called */
/* Wait until service procedure of each queue is run */
/* Cleanup any pending ioctls */
/* Allow service procedures to be called again */
/* Flush the queues */
} else {
sizeof (ip_helper_stream_info_t));
}
}
/*
* create a T_SVR4_OPTMGMT_REQ TPI message and send down the IP stream
*/
static int
{
struct T_optmgmt_req *optmgmt_reqp;
/* Not used to generate UCRED, thus don't need correct pid */
return (ENOMEM);
} else {
}
/*
* Send down the primitive
*/
}
/*
*/
static int
{
union T_primitives *tpr;
int error;
if (error != 0) {
return (error);
}
goto done;
}
case T_OPTMGMT_ACK:
break;
case T_ERROR_ACK:
break;
}
else
break;
default:
break;
}
void *option;
struct T_optmgmt_ack *optmgmt_ack;
/*
* Check mblk boundary
*/
optmgmt_ack->OPT_length)) {
goto done;
}
/*
* Check alignment
*/
goto done;
}
/* check to ensure that the option is within bounds */
goto done;
}
/*
* Copy data
*/
}
done:
return (error);
}
/*
* Public interface to get socketoptions via the ip helper stream.
*/
int
{
int error;
if (error)
return (error);
}
/*
* Public interface to set socket options via the ip helper stream.
*/
int
{
int error;
if (error)
return (error);
&optlen));
}