sctp_hash.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (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 2004 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"
/* SCTP bind hash list - all sctp_t with state >= BOUND. */
/* SCTP listen hash list - all sctp_t with state == LISTEN. */
/* Default association hash size. The size must be a power of 2. */
#define SCTP_CONN_HASH_SIZE 8192
void
{
int i;
/* Not a power of two. Round up to nearest power of two */
for (i = 0; i < 31; i++) {
if (sctp_conn_hash_size < (1 << i))
break;
}
sctp_conn_hash_size = 1 << i;
}
if (sctp_conn_hash_size < SCTP_CONN_HASH_SIZE) {
}
for (i = 0; i < sctp_conn_hash_size; i++) {
}
for (i = 0; i < A_CNT(sctp_listen_fanout); i++) {
}
for (i = 0; i < A_CNT(sctp_bind_fanout); i++) {
}
}
void
{
int i;
for (i = 0; i < sctp_conn_hash_size; i++) {
}
for (i = 0; i < A_CNT(sctp_listen_fanout); i++) {
}
for (i = 0; i < A_CNT(sctp_bind_fanout); i++) {
}
}
/* Walk the SCTP global list and refrele the ire for this ipif */
void
{
if (sctp->sctp_condemned) {
continue;
}
sctp->sctp_refcnt++;
} else {
}
/* check for ires cached in faddr */
}
}
}
}
sctp_t *
{
continue;
}
/* check for faddr match */
break;
}
}
if (!fp) {
/* no faddr match; keep looking */
continue;
}
/* check for laddr match */
if (ipif_seqid == 0) {
goto done;
}
} else {
goto done;
}
/* no match; continue to the next in the chain */
}
}
done:
return (sctp);
}
static sctp_t *
{
continue;
}
if (ipif_seqid == 0) {
goto done;
}
} else {
goto done;
}
}
/* no match; continue to the next in the chain */
}
done:
return (sctp);
}
conn_t *
{
/* Not in conn fanout; check listen fanout */
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 {
}
NULL) {
ipif_seqid, zoneid);
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 (IPP_ENABLED(IPP_LOCAL_IN)) {
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;
}
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;
}
if (sctp->sctp_listen_hash_next) {
}
} else {
sctp);
if (sctp->sctp_listen_hash_next) {
sctp);
}
}
}
void
{
if (sctp->sctp_listen_tfp) {
}
}
}
/*
* 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
}
}