sctp_error.c revision 222c5bce8762079550e5ccd485a12de1fff5a82e
/*
* 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.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <inet/ipclassifier.h>
#include "sctp_impl.h"
#include "sctp_asconf.h"
{
return (-1);
}
/* Chunk header */
if (tbit)
if (serror == 0) {
return (alen);
}
if (len > 0) {
}
/* XXX pad */
return (alen);
}
void
{
char *cause;
return;
}
/*
* Create abort chunk.
*/
if (data) {
} else {
}
}
} else {
len = 0;
}
tbit)) < 0) {
return;
}
}
/*
* If iserror == 0, sends an abort. If iserror != 0, sends an error.
*/
void
{
sctp_hdr_t *sh;
uchar_t *p;
int isv4;
if (isv4) {
} else {
}
/*
* If this is a labeled system, then check to see if we're allowed to
* send a response to this particular sender. If not, then just drop.
*/
return;
/* XXX no resources */
return;
}
/* copy in the IP / SCTP header */
if (isv4) {
/*
* Composite is likely incomplete at this point, so pull
* info from the incoming IP / SCTP headers.
*/
/* Copy in the peer's IP addr */
} else {
ip_hdr_len = sizeof (ip6_t);
/* Copy in the peer's IP addr */
}
/* Fill in the holes in the SCTP common header */
/* Link in the abort chunk */
< 0) {
return;
}
if (isv4) {
} else {
}
int err;
if (isv4)
else
if (err != 0) {
return;
}
}
/* Stash the conn ptr info. for IP */
/*
* Let's just mark the IRE for this destination as temporary
* to prevent any DoS attack.
*/
if (isv4) {
ipst);
} else {
}
/*
* In the normal case the ire would be non-null, however it could be
* null, say, if IP needs to resolve the gateway for this address. We
* only care about IRE_CACHE.
*/
return;
return;
}
/* ire_lock is not needed, as ire_marks is protected by irb_lock */
/*
* Only increment the temporary IRE count if the original
* IRE is not already marked temporary.
*/
irb->irb_tmp_ire_cnt++;
}
}
/*ARGSUSED*/
mblk_t *
{
int pad;
}
return (NULL);
}
/* Chunk header */
if (len > 0) {
}
if (pad != 0) {
}
return (emp);
}
/*
* Called from sctp_input_data() to add one error chunk to the error
* chunks list. The error chunks list will be processed at the end
* of sctp_input_data() by calling sctp_process_err().
*/
void
{
return;
} else {
}
/*
* If the current output packet cannot include the new error chunk,
* send out the current packet and then add the new error chunk
* to the new output packet.
*/
/* Just free the latest error chunk. */
return;
}
} else {
else
}
/* Assume that we will send it out... */
}
/*
* Called from sctp_input_data() to send out error chunks created during
* the processing of all the chunks in an incoming packet.
*/
void
{
goto done;
}
done:
sctp->sctp_err_len = 0;
}
/*
* Returns 0 on non-fatal error, otherwise a system error on fatal
* error.
*/
int
{
/* no error cause given */
return (0);
}
/*
* Both BAD_SID and NO_USR_DATA errors
* indicate a serious bug in our stack,
* so complain and abort the association.
*/
case SCTP_ERR_BAD_SID:
return (ECONNABORTED);
case SCTP_ERR_NO_USR_DATA:
return (ECONNABORTED);
case SCTP_ERR_UNREC_CHUNK:
/* Pull out the unrecognized chunk type */
/* Not enough to process */
return (0);
}
/* Turn on ASCONF sending */
/*
* Hand off to asconf to clear out the unacked
* asconf chunk.
*/
/* malformed */
dprint(0, ("Malformed Unrec Chunk error\n"));
return (0);
}
return (0);
}
/* Else drop it */
break;
default:
break;
}
return (0);
}