sctp_snmp.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"
#define _SUN_TPI_VERSION 2
#include <inet/kstatcom.h>
#include <inet/ipclassifier.h>
#include "sctp_impl.h"
#include "sctp_addr.h"
static int
{
return (EIO);
if (rw == KSTAT_WRITE)
return (EACCES);
/*
* Get the number of current associations and gather their
* individual set of statistics.
*/
if (sctp->sctp_condemned) {
continue;
}
sctp->sctp_refcnt++;
goto next_sctp;
}
if (sctp->sctp_opkts) {
sctp->sctp_opkts);
sctp->sctp_opkts = 0;
}
if (sctp->sctp_obchunks) {
sctp->sctp_obchunks = 0;
}
if (sctp->sctp_odchunks) {
sctp->sctp_odchunks = 0;
}
if (sctp->sctp_oudchunks) {
sctp->sctp_oudchunks = 0;
}
if (sctp->sctp_rxtchunks) {
sctp->sctp_rxtchunks = 0;
}
if (sctp->sctp_ipkts) {
sctp->sctp_ipkts = 0;
}
if (sctp->sctp_ibchunks) {
sctp->sctp_ibchunks = 0;
}
if (sctp->sctp_idchunks) {
sctp->sctp_idchunks = 0;
}
if (sctp->sctp_iudchunks) {
sctp->sctp_iudchunks = 0;
}
if (sctp->sctp_fragdmsgs) {
sctp->sctp_fragdmsgs = 0;
}
if (sctp->sctp_reassmsgs) {
sctp->sctp_reassmsgs = 0;
}
}
/* Copy data from the SCTP MIB */
/* These are from global ndd params. */
return (0);
}
void
sctp_kstat_init(void)
{
{ "sctpRtoAlgorithm", KSTAT_DATA_INT32, 0 },
{ "sctpRtoMin", KSTAT_DATA_UINT32, 0 },
{ "sctpRtoMax", KSTAT_DATA_UINT32, 0 },
{ "sctpRtoInitial", KSTAT_DATA_UINT32, 0 },
{ "sctpMaxAssocs", KSTAT_DATA_INT32, 0 },
{ "sctpValCookieLife", KSTAT_DATA_UINT32, 0 },
{ "sctpMaxInitRetr", KSTAT_DATA_UINT32, 0 },
{ "sctpCurrEstab", KSTAT_DATA_INT32, 0 },
{ "sctpActiveEstab", KSTAT_DATA_INT32, 0 },
{ "sctpPassiveEstab", KSTAT_DATA_INT32, 0 },
{ "sctpAborted", KSTAT_DATA_INT32, 0 },
{ "sctpShutdowns", KSTAT_DATA_INT32, 0 },
{ "sctpOutOfBlue", KSTAT_DATA_INT32, 0 },
{ "sctpChecksumError", KSTAT_DATA_INT32, 0 },
{ "sctpOutCtrlChunks", KSTAT_DATA_INT64, 0 },
{ "sctpOutOrderChunks", KSTAT_DATA_INT64, 0 },
{ "sctpOutUnorderChunks", KSTAT_DATA_INT64, 0 },
{ "sctpRetransChunks", KSTAT_DATA_INT64, 0 },
{ "sctpOutAck", KSTAT_DATA_INT32, 0 },
{ "sctpOutAckDelayed", KSTAT_DATA_INT32, 0 },
{ "sctpOutWinUpdate", KSTAT_DATA_INT32, 0 },
{ "sctpOutFastRetrans", KSTAT_DATA_INT32, 0 },
{ "sctpOutWinProbe", KSTAT_DATA_INT32, 0 },
{ "sctpInCtrlChunks", KSTAT_DATA_INT64, 0 },
{ "sctpInOrderChunks", KSTAT_DATA_INT64, 0 },
{ "sctpInUnorderChunks", KSTAT_DATA_INT64, 0 },
{ "sctpInAck", KSTAT_DATA_INT32, 0 },
{ "sctpInDupAck", KSTAT_DATA_INT32, 0 },
{ "sctpInAckUnsent", KSTAT_DATA_INT32, 0 },
{ "sctpFragUsrMsgs", KSTAT_DATA_INT64, 0 },
{ "sctpReasmUsrMsgs", KSTAT_DATA_INT64, 0 },
{ "sctpOutSCTPPkts", KSTAT_DATA_INT64, 0 },
{ "sctpInSCTPPkts", KSTAT_DATA_INT64, 0 },
{ "sctpInInvalidCookie", KSTAT_DATA_INT32, 0 },
{ "sctpTimRetrans", KSTAT_DATA_INT32, 0 },
{ "sctpTimRetransDrop", KSTAT_DATA_INT32, 0 },
{ "sctpTimHearBeatProbe", KSTAT_DATA_INT32, 0 },
{ "sctpTimHearBeatDrop", KSTAT_DATA_INT32, 0 },
{ "sctpListenDrop", KSTAT_DATA_INT32, 0 },
{ "sctpInClosed", KSTAT_DATA_INT32, 0 }
};
if (sctp_mibkp == NULL)
return;
/* These won't change. */
}
void
sctp_kstat_fini(void)
{
if (sctp_mibkp != NULL) {
sctp_mibkp = NULL;
}
}
/*
* Return SNMP global stats in buffer in mpdata.
* Return associatiation table in mp_conn_data,
* local address table in mp_local_data, and
* remote address table in mp_rem_data.
*/
mblk_t *
{
int i;
int l;
int scanned = 0;
/*
* Make copies of the original message.
* mpctl will hold SCTP counters,
* mp_conn_ctl will hold list of connections.
*/
return (NULL);
}
/* hostname address parameters are not supported in Solaris */
/* build table of connections -- need count in fixed part */
if (sctp->sctp_condemned) {
continue;
}
sctp->sctp_refcnt++;
goto next_sctp;
}
sctp->sctp_opkts = 0;
sctp->sctp_obchunks = 0;
sctp->sctp_odchunks = 0;
sctp->sctp_oudchunks = 0;
sctp->sctp_rxtchunks = 0;
sctp->sctp_ipkts = 0;
sctp->sctp_ibchunks = 0;
sctp->sctp_idchunks = 0;
sctp->sctp_iudchunks = 0;
sctp->sctp_fragdmsgs = 0;
sctp->sctp_reassmsgs = 0;
} else {
}
fp->hb_interval);
} else {
sizeof (sce.sctpAssocRemPrimAddr));
sizeof (sce.sctpAssocLocPrimAddr));
}
/*
* Table for local addresses
*/
scanned = 0;
for (i = 0; i < SCTP_IPIF_HASH; i++) {
continue;
scanned++;
if (IN6_IS_ADDR_V4MAPPED(&addr)) {
} else {
}
(void) snmp_append_data2(mp_local_data,
&mp_local_tail, (char *)&scle,
sizeof (scle));
goto done;
}
}
done:
/*
* Table for remote addresses
*/
} else {
}
} else {
}
}
/* A 0 here indicates that no primary process is known */
sce.sctpAssocPrimProcess = 0;
}
/* fixed length structure for IPv4 and IPv6 counters */
/* table of connections... */
sizeof (struct T_optmgmt_ack)];
qreply(q, mp_conn_ctl);
/* assoc local address table */
sizeof (struct T_optmgmt_ack)];
qreply(q, mp_local_ctl);
/* assoc remote address table */
sizeof (struct T_optmgmt_ack)];
qreply(q, mp_rem_ctl);
return (mp_ret);
}
/* Translate SCTP state to MIB2 SCTP state. */
static int
{
return (0);
switch (sctp->sctp_state) {
case SCTPS_IDLE:
case SCTPS_BOUND:
return (MIB2_SCTP_closed);
case SCTPS_LISTEN:
return (MIB2_SCTP_listen);
case SCTPS_COOKIE_WAIT:
return (MIB2_SCTP_cookieWait);
case SCTPS_COOKIE_ECHOED:
return (MIB2_SCTP_cookieEchoed);
case SCTPS_ESTABLISHED:
return (MIB2_SCTP_established);
case SCTPS_SHUTDOWN_PENDING:
return (MIB2_SCTP_shutdownPending);
case SCTPS_SHUTDOWN_SENT:
return (MIB2_SCTP_shutdownSent);
case SCTPS_SHUTDOWN_RECEIVED:
return (MIB2_SCTP_shutdownReceived);
case SCTPS_SHUTDOWN_ACK_SENT:
return (MIB2_SCTP_shutdownAckSent);
default:
return (0);
}
}