sctp_hash.c revision e35d2278fa5447def80bb5a191ce0f1c6b6836de
/*
* 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 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <inet/ipclassifier.h>
#include <inet/ipsec_impl.h>
#include <inet/ipp_common.h>
#include "sctp_impl.h"
#include "sctp_addr.h"
/* Default association hash size. The size must be a power of 2. */
#define SCTP_CONN_HASH_SIZE 8192
/*
* Cluster networking hook for traversing current assoc list.
* This routine is used to extract the current list of live associations
* which must continue to to be dispatched to this node.
*/
void
{
int i;
/* Not a power of two. Round up to nearest power of two */
for (i = 0; i < 31; i++) {
break;
}
}
}
for (i = 0; i < sctps->sctps_conn_hash_size; i++) {
}
for (i = 0; i < SCTP_LISTEN_FANOUT_SIZE; i++) {
}
for (i = 0; i < SCTP_BIND_FANOUT_SIZE; i++) {
}
}
void
{
int i;
for (i = 0; i < sctps->sctps_conn_hash_size; i++) {
}
sizeof (sctp_tf_t));
for (i = 0; i < SCTP_LISTEN_FANOUT_SIZE; i++) {
}
sizeof (sctp_tf_t));
for (i = 0; i < SCTP_BIND_FANOUT_SIZE; i++) {
}
sizeof (sctp_tf_t));
}
/*
* Walk the SCTP global list and refrele the ire for this ipif
* This is called when an address goes down, so that we release any reference
* to the ire associated with this address. Additionally, for any SCTP if
* assoc., if there is no address added subsequently, or if this does not
* come up, then the assoc. will die a natural death (i.e. timeout).
*/
void
{
if (sctp->sctp_condemned) {
continue;
}
sctp->sctp_refcnt++;
} else {
}
/* check for ires cached in faddr */
/*
* If this ipif is being used as the source address
* we need to update it as well, else we will end
* up using the dead source address.
*/
}
/*
* This may result in setting the fp as unreachable,
* i.e. if all the source addresses are down. In
* that case the assoc. would timeout.
*/
}
}
}
}
}
/*
* Exported routine for extracting active SCTP associations.
* Like TCP, we terminate the walk if the callback returns non-zero.
*
* Need to walk all sctp_stack_t instances since this clustering
* interface is assumed global for all instances
*/
int
{
netstack_t *ns;
int ret = 0;
ns->netstack_sctp);
}
return (ret);
}
static int
{
continue;
}
sctp->sctp_refcnt++;
return (1);
}
return (1);
}
/* list will be freed by cl_callback */
}
return (0);
}
sctp_t *
{
continue;
}
/* check for faddr match */
break;
}
}
/* no faddr match; keep looking */
continue;
/* check for laddr match */
goto done;
}
/* no match; continue to the next in the chain */
}
done:
return (sctp);
}
static sctp_t *
{
continue;
}
goto done;
}
/* no match; continue to the next in the chain */
}
done:
return (sctp);
}
/* called by ipsec_sctp_pol */
conn_t *
{
/* Not in conn fanout; check listen fanout */
return (NULL);
}
return (sctp->sctp_connp);
}
conn_t *
{
if (shared_addr) {
/*
* No need to handle exclusive-stack zones since
* ALL_ZONES only applies to the shared stack.
*/
/*
* If no shared MLP is found, tsol_mlp_findzone returns
* ALL_ZONES. In that case, we assume it's SLP, and
* search for the zone based on the packet label.
* That will also return ALL_ZONES on failure.
*/
return (NULL);
}
/* Not in conn fanout; check listen fanout */
return (NULL);
/*
* On systems running trusted extensions, check if dst
* should accept the packet. "IPV6_VERSION" indicates
* that dst is in 16 byte AF_INET6 format. IPv4-mapped
* IPv6 addresses are supported.
*/
if (is_system_labeled() &&
char *,
"connp(1) could not receive mp(2)",
return (NULL);
}
}
return (sctp->sctp_connp);
}
/*
* Fanout for SCTP packets
* The caller puts <fport, lport> in the ports parameter.
*/
/* ARGSUSED */
void
{
if (mctl_present) {
}
/* Assume IP provides aligned packets - otherwise toss */
return;
}
} else {
}
return;
}
/* Found a client; up it goes */
/*
* We check some fields in conn_t without holding a lock.
* This should be fine.
*/
return;
}
}
/* Initiate IPPF processing for fastpath */
if (mctl_present)
return;
} else if (mctl_present) {
/*
* ip_process might return a new mp.
*/
} else {
}
}
int in_flags = 0;
}
if (connp->conn_recvslla) {
in_flags |= IPF_RECVSLLA;
}
if (isv4) {
} else {
}
if (mctl_present)
return;
} else if (mctl_present) {
/*
* ip_add_info might return a new mp.
*/
} else {
}
}
if (sctp->sctp_running) {
if (mctl_present)
}
} else {
if (mctl_present)
}
} else {
NULL));
}
}
}
void
{
if (!tf) {
return;
}
/*
* On a clustered note send this notification to the clustering
* subsystem.
*/
if (cl_sctp_disconnect != NULL) {
}
if (sctp->sctp_conn_hash_next) {
}
} else {
if (sctp->sctp_conn_hash_next) {
== sctp);
}
}
}
void
{
if (sctp->sctp_conn_tfp) {
}
if (!caller_holds_lock) {
} else {
}
}
if (!caller_holds_lock) {
}
}
void
{
if (!tf) {
return;
}
/*
* On a clustered note send this notification to the clustering
* subsystem.
*/
if (cl_sctp_unlisten != NULL) {
/* list will be freed by the clustering module */
}
if (sctp->sctp_listen_hash_next) {
}
} else {
sctp);
if (sctp->sctp_listen_hash_next) {
sctp);
}
}
}
void
{
if (sctp->sctp_listen_tfp) {
}
}
/*
* On a clustered note send this notification to the clustering
* subsystem.
*/
if (cl_sctp_listen != NULL) {
/* list will be freed by the clustering module */
}
}
/*
* Hash list insertion routine for sctp_t structures.
* Inserts entries with the ones bound to a specific IP address first
* followed by those bound to INADDR_ANY.
*/
void
{
}
if (!caller_holds_lock) {
} else {
}
if (sctpnext) {
}
/* For sctp_*_hash_remove */
if (!caller_holds_lock)
}
/*
* Hash list removal routine for sctp_t structures.
*/
void
{
return;
if (sctp->sctp_ptpbhn) {
if (sctpnext) {
}
}
}
/*
* Similar to but more general than ip_sctp's conn_match().
*
* Matches sets of addresses as follows: if the argument addr set is
* a complete subset of the corresponding addr set in the sctp_t, it
* is a match.
*
* Caller must hold tf->tf_lock.
*
* Returns with a SCTP_REFHOLD sctp structure. Caller must do a SCTP_REFRELE.
*/
sctp_t *
int min_state)
{
min_state) {
continue;
}
/* check for faddr match */
break;
}
}
if (!fp) {
/* no faddr match; keep looking */
continue;
}
/* check for laddr subset match */
goto done;
}
/* no match; continue searching */
}
done:
if (sctp) {
}
return (sctp);
}
{
if (connp->conn_fully_bound) {
} else {
lport));
}
}
{
} else {
if (for_v4)
else
}
}