/*
* 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.
*/
/*
* IP Tunneling Driver
*
* As viewed from the top, this module is a GLDv3 driver that consumes the
* mac driver interfaces. It implements the logic for various forms of IP
* (IPv4 or IPv6) encapsulation within IP (IPv4 or IPv6).
*/
#include "iptun_impl.h"
static int iptun_constructor(void *, void *, int);
static void iptun_destructor(void *, void *);
};
};
/*
* Initialize the tunnel stack instance.
*/
/* ARGSUSED */
static void *
{
return (iptuns);
}
/* ARGSUSED */
static void
{
/* note that iptun_delete() removes iptun from the list */
}
}
/*
* Free the tunnel stack instance.
*/
/* ARGSUSED */
static void
{
}
static void
iptun_fini(void)
{
}
int
_init(void)
{
int rc;
if (rc != 0)
return (rc);
if (iptun_cache == NULL) {
return (ENOMEM);
}
TASKQ_DEFAULTPRI, 0);
if (iptun_taskq == NULL) {
return (ENOMEM);
}
iptun_fini();
return (rc);
}
int
_fini(void)
{
int rc;
iptun_fini();
return (rc);
}
int
{
}
static int
{
switch (cmd) {
case DDI_ATTACH:
return (DDI_FAILURE);
return (DDI_SUCCESS);
default:
return (DDI_FAILURE);
}
}
/* ARGSUSED */
static int
{
switch (cmd) {
case DDI_DETACH:
/*
* We prevent the pseudo device from detaching (and thus the
* driver from unloading) when there are tunnels configured by
* consulting iptun_count(). We don't need to hold a lock
* here because the tunnel count is only changed when a tunnel
* is created or deleted, which can't happen while the detach
* routine is running (the ioctl path calls
* ddi_hold_devi_by_instance() in dld's drv_ioctl(), and the
*/
if (iptun_count() > 0)
return (DDI_FAILURE);
return (DDI_SUCCESS);
default:
return (DDI_FAILURE);
}
}
/* ARGSUSED */
static int
{
switch (infocmd) {
case DDI_INFO_DEVT2DEVINFO:
return (DDI_SUCCESS);
case DDI_INFO_DEVT2INSTANCE:
return (DDI_SUCCESS);
}
return (DDI_FAILURE);
}
/* ARGSUSED */
static int
{
return (0);
}
/* ARGSUSED */
static void
{
/* This iptun_t must not still be in use. */
}