ipsec_loader.c revision 0c0328cd0042940f46d6fbd784333d637c0e2bf8
/*
* 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 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <sys/sysmacros.h>
#include <inet/ipsec_impl.h>
/*
* Loader commands for ipsec_loader_sig
*/
#define IPSEC_LOADER_EXITNOW -1
#define IPSEC_LOADER_LOADNOW 1
/*
* NOTE: This function is entered w/o holding any STREAMS perimeters.
*/
static void
ipsec_loader(void *arg)
{
"ipsec_loader");
for (;;) {
/*
* Wait for someone to tell me to continue.
*/
}
/* IPSEC_LOADER_EXITNOW implies signal by _fini(). */
/*
* Let user patch ipsec_loader_tid to
* 0 to try again.
*/
/* ipsec_loader_lock is held at this point! */
thread_exit();
}
/*
* Load IPsec, which is done by modloading keysock and calling
* keysock_plumb_ipsec().
*/
/* Pardon my hardcoding... */
/*
* Only this function can set ipsec_failure. If the
* damage can be repaired, use adb to set this to
* B_FALSE and try again.
*/
/*
* Only this function can set ipsec_failure. If the
* damage can be repaired, use adb to set this to
* B_FALSE and try again.
*/
} else {
}
if (ipsec_failure) {
} else {
}
if (!ipsec_failure) {
thread_exit();
}
}
}
/*
* Called from ip_ddi_init() to initialize ipsec loader thread.
*/
void
{
}
/*
* Called from ip_ddi_destroy() to take down ipsec loader thread.
*/
void
{
if (tid != 0) {
ipss->ipsec_loader_tid = 0;
}
/*
* Wait for ipsec_loader() to finish before we destroy
* cvs and mutexes.
*/
if (tid != 0)
}
void
{
if (ipss->ipsec_loader_tid == 0) {
}
/* Else we lost the race, oh well. */
}
void
{
/*
* It is possible that an algorithm update message was
* received before IPsec is loaded. Such messages are
* saved in spdsock for later processing. Since IPsec
* loading can be initiated by interfaces different
* than spdsock, we must trigger the processing of
* update messages from the ipsec loader.
*/
}
}
/*
* Dummy callback routine (placeholder) to avoid keysock plumbing
* races. Used in conjunction with qtimeout() and qwait() to wait
* until ipsec has loaded -- the qwait() in ipsec_loader_loadwait will
* wake up once this routine returns.
*/
/* ARGSUSED */
static void
loader_nop(void *ignoreme)
{
}
/*
* Called from keysock driver open to delay until ipsec is done loading.
* Returns B_TRUE if it worked, B_FALSE if it didn't.
*/
{
/*
* 30ms delay per loop is arbitrary; it takes ~300ms to
* load and plumb ipsec on an ultra-1.
*/
qwait(q);
}
}
/*
* Just check to see if IPsec is loaded (or not).
*/
{
}
/*
* Check to see if IPsec loading failed.
*/
{
}