/*
* 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
*/
/*
*/
#include <inet/kstatcom.h>
#include <inet/kstatcom.h>
#include <inet/udp_impl.h>
static int udp_kstat_update(kstat_t *, int);
static int udp_kstat2_update(kstat_t *, int);
static void udp_clr_stats(udp_stat_t *);
/*
* return SNMP stuff in buffer in mpdata. We don't hold any lock and report
* information that can be changing beneath us.
*/
mblk_t *
{
int state;
int i;
int v4_conn_idx;
int v6_conn_idx;
/*
* make a copy of the original message
*/
return (0);
}
if (legacy_req) {
} else {
udp_mib_size = sizeof (mib2_udp_t);
ude_size = sizeof (mib2_udpEntry_t);
ude6_size = sizeof (mib2_udp6Entry_t);
}
/* fixed length structure for IPv4 and IPv6 counters */
/*
* Synchronize 32- and 64-bit counters. Note that udpInDatagrams and
* udpOutDatagrams are not updated anywhere in UDP. The new 64 bits
* counters are used. Hence the old counters' values in us_sc_mib
* are always 0.
*/
v4_conn_idx = v6_conn_idx = 0;
for (i = 0; i < CONN_G_HASH_SIZE; i++) {
IPCL_UDPCONN))) {
continue;
/*
* Note that the port numbers are sent in
* host byte order
*/
else
}
if (connp->conn_anon_mlp) {
}
switch (connp->conn_mac_mode) {
case CONN_MAC_DEFAULT:
break;
case CONN_MAC_AWARE:
break;
case CONN_MAC_IMPLICIT:
break;
}
}
/*
* Create an IPv4 table entry for IPv4 entries and also
* any IPv6 entries which are bound to in6addr_any
*/
/*
* If in6addr_any this will set it to
* INADDR_ANY
*/
/*
* Can potentially get here for
* v6 socket if another process
* (say, ping) has just done a
* sendto(), changing the state
* from the TS_IDLE above to
* TS_DATA_XFER by the time we hit
* this part of the code.
*/
} else {
}
/*
* We make the assumption that all udp_t
* structs will be created within an address
* region no larger than 32-bits.
*/
if (needattr)
(void) snmp_append_data2(
}
} else {
}
} else {
}
/*
* We make the assumption that all udp_t
* structs will be created within an address
* region no larger than 32-bits.
*/
if (needattr)
(void) snmp_append_data2(
&mp6_attr_tail, (char *)&mlp,
sizeof (mlp));
}
}
}
/* IPv4 UDP endpoints */
sizeof (struct T_optmgmt_ack)];
qreply(q, mp_conn_ctl);
/* table of MLP attributes... */
sizeof (struct T_optmgmt_ack)];
else
qreply(q, mp_attr_ctl);
/* IPv6 UDP endpoints */
sizeof (struct T_optmgmt_ack)];
qreply(q, mp6_conn_ctl);
/* table of MLP attributes... */
sizeof (struct T_optmgmt_ack)];
else
qreply(q, mp6_attr_ctl);
return (mp2ctl);
}
/*
* Return 0 if invalid set request, 1 otherwise, including non-udp requests.
* NOTE: Per MIB-II, UDP has no writable data.
* TODO: If this ever actually tries to set anything, it needs to be
* to do the appropriate locking.
*/
/* ARGSUSED */
int
{
switch (level) {
case MIB2_UDP:
return (0);
default:
return (1);
}
}
void
{
}
}
/*
* To add stats from one mib2_udp_t to another. Static fields are not added.
* The caller should set them up propertly.
*/
static void
{
}
void *
{
{ "udp_sock_fallback", KSTAT_DATA_UINT64 },
{ "udp_out_opt", KSTAT_DATA_UINT64 },
{ "udp_out_err_notconn", KSTAT_DATA_UINT64 },
{ "udp_out_err_output", KSTAT_DATA_UINT64 },
{ "udp_out_err_tudr", KSTAT_DATA_UINT64 },
#ifdef DEBUG
{ "udp_data_conn", KSTAT_DATA_UINT64 },
{ "udp_data_notconn", KSTAT_DATA_UINT64 },
{ "udp_out_lastdst", KSTAT_DATA_UINT64 },
{ "udp_out_diffdst", KSTAT_DATA_UINT64 },
{ "udp_out_ipv6", KSTAT_DATA_UINT64 },
{ "udp_out_mapped", KSTAT_DATA_UINT64 },
{ "udp_out_ipv4", KSTAT_DATA_UINT64 },
#endif
};
0, stackid);
return (NULL);
return (ksp);
}
void
{
}
}
/*
* To copy counters from the per CPU udpp_stat_counter_t to the stack
* udp_stat_t.
*/
static void
{
#ifdef DEBUG
#endif
}
/*
* To set all udp_stat_t counters to 0.
*/
static void
{
#ifdef DEBUG
#endif
}
int
{
int i;
int cnt;
if (rw == KSTAT_WRITE)
return (EACCES);
return (-1);
return (-1);
}
for (i = 0; i < cnt; i++)
return (0);
}
void *
{
{ "inDatagrams", KSTAT_DATA_UINT64, 0 },
{ "inErrors", KSTAT_DATA_UINT32, 0 },
{ "outDatagrams", KSTAT_DATA_UINT64, 0 },
{ "entrySize", KSTAT_DATA_INT32, 0 },
{ "entry6Size", KSTAT_DATA_INT32, 0 },
{ "outErrors", KSTAT_DATA_UINT32, 0 },
};
return (NULL);
return (ksp);
}
/*
* To sum up all MIB2 stats for a udp_stack_t from all per CPU stats. The
* caller should initialize the target mib2_udp_t properly as this function
* just adds up all the per CPU stats.
*/
static void
{
int i;
int cnt;
for (i = 0; i < cnt; i++)
}
static int
{
if (rw == KSTAT_WRITE)
return (EACCES);
return (-1);
return (-1);
}
return (0);
}