10Sstevel@tonic-gate /*
20Sstevel@tonic-gate * CDDL HEADER START
30Sstevel@tonic-gate *
40Sstevel@tonic-gate * The contents of this file are subject to the terms of the
51735Skcpoon * Common Development and Distribution License (the "License").
61735Skcpoon * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate *
80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate * See the License for the specific language governing permissions
110Sstevel@tonic-gate * and limitations under the License.
120Sstevel@tonic-gate *
130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate *
190Sstevel@tonic-gate * CDDL HEADER END
200Sstevel@tonic-gate */
211735Skcpoon
220Sstevel@tonic-gate /*
2312474SGeorge.Shepherd@Sun.COM * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
240Sstevel@tonic-gate */
250Sstevel@tonic-gate
260Sstevel@tonic-gate #include <sys/types.h>
270Sstevel@tonic-gate #include <sys/stream.h>
280Sstevel@tonic-gate #include <sys/mdb_modapi.h>
290Sstevel@tonic-gate #include <sys/socket.h>
300Sstevel@tonic-gate #include <sys/list.h>
310Sstevel@tonic-gate #include <sys/strsun.h>
320Sstevel@tonic-gate
330Sstevel@tonic-gate #include <mdb/mdb_stdlib.h>
340Sstevel@tonic-gate
350Sstevel@tonic-gate #include <netinet/in.h>
360Sstevel@tonic-gate #include <netinet/ip6.h>
370Sstevel@tonic-gate #include <netinet/sctp.h>
380Sstevel@tonic-gate
390Sstevel@tonic-gate #include <inet/common.h>
400Sstevel@tonic-gate #include <inet/ip.h>
410Sstevel@tonic-gate #include <inet/ip6.h>
420Sstevel@tonic-gate #include <inet/ipclassifier.h>
430Sstevel@tonic-gate
440Sstevel@tonic-gate #include <sctp/sctp_impl.h>
450Sstevel@tonic-gate #include <sctp/sctp_addr.h>
460Sstevel@tonic-gate
470Sstevel@tonic-gate #define MDB_SCTP_SHOW_FLAGS 0x1
480Sstevel@tonic-gate #define MDB_SCTP_DUMP_ADDRS 0x2
490Sstevel@tonic-gate #define MDB_SCTP_SHOW_HASH 0x4
500Sstevel@tonic-gate #define MDB_SCTP_SHOW_OUT 0x8
510Sstevel@tonic-gate #define MDB_SCTP_SHOW_IN 0x10
520Sstevel@tonic-gate #define MDB_SCTP_SHOW_MISC 0x20
530Sstevel@tonic-gate #define MDB_SCTP_SHOW_RTT 0x40
540Sstevel@tonic-gate #define MDB_SCTP_SHOW_STATS 0x80
550Sstevel@tonic-gate #define MDB_SCTP_SHOW_FLOW 0x100
560Sstevel@tonic-gate #define MDB_SCTP_SHOW_HDR 0x200
570Sstevel@tonic-gate #define MDB_SCTP_SHOW_PMTUD 0x400
580Sstevel@tonic-gate #define MDB_SCTP_SHOW_RXT 0x800
590Sstevel@tonic-gate #define MDB_SCTP_SHOW_CONN 0x1000
600Sstevel@tonic-gate #define MDB_SCTP_SHOW_CLOSE 0x2000
610Sstevel@tonic-gate #define MDB_SCTP_SHOW_EXT 0x4000
620Sstevel@tonic-gate
630Sstevel@tonic-gate #define MDB_SCTP_SHOW_ALL 0xffffffff
640Sstevel@tonic-gate
650Sstevel@tonic-gate /*
660Sstevel@tonic-gate * Copy from usr/src/uts/common/os/list.c. Should we have a generic
670Sstevel@tonic-gate * mdb list walker?
680Sstevel@tonic-gate */
690Sstevel@tonic-gate #define list_object(a, node) ((void *)(((char *)node) - (a)->list_offset))
700Sstevel@tonic-gate
713448Sdh155122 static int
ns_to_stackid(uintptr_t kaddr)723448Sdh155122 ns_to_stackid(uintptr_t kaddr)
733448Sdh155122 {
743448Sdh155122 netstack_t nss;
753448Sdh155122
763448Sdh155122 if (mdb_vread(&nss, sizeof (nss), kaddr) == -1) {
773448Sdh155122 mdb_warn("failed to read netdstack info %p", kaddr);
783448Sdh155122 return (0);
793448Sdh155122 }
803448Sdh155122 return (nss.netstack_stackid);
813448Sdh155122 }
823448Sdh155122
833448Sdh155122 int
sctp_stacks_walk_init(mdb_walk_state_t * wsp)843448Sdh155122 sctp_stacks_walk_init(mdb_walk_state_t *wsp)
853448Sdh155122 {
863448Sdh155122 if (mdb_layered_walk("netstack", wsp) == -1) {
873448Sdh155122 mdb_warn("can't walk 'netstack'");
883448Sdh155122 return (WALK_ERR);
893448Sdh155122 }
903448Sdh155122 return (WALK_NEXT);
913448Sdh155122 }
923448Sdh155122
933448Sdh155122 int
sctp_stacks_walk_step(mdb_walk_state_t * wsp)943448Sdh155122 sctp_stacks_walk_step(mdb_walk_state_t *wsp)
953448Sdh155122 {
963448Sdh155122 uintptr_t kaddr;
973448Sdh155122 netstack_t nss;
983448Sdh155122
993448Sdh155122 if (mdb_vread(&nss, sizeof (nss), wsp->walk_addr) == -1) {
1003448Sdh155122 mdb_warn("can't read netstack at %p", wsp->walk_addr);
1013448Sdh155122 return (WALK_ERR);
1023448Sdh155122 }
1033448Sdh155122 kaddr = (uintptr_t)nss.netstack_modules[NS_SCTP];
1043448Sdh155122 return (wsp->walk_callback(kaddr, wsp->walk_layer, wsp->walk_cbdata));
1053448Sdh155122 }
1063448Sdh155122
107432Svi117747 static char *
sctp_faddr_state(int state)108432Svi117747 sctp_faddr_state(int state)
109432Svi117747 {
110432Svi117747 char *statestr;
111432Svi117747
112432Svi117747 switch (state) {
113432Svi117747 case SCTP_FADDRS_UNREACH:
114432Svi117747 statestr = "Unreachable";
115432Svi117747 break;
116432Svi117747 case SCTP_FADDRS_DOWN:
117432Svi117747 statestr = "Down";
118432Svi117747 break;
119432Svi117747 case SCTP_FADDRS_ALIVE:
120432Svi117747 statestr = "Alive";
121432Svi117747 break;
122432Svi117747 case SCTP_FADDRS_UNCONFIRMED:
123432Svi117747 statestr = "Unconfirmed";
124432Svi117747 break;
125432Svi117747 default:
126432Svi117747 statestr = "Unknown";
127432Svi117747 break;
128432Svi117747 }
129432Svi117747 return (statestr);
130432Svi117747 }
131432Svi117747
1320Sstevel@tonic-gate /* ARGSUSED */
1330Sstevel@tonic-gate static int
sctp_faddr(uintptr_t addr,uint_t flags,int argc,const mdb_arg_t * argv)1340Sstevel@tonic-gate sctp_faddr(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
1350Sstevel@tonic-gate {
1360Sstevel@tonic-gate sctp_faddr_t fa[1];
1370Sstevel@tonic-gate char *statestr;
1380Sstevel@tonic-gate
1390Sstevel@tonic-gate if (!(flags & DCMD_ADDRSPEC))
1400Sstevel@tonic-gate return (DCMD_USAGE);
1410Sstevel@tonic-gate
1420Sstevel@tonic-gate if (mdb_vread(fa, sizeof (*fa), addr) == -1) {
1430Sstevel@tonic-gate mdb_warn("cannot read fadder at %p", addr);
1440Sstevel@tonic-gate return (DCMD_ERR);
1450Sstevel@tonic-gate }
1460Sstevel@tonic-gate
14713009SChandrasekar.Marimuthu@Sun.COM statestr = sctp_faddr_state(fa->sf_state);
14813009SChandrasekar.Marimuthu@Sun.COM mdb_printf("%<u>%p\t%<b>%N%</b>\t%s%</u>\n", addr, &fa->sf_faddr,
1490Sstevel@tonic-gate statestr);
15013009SChandrasekar.Marimuthu@Sun.COM mdb_printf("next\t\t%?p\tsaddr\t%N\n", fa->sf_next, &fa->sf_saddr);
15113009SChandrasekar.Marimuthu@Sun.COM mdb_printf("rto\t\t%?d\tsrtt\t\t%?d\n", fa->sf_rto, fa->sf_srtt);
15213009SChandrasekar.Marimuthu@Sun.COM mdb_printf("rttvar\t\t%?d\trtt_updates\t%?u\n", fa->sf_rttvar,
15313009SChandrasekar.Marimuthu@Sun.COM fa->sf_rtt_updates);
15413009SChandrasekar.Marimuthu@Sun.COM mdb_printf("strikes\t\t%?d\tmax_retr\t%?d\n", fa->sf_strikes,
15513009SChandrasekar.Marimuthu@Sun.COM fa->sf_max_retr);
15613009SChandrasekar.Marimuthu@Sun.COM mdb_printf("hb_expiry\t%?ld\thb_interval\t%?u\n", fa->sf_hb_expiry,
15713009SChandrasekar.Marimuthu@Sun.COM fa->sf_hb_interval);
15813009SChandrasekar.Marimuthu@Sun.COM mdb_printf("pmss\t\t%?u\tcwnd\t\t%?u\n", fa->sf_pmss, fa->sf_cwnd);
15913009SChandrasekar.Marimuthu@Sun.COM mdb_printf("ssthresh\t%?u\tsuna\t\t%?u\n", fa->sf_ssthresh,
16013009SChandrasekar.Marimuthu@Sun.COM fa->sf_suna);
16113009SChandrasekar.Marimuthu@Sun.COM mdb_printf("pba\t\t%?u\tacked\t\t%?u\n", fa->sf_pba, fa->sf_acked);
16213009SChandrasekar.Marimuthu@Sun.COM mdb_printf("lastactive\t%?ld\thb_secret\t%?#lx\n", fa->sf_lastactive,
16313009SChandrasekar.Marimuthu@Sun.COM fa->sf_hb_secret);
16413009SChandrasekar.Marimuthu@Sun.COM mdb_printf("rxt_unacked\t%?u\n", fa->sf_rxt_unacked);
16513009SChandrasekar.Marimuthu@Sun.COM mdb_printf("timer_mp\t%?p\tixa\t\t%?p\n", fa->sf_timer_mp, fa->sf_ixa);
1664818Skcpoon mdb_printf("hb_enabled\t%?d\thb_pending\t%?d\n"
1674818Skcpoon "timer_running\t%?d\tdf\t\t%?d\n"
1684818Skcpoon "pmtu_discovered\t%?d\tisv4\t\t%?d\n"
1694818Skcpoon "retransmissions\t%?u\n",
17013009SChandrasekar.Marimuthu@Sun.COM fa->sf_hb_enabled, fa->sf_hb_pending, fa->sf_timer_running,
17113009SChandrasekar.Marimuthu@Sun.COM fa->sf_df, fa->sf_pmtu_discovered, fa->sf_isv4, fa->sf_T3expire);
1720Sstevel@tonic-gate
1730Sstevel@tonic-gate return (DCMD_OK);
1740Sstevel@tonic-gate }
1750Sstevel@tonic-gate
1760Sstevel@tonic-gate static void
print_set(sctp_set_t * sp)1770Sstevel@tonic-gate print_set(sctp_set_t *sp)
1780Sstevel@tonic-gate {
1790Sstevel@tonic-gate mdb_printf("\tbegin\t%<b>%?x%</b>\t\tend\t%<b>%?x%</b>\n",
1800Sstevel@tonic-gate sp->begin, sp->end);
1810Sstevel@tonic-gate mdb_printf("\tnext\t%?p\tprev\t%?p\n", sp->next, sp->prev);
1820Sstevel@tonic-gate }
1830Sstevel@tonic-gate
1840Sstevel@tonic-gate /* ARGSUSED */
1850Sstevel@tonic-gate static int
sctp_set(uintptr_t addr,uint_t flags,int argc,const mdb_arg_t * argv)1860Sstevel@tonic-gate sctp_set(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
1870Sstevel@tonic-gate {
1880Sstevel@tonic-gate sctp_set_t sp[1];
1890Sstevel@tonic-gate
1900Sstevel@tonic-gate if (!(flags & DCMD_ADDRSPEC))
1910Sstevel@tonic-gate return (DCMD_USAGE);
1920Sstevel@tonic-gate
1930Sstevel@tonic-gate if (mdb_vread(sp, sizeof (*sp), addr) == -1)
1940Sstevel@tonic-gate return (DCMD_ERR);
1950Sstevel@tonic-gate
1960Sstevel@tonic-gate print_set(sp);
1970Sstevel@tonic-gate
1980Sstevel@tonic-gate return (DCMD_OK);
1990Sstevel@tonic-gate }
2000Sstevel@tonic-gate
2010Sstevel@tonic-gate static void
dump_sack_info(uintptr_t addr)2020Sstevel@tonic-gate dump_sack_info(uintptr_t addr)
2030Sstevel@tonic-gate {
2040Sstevel@tonic-gate sctp_set_t sp[1];
2050Sstevel@tonic-gate
2060Sstevel@tonic-gate while (addr != 0) {
2070Sstevel@tonic-gate if (mdb_vread(sp, sizeof (*sp), addr) == -1) {
2080Sstevel@tonic-gate mdb_warn("failed to read sctp_set at %p", addr);
2090Sstevel@tonic-gate return;
2100Sstevel@tonic-gate }
2110Sstevel@tonic-gate
2120Sstevel@tonic-gate addr = (uintptr_t)sp->next;
2130Sstevel@tonic-gate print_set(sp);
2140Sstevel@tonic-gate }
2150Sstevel@tonic-gate }
2160Sstevel@tonic-gate
2170Sstevel@tonic-gate static int
dump_msghdr(mblk_t * meta)2180Sstevel@tonic-gate dump_msghdr(mblk_t *meta)
2190Sstevel@tonic-gate {
2200Sstevel@tonic-gate sctp_msg_hdr_t smh;
2210Sstevel@tonic-gate
2220Sstevel@tonic-gate if (mdb_vread(&smh, sizeof (smh), (uintptr_t)meta->b_rptr) == -1)
2230Sstevel@tonic-gate return (-1);
2240Sstevel@tonic-gate
2250Sstevel@tonic-gate mdb_printf("%<u>msg_hdr_t at \t%?p\tsentto\t%?p%</u>\n",
2260Sstevel@tonic-gate meta->b_rptr, SCTP_CHUNK_DEST(meta));
2270Sstevel@tonic-gate mdb_printf("\tttl\t%?ld\ttob\t%?ld\n", smh.smh_ttl, smh.smh_tob);
2280Sstevel@tonic-gate mdb_printf("\tsid\t%?u\tssn\t%?u\n", smh.smh_sid, smh.smh_ssn);
2290Sstevel@tonic-gate mdb_printf("\tppid\t%?u\tflags\t%?s\n", smh.smh_ppid,
2300Sstevel@tonic-gate smh.smh_flags & MSG_UNORDERED ? "unordered" : " ");
2310Sstevel@tonic-gate mdb_printf("\tcontext\t%?u\tmsglen\t%?d\n", smh.smh_context,
2320Sstevel@tonic-gate smh.smh_msglen);
2330Sstevel@tonic-gate
2340Sstevel@tonic-gate return (0);
2350Sstevel@tonic-gate }
2360Sstevel@tonic-gate
2370Sstevel@tonic-gate static int
dump_datahdr(mblk_t * mp)2380Sstevel@tonic-gate dump_datahdr(mblk_t *mp)
2390Sstevel@tonic-gate {
2400Sstevel@tonic-gate sctp_data_hdr_t sdc;
2410Sstevel@tonic-gate uint16_t sdh_int16;
2420Sstevel@tonic-gate uint32_t sdh_int32;
2430Sstevel@tonic-gate
2440Sstevel@tonic-gate if (mdb_vread(&sdc, sizeof (sdc), (uintptr_t)mp->b_rptr) == -1)
2450Sstevel@tonic-gate return (-1);
2460Sstevel@tonic-gate
2470Sstevel@tonic-gate mdb_printf("%<u>data_chunk_t \t%?p\tsentto\t%?p%</u>\n",
2480Sstevel@tonic-gate mp->b_rptr, SCTP_CHUNK_DEST(mp));
2490Sstevel@tonic-gate mdb_printf("\tsent\t%?d\t", SCTP_CHUNK_ISSENT(mp)?1:0);
2500Sstevel@tonic-gate mdb_printf("retrans\t%?d\n", SCTP_CHUNK_WANT_REXMIT(mp)?1:0);
2510Sstevel@tonic-gate mdb_printf("\tacked\t%?d\t", SCTP_CHUNK_ISACKED(mp)?1:0);
2520Sstevel@tonic-gate mdb_printf("sackcnt\t%?u\n", SCTP_CHUNK_SACKCNT(mp));
2530Sstevel@tonic-gate
2540Sstevel@tonic-gate mdb_nhconvert(&sdh_int16, &sdc.sdh_len, sizeof (sdc.sdh_len));
2550Sstevel@tonic-gate mdb_printf("\tlen\t%?d\t", sdh_int16);
2560Sstevel@tonic-gate mdb_printf("BBIT=%d", SCTP_DATA_GET_BBIT(&sdc) == 0 ? 0 : 1);
2570Sstevel@tonic-gate mdb_printf("EBIT=%d", SCTP_DATA_GET_EBIT(&sdc) == 0 ? 0 : 1);
2580Sstevel@tonic-gate
2590Sstevel@tonic-gate mdb_nhconvert(&sdh_int32, &sdc.sdh_tsn, sizeof (sdc.sdh_tsn));
2600Sstevel@tonic-gate mdb_nhconvert(&sdh_int16, &sdc.sdh_sid, sizeof (sdc.sdh_sid));
2610Sstevel@tonic-gate mdb_printf("\ttsn\t%?x\tsid\t%?hu\n", sdh_int32, sdh_int16);
2620Sstevel@tonic-gate
2630Sstevel@tonic-gate mdb_nhconvert(&sdh_int16, &sdc.sdh_ssn, sizeof (sdc.sdh_ssn));
2640Sstevel@tonic-gate mdb_nhconvert(&sdh_int32, &sdc.sdh_payload_id,
2650Sstevel@tonic-gate sizeof (sdc.sdh_payload_id));
2660Sstevel@tonic-gate mdb_printf("\tssn\t%?hu\tppid\t%?d\n", sdh_int16, sdh_int32);
2670Sstevel@tonic-gate
2680Sstevel@tonic-gate return (0);
2690Sstevel@tonic-gate }
2700Sstevel@tonic-gate
2710Sstevel@tonic-gate static int
sctp_sent_list(mblk_t * addr)2720Sstevel@tonic-gate sctp_sent_list(mblk_t *addr)
2730Sstevel@tonic-gate {
2740Sstevel@tonic-gate mblk_t meta, mp;
2750Sstevel@tonic-gate
2760Sstevel@tonic-gate if (!addr)
2770Sstevel@tonic-gate return (0);
2780Sstevel@tonic-gate
2790Sstevel@tonic-gate if (mdb_vread(&meta, sizeof (meta), (uintptr_t)addr) == -1)
2800Sstevel@tonic-gate return (-1);
2810Sstevel@tonic-gate
2820Sstevel@tonic-gate for (;;) {
2830Sstevel@tonic-gate dump_msghdr(&meta);
2840Sstevel@tonic-gate
2850Sstevel@tonic-gate if (meta.b_cont == NULL) {
2860Sstevel@tonic-gate mdb_printf("No data chunks with message header!\n");
2870Sstevel@tonic-gate return (-1);
2880Sstevel@tonic-gate }
2890Sstevel@tonic-gate if (mdb_vread(&mp, sizeof (mp),
2904691Skcpoon (uintptr_t)meta.b_cont) == -1) {
2910Sstevel@tonic-gate return (-1);
2920Sstevel@tonic-gate }
2930Sstevel@tonic-gate for (;;) {
2940Sstevel@tonic-gate dump_datahdr(&mp);
2950Sstevel@tonic-gate if (!mp.b_next)
2960Sstevel@tonic-gate break;
2970Sstevel@tonic-gate
2980Sstevel@tonic-gate if (mdb_vread(&mp, sizeof (mp),
2990Sstevel@tonic-gate (uintptr_t)(mp.b_next)) == -1)
3000Sstevel@tonic-gate return (-1);
3010Sstevel@tonic-gate }
3020Sstevel@tonic-gate if (meta.b_next == NULL)
3030Sstevel@tonic-gate break;
3040Sstevel@tonic-gate if (mdb_vread(&meta, sizeof (meta),
3050Sstevel@tonic-gate (uintptr_t)meta.b_next) == -1)
3060Sstevel@tonic-gate return (-1);
3070Sstevel@tonic-gate }
3080Sstevel@tonic-gate
3090Sstevel@tonic-gate return (0);
3100Sstevel@tonic-gate }
3110Sstevel@tonic-gate
3120Sstevel@tonic-gate static int
sctp_unsent_list(mblk_t * addr)3130Sstevel@tonic-gate sctp_unsent_list(mblk_t *addr)
3140Sstevel@tonic-gate {
3150Sstevel@tonic-gate mblk_t meta;
3160Sstevel@tonic-gate
3170Sstevel@tonic-gate if (!addr)
3180Sstevel@tonic-gate return (0);
3190Sstevel@tonic-gate
3200Sstevel@tonic-gate if (mdb_vread(&meta, sizeof (meta), (uintptr_t)addr) == -1)
3210Sstevel@tonic-gate return (-1);
3220Sstevel@tonic-gate
3230Sstevel@tonic-gate for (;;) {
3240Sstevel@tonic-gate dump_msghdr(&meta);
3250Sstevel@tonic-gate
3260Sstevel@tonic-gate if (meta.b_next == NULL)
3270Sstevel@tonic-gate break;
3280Sstevel@tonic-gate
3290Sstevel@tonic-gate if (mdb_vread(&meta, sizeof (meta),
3300Sstevel@tonic-gate (uintptr_t)meta.b_next) == -1)
3310Sstevel@tonic-gate return (-1);
3320Sstevel@tonic-gate }
3330Sstevel@tonic-gate
3340Sstevel@tonic-gate return (0);
3350Sstevel@tonic-gate }
3360Sstevel@tonic-gate
3370Sstevel@tonic-gate /* ARGSUSED */
3380Sstevel@tonic-gate static int
sctp_xmit_list(uintptr_t addr,uint_t flags,int ac,const mdb_arg_t * av)3390Sstevel@tonic-gate sctp_xmit_list(uintptr_t addr, uint_t flags, int ac, const mdb_arg_t *av)
3400Sstevel@tonic-gate {
3410Sstevel@tonic-gate sctp_t sctp;
3420Sstevel@tonic-gate
3430Sstevel@tonic-gate if (!(flags & DCMD_ADDRSPEC))
3440Sstevel@tonic-gate return (DCMD_USAGE);
3450Sstevel@tonic-gate
3460Sstevel@tonic-gate if (mdb_vread(&sctp, sizeof (sctp), addr) == -1)
3470Sstevel@tonic-gate return (DCMD_ERR);
3480Sstevel@tonic-gate
3490Sstevel@tonic-gate mdb_printf("%<b>Chunkified TX list%</b>\n");
3500Sstevel@tonic-gate if (sctp_sent_list(sctp.sctp_xmit_head) < 0)
3510Sstevel@tonic-gate return (DCMD_ERR);
3520Sstevel@tonic-gate
3530Sstevel@tonic-gate mdb_printf("%<b>Unchunkified TX list%</b>\n");
3540Sstevel@tonic-gate if (sctp_unsent_list(sctp.sctp_xmit_unsent) < 0)
3550Sstevel@tonic-gate return (DCMD_ERR);
3560Sstevel@tonic-gate
3570Sstevel@tonic-gate return (DCMD_OK);
3580Sstevel@tonic-gate }
3590Sstevel@tonic-gate
3600Sstevel@tonic-gate /* ARGSUSED */
3610Sstevel@tonic-gate static int
sctp_mdata_chunk(uintptr_t addr,uint_t flags,int ac,const mdb_arg_t * av)3620Sstevel@tonic-gate sctp_mdata_chunk(uintptr_t addr, uint_t flags, int ac, const mdb_arg_t *av)
3630Sstevel@tonic-gate {
3640Sstevel@tonic-gate sctp_data_hdr_t dc;
3650Sstevel@tonic-gate mblk_t mp;
3660Sstevel@tonic-gate
3670Sstevel@tonic-gate if (!(flags & DCMD_ADDRSPEC))
3680Sstevel@tonic-gate return (DCMD_USAGE);
3690Sstevel@tonic-gate
3700Sstevel@tonic-gate if (mdb_vread(&mp, sizeof (mp), addr) == -1)
3710Sstevel@tonic-gate return (DCMD_ERR);
3720Sstevel@tonic-gate
3730Sstevel@tonic-gate if (mdb_vread(&dc, sizeof (dc), (uintptr_t)mp.b_rptr) == -1)
3740Sstevel@tonic-gate return (DCMD_ERR);
3750Sstevel@tonic-gate
3760Sstevel@tonic-gate mdb_printf("%<b>%-?p%</b>tsn\t%?x\tsid\t%?hu\n", addr,
3770Sstevel@tonic-gate dc.sdh_tsn, dc.sdh_sid);
3780Sstevel@tonic-gate mdb_printf("%-?sssn\t%?hu\tppid\t%?x\n", "", dc.sdh_ssn,
3790Sstevel@tonic-gate dc.sdh_payload_id);
3800Sstevel@tonic-gate
3810Sstevel@tonic-gate return (DCMD_OK);
3820Sstevel@tonic-gate }
3830Sstevel@tonic-gate
3840Sstevel@tonic-gate /* ARGSUSED */
3850Sstevel@tonic-gate static int
sctp_istr_msgs(uintptr_t addr,uint_t flags,int ac,const mdb_arg_t * av)3860Sstevel@tonic-gate sctp_istr_msgs(uintptr_t addr, uint_t flags, int ac, const mdb_arg_t *av)
3870Sstevel@tonic-gate {
3880Sstevel@tonic-gate mblk_t istrmp;
3890Sstevel@tonic-gate mblk_t dmp;
3900Sstevel@tonic-gate sctp_data_hdr_t dp;
3910Sstevel@tonic-gate uintptr_t daddr;
3920Sstevel@tonic-gate uintptr_t chaddr;
3930Sstevel@tonic-gate boolean_t bbit;
3940Sstevel@tonic-gate boolean_t ebit;
3950Sstevel@tonic-gate
3960Sstevel@tonic-gate if (!(flags & DCMD_ADDRSPEC))
3970Sstevel@tonic-gate return (DCMD_USAGE);
3980Sstevel@tonic-gate
3990Sstevel@tonic-gate do {
4000Sstevel@tonic-gate if (mdb_vread(&istrmp, sizeof (istrmp), addr) == -1)
4010Sstevel@tonic-gate return (DCMD_ERR);
4020Sstevel@tonic-gate
4030Sstevel@tonic-gate mdb_printf("\tistr mblk at %p: next: %?p\n"
4040Sstevel@tonic-gate "\t\tprev: %?p\tcont: %?p\n", addr, istrmp.b_next,
4050Sstevel@tonic-gate istrmp.b_prev, istrmp.b_cont);
4060Sstevel@tonic-gate daddr = (uintptr_t)&istrmp;
4070Sstevel@tonic-gate do {
4080Sstevel@tonic-gate if (mdb_vread(&dmp, sizeof (dmp), daddr) == -1)
4090Sstevel@tonic-gate break;
4100Sstevel@tonic-gate chaddr = (uintptr_t)dmp.b_rptr;
4110Sstevel@tonic-gate if (mdb_vread(&dp, sizeof (dp), chaddr) == -1)
4120Sstevel@tonic-gate break;
4130Sstevel@tonic-gate
4140Sstevel@tonic-gate bbit = (SCTP_DATA_GET_BBIT(&dp) != 0);
4150Sstevel@tonic-gate ebit = (SCTP_DATA_GET_EBIT(&dp) != 0);
4160Sstevel@tonic-gate
4170Sstevel@tonic-gate mdb_printf("\t\t\ttsn: %x bbit: %d ebit: %d\n",
4180Sstevel@tonic-gate dp.sdh_tsn, bbit, ebit);
4190Sstevel@tonic-gate
4200Sstevel@tonic-gate
4210Sstevel@tonic-gate daddr = (uintptr_t)dmp.b_cont;
4220Sstevel@tonic-gate } while (daddr != NULL);
4230Sstevel@tonic-gate
4240Sstevel@tonic-gate addr = (uintptr_t)istrmp.b_next;
4250Sstevel@tonic-gate } while (addr != NULL);
4260Sstevel@tonic-gate
4270Sstevel@tonic-gate return (DCMD_OK);
4280Sstevel@tonic-gate }
4290Sstevel@tonic-gate
4300Sstevel@tonic-gate /* ARGSUSED */
4310Sstevel@tonic-gate static int
sctp_reass_list(uintptr_t addr,uint_t flags,int ac,const mdb_arg_t * av)4320Sstevel@tonic-gate sctp_reass_list(uintptr_t addr, uint_t flags, int ac, const mdb_arg_t *av)
4330Sstevel@tonic-gate {
4340Sstevel@tonic-gate sctp_reass_t srp;
4350Sstevel@tonic-gate mblk_t srpmp;
4360Sstevel@tonic-gate sctp_data_hdr_t dp;
4370Sstevel@tonic-gate mblk_t dmp;
4380Sstevel@tonic-gate uintptr_t daddr;
4390Sstevel@tonic-gate uintptr_t chaddr;
4400Sstevel@tonic-gate boolean_t bbit, ebit;
4410Sstevel@tonic-gate
4420Sstevel@tonic-gate if (!(flags & DCMD_ADDRSPEC))
4430Sstevel@tonic-gate return (DCMD_USAGE);
4440Sstevel@tonic-gate
4450Sstevel@tonic-gate do {
4460Sstevel@tonic-gate if (mdb_vread(&srpmp, sizeof (srpmp), addr) == -1)
4470Sstevel@tonic-gate return (DCMD_ERR);
4480Sstevel@tonic-gate
4490Sstevel@tonic-gate if (mdb_vread(&srp, sizeof (srp),
4500Sstevel@tonic-gate (uintptr_t)srpmp.b_datap->db_base) == -1)
4510Sstevel@tonic-gate return (DCMD_ERR);
4520Sstevel@tonic-gate
4530Sstevel@tonic-gate mdb_printf("\treassembly mblk at %p: next: %?p\n"
4540Sstevel@tonic-gate "\t\tprev: %?p\tcont: %?p\n", addr, srpmp.b_next,
4550Sstevel@tonic-gate srpmp.b_prev, srpmp.b_cont);
4560Sstevel@tonic-gate mdb_printf("\t\tssn: %hu\tneeded: %hu\tgot: %hu\ttail: %?p\n"
45713009SChandrasekar.Marimuthu@Sun.COM "\t\tpartial_delivered: %s\n", srp.sr_ssn, srp.sr_needed,
45813009SChandrasekar.Marimuthu@Sun.COM srp.sr_got, srp.sr_tail, srp.sr_partial_delivered ? "TRUE" :
4590Sstevel@tonic-gate "FALSE");
4600Sstevel@tonic-gate
4610Sstevel@tonic-gate /* display the contents of this ssn's reassemby list */
4620Sstevel@tonic-gate daddr = DB_TYPE(&srpmp) == M_CTL ? (uintptr_t)srpmp.b_cont :
4630Sstevel@tonic-gate (uintptr_t)&srpmp;
4640Sstevel@tonic-gate do {
4650Sstevel@tonic-gate if (mdb_vread(&dmp, sizeof (dmp), daddr) == -1)
4660Sstevel@tonic-gate break;
4670Sstevel@tonic-gate chaddr = (uintptr_t)dmp.b_rptr;
4680Sstevel@tonic-gate if (mdb_vread(&dp, sizeof (dp), chaddr) == -1)
4690Sstevel@tonic-gate break;
4700Sstevel@tonic-gate
4710Sstevel@tonic-gate bbit = (SCTP_DATA_GET_BBIT(&dp) != 0);
4720Sstevel@tonic-gate ebit = (SCTP_DATA_GET_EBIT(&dp) != 0);
4730Sstevel@tonic-gate
4740Sstevel@tonic-gate mdb_printf("\t\t\ttsn: %x bbit: %d ebit: %d\n",
4750Sstevel@tonic-gate dp.sdh_tsn, bbit, ebit);
4760Sstevel@tonic-gate
4770Sstevel@tonic-gate daddr = (uintptr_t)dmp.b_cont;
4780Sstevel@tonic-gate } while (daddr != NULL);
4790Sstevel@tonic-gate
4800Sstevel@tonic-gate addr = (uintptr_t)srpmp.b_next;
4810Sstevel@tonic-gate } while (addr != NULL);
4820Sstevel@tonic-gate
4830Sstevel@tonic-gate return (DCMD_OK);
4840Sstevel@tonic-gate }
4850Sstevel@tonic-gate
4860Sstevel@tonic-gate /* ARGSUSED */
4870Sstevel@tonic-gate static int
sctp_uo_reass_list(uintptr_t addr,uint_t flags,int ac,const mdb_arg_t * av)4880Sstevel@tonic-gate sctp_uo_reass_list(uintptr_t addr, uint_t flags, int ac, const mdb_arg_t *av)
4890Sstevel@tonic-gate {
4900Sstevel@tonic-gate sctp_data_hdr_t dp;
4910Sstevel@tonic-gate mblk_t dmp;
4920Sstevel@tonic-gate uintptr_t chaddr;
4930Sstevel@tonic-gate boolean_t bbit;
4940Sstevel@tonic-gate boolean_t ebit;
4950Sstevel@tonic-gate boolean_t ubit;
4960Sstevel@tonic-gate
4970Sstevel@tonic-gate if (!(flags & DCMD_ADDRSPEC))
4980Sstevel@tonic-gate return (DCMD_USAGE);
4990Sstevel@tonic-gate
5000Sstevel@tonic-gate do {
5010Sstevel@tonic-gate if (mdb_vread(&dmp, sizeof (dmp), addr) == -1)
5020Sstevel@tonic-gate return (DCMD_ERR);
5030Sstevel@tonic-gate
5040Sstevel@tonic-gate mdb_printf("\treassembly mblk at %p: next: %?p\n"
5050Sstevel@tonic-gate "\t\tprev: %?p\n", addr, dmp.b_next, dmp.b_prev);
5060Sstevel@tonic-gate
5070Sstevel@tonic-gate chaddr = (uintptr_t)dmp.b_rptr;
5080Sstevel@tonic-gate if (mdb_vread(&dp, sizeof (dp), chaddr) == -1)
5090Sstevel@tonic-gate break;
5100Sstevel@tonic-gate
5110Sstevel@tonic-gate bbit = (SCTP_DATA_GET_BBIT(&dp) != 0);
5120Sstevel@tonic-gate ebit = (SCTP_DATA_GET_EBIT(&dp) != 0);
5130Sstevel@tonic-gate ubit = (SCTP_DATA_GET_UBIT(&dp) != 0);
5140Sstevel@tonic-gate
5150Sstevel@tonic-gate mdb_printf("\t\t\tsid: %hu ssn: %hu tsn: %x "
5160Sstevel@tonic-gate "flags: %x (U=%d B=%d E=%d)\n", dp.sdh_sid, dp.sdh_ssn,
5170Sstevel@tonic-gate dp.sdh_tsn, dp.sdh_flags, ubit, bbit, ebit);
5180Sstevel@tonic-gate
5190Sstevel@tonic-gate addr = (uintptr_t)dmp.b_next;
5200Sstevel@tonic-gate } while (addr != NULL);
5210Sstevel@tonic-gate
5220Sstevel@tonic-gate return (DCMD_OK);
5230Sstevel@tonic-gate }
5240Sstevel@tonic-gate
5250Sstevel@tonic-gate static int
sctp_instr(uintptr_t addr,uint_t flags,int ac,const mdb_arg_t * av)5260Sstevel@tonic-gate sctp_instr(uintptr_t addr, uint_t flags, int ac, const mdb_arg_t *av)
5270Sstevel@tonic-gate {
5280Sstevel@tonic-gate sctp_instr_t sip;
5290Sstevel@tonic-gate
5300Sstevel@tonic-gate if (!(flags & DCMD_ADDRSPEC))
5310Sstevel@tonic-gate return (DCMD_USAGE);
5320Sstevel@tonic-gate
5330Sstevel@tonic-gate if (mdb_vread(&sip, sizeof (sip), addr) == -1)
5340Sstevel@tonic-gate return (DCMD_ERR);
5350Sstevel@tonic-gate
5360Sstevel@tonic-gate mdb_printf("%<b>%-?p%</b>\n\tmsglist\t%?p\tnmsgs\t%?d\n"
5370Sstevel@tonic-gate "\tnextseq\t%?d\treass\t%?p\n", addr, sip.istr_msgs,
5380Sstevel@tonic-gate sip.istr_nmsgs, sip.nextseq, sip.istr_reass);
5390Sstevel@tonic-gate mdb_set_dot(addr + sizeof (sip));
5400Sstevel@tonic-gate
5410Sstevel@tonic-gate return (sctp_reass_list((uintptr_t)sip.istr_reass, flags, ac, av));
5420Sstevel@tonic-gate }
5430Sstevel@tonic-gate
5440Sstevel@tonic-gate static const char *
state2str(sctp_t * sctp)5450Sstevel@tonic-gate state2str(sctp_t *sctp)
5460Sstevel@tonic-gate {
5470Sstevel@tonic-gate switch (sctp->sctp_state) {
5480Sstevel@tonic-gate case SCTPS_IDLE: return ("SCTPS_IDLE");
5490Sstevel@tonic-gate case SCTPS_BOUND: return ("SCTPS_BOUND");
5500Sstevel@tonic-gate case SCTPS_LISTEN: return ("SCTPS_LISTEN");
5510Sstevel@tonic-gate case SCTPS_COOKIE_WAIT: return ("SCTPS_COOKIE_WAIT");
5520Sstevel@tonic-gate case SCTPS_COOKIE_ECHOED: return ("SCTPS_COOKIE_ECHOED");
5530Sstevel@tonic-gate case SCTPS_ESTABLISHED: return ("SCTPS_ESTABLISHED");
5540Sstevel@tonic-gate case SCTPS_SHUTDOWN_PENDING: return ("SCTPS_SHUTDOWN_PENDING");
5550Sstevel@tonic-gate case SCTPS_SHUTDOWN_SENT: return ("SCTPS_SHUTDOWN_SENT");
5560Sstevel@tonic-gate case SCTPS_SHUTDOWN_RECEIVED: return ("SCTPS_SHUTDOWN_RECEIVED");
5570Sstevel@tonic-gate case SCTPS_SHUTDOWN_ACK_SENT: return ("SCTPS_SHUTDOWN_ACK_SENT");
5580Sstevel@tonic-gate default: return ("UNKNOWN STATE");
5590Sstevel@tonic-gate }
5600Sstevel@tonic-gate }
5610Sstevel@tonic-gate
5620Sstevel@tonic-gate static void
show_sctp_flags(sctp_t * sctp)5630Sstevel@tonic-gate show_sctp_flags(sctp_t *sctp)
5640Sstevel@tonic-gate {
5650Sstevel@tonic-gate mdb_printf("\tunderstands_asconf\t%d\n",
5660Sstevel@tonic-gate sctp->sctp_understands_asconf);
56711042SErik.Nordmark@Sun.COM mdb_printf("\tdebug\t\t\t%d\n", sctp->sctp_connp->conn_debug);
5680Sstevel@tonic-gate mdb_printf("\tcchunk_pend\t\t%d\n", sctp->sctp_cchunk_pend);
56911042SErik.Nordmark@Sun.COM mdb_printf("\tdgram_errind\t\t%d\n",
57011042SErik.Nordmark@Sun.COM sctp->sctp_connp->conn_dgram_errind);
5710Sstevel@tonic-gate
57211042SErik.Nordmark@Sun.COM mdb_printf("\tlinger\t\t\t%d\n", sctp->sctp_connp->conn_linger);
5730Sstevel@tonic-gate if (sctp->sctp_lingering)
5740Sstevel@tonic-gate return;
5750Sstevel@tonic-gate mdb_printf("\tlingering\t\t%d\n", sctp->sctp_lingering);
5760Sstevel@tonic-gate mdb_printf("\tloopback\t\t%d\n", sctp->sctp_loopback);
5770Sstevel@tonic-gate mdb_printf("\tforce_sack\t\t%d\n", sctp->sctp_force_sack);
5780Sstevel@tonic-gate
5790Sstevel@tonic-gate mdb_printf("\tack_timer_runing\t%d\n", sctp->sctp_ack_timer_running);
58011042SErik.Nordmark@Sun.COM mdb_printf("\trecvdstaddr\t\t%d\n",
58111042SErik.Nordmark@Sun.COM sctp->sctp_connp->conn_recv_ancillary.crb_recvdstaddr);
5820Sstevel@tonic-gate mdb_printf("\thwcksum\t\t\t%d\n", sctp->sctp_hwcksum);
5830Sstevel@tonic-gate mdb_printf("\tunderstands_addip\t%d\n", sctp->sctp_understands_addip);
5840Sstevel@tonic-gate
5850Sstevel@tonic-gate mdb_printf("\tbound_to_all\t\t%d\n", sctp->sctp_bound_to_all);
5860Sstevel@tonic-gate mdb_printf("\tcansleep\t\t%d\n", sctp->sctp_cansleep);
5870Sstevel@tonic-gate mdb_printf("\tdetached\t\t%d\n", sctp->sctp_detached);
5885586Skcpoon mdb_printf("\tsend_adaptation\t\t%d\n", sctp->sctp_send_adaptation);
5890Sstevel@tonic-gate
5905586Skcpoon mdb_printf("\trecv_adaptation\t\t%d\n", sctp->sctp_recv_adaptation);
5910Sstevel@tonic-gate mdb_printf("\tndelay\t\t\t%d\n", sctp->sctp_ndelay);
5920Sstevel@tonic-gate mdb_printf("\tcondemned\t\t%d\n", sctp->sctp_condemned);
5930Sstevel@tonic-gate mdb_printf("\tchk_fast_rexmit\t\t%d\n", sctp->sctp_chk_fast_rexmit);
5941735Skcpoon
5950Sstevel@tonic-gate mdb_printf("\tprsctp_aware\t\t%d\n", sctp->sctp_prsctp_aware);
596432Svi117747 mdb_printf("\tlinklocal\t\t%d\n", sctp->sctp_linklocal);
5971735Skcpoon mdb_printf("\trexmitting\t\t%d\n", sctp->sctp_rexmitting);
5982263Ssommerfe mdb_printf("\tzero_win_probe\t\t%d\n", sctp->sctp_zero_win_probe);
5990Sstevel@tonic-gate
6000Sstevel@tonic-gate mdb_printf("\trecvsndrcvinfo\t\t%d\n", sctp->sctp_recvsndrcvinfo);
6010Sstevel@tonic-gate mdb_printf("\trecvassocevnt\t\t%d\n", sctp->sctp_recvassocevnt);
6020Sstevel@tonic-gate mdb_printf("\trecvpathevnt\t\t%d\n", sctp->sctp_recvpathevnt);
6030Sstevel@tonic-gate mdb_printf("\trecvsendfailevnt\t%d\n", sctp->sctp_recvsendfailevnt);
6040Sstevel@tonic-gate
6050Sstevel@tonic-gate mdb_printf("\trecvpeerevnt\t\t%d\n", sctp->sctp_recvpeererr);
6060Sstevel@tonic-gate mdb_printf("\trecvchutdownevnt\t%d\n", sctp->sctp_recvshutdownevnt);
6070Sstevel@tonic-gate mdb_printf("\trecvcpdnevnt\t\t%d\n", sctp->sctp_recvpdevnt);
6080Sstevel@tonic-gate mdb_printf("\trecvcalevnt\t\t%d\n\n", sctp->sctp_recvalevnt);
6090Sstevel@tonic-gate }
6100Sstevel@tonic-gate
6110Sstevel@tonic-gate /*
6120Sstevel@tonic-gate * Given a sctp_saddr_ipif_t, print out its address. This assumes
6130Sstevel@tonic-gate * that addr contains the sctp_addr_ipif_t structure already and this
6140Sstevel@tonic-gate * function does not need to read it in.
6150Sstevel@tonic-gate */
6160Sstevel@tonic-gate /* ARGSUSED */
6170Sstevel@tonic-gate static int
print_saddr(uintptr_t ptr,const void * addr,void * cbdata)6180Sstevel@tonic-gate print_saddr(uintptr_t ptr, const void *addr, void *cbdata)
6190Sstevel@tonic-gate {
6200Sstevel@tonic-gate sctp_saddr_ipif_t *saddr = (sctp_saddr_ipif_t *)addr;
6210Sstevel@tonic-gate sctp_ipif_t ipif;
6220Sstevel@tonic-gate char *statestr;
6230Sstevel@tonic-gate
6240Sstevel@tonic-gate /* Read in the sctp_ipif object */
6250Sstevel@tonic-gate if (mdb_vread(&ipif, sizeof (ipif), (uintptr_t)saddr->saddr_ipifp) ==
6260Sstevel@tonic-gate -1) {
6270Sstevel@tonic-gate mdb_warn("cannot read ipif at %p", saddr->saddr_ipifp);
6280Sstevel@tonic-gate return (WALK_ERR);
6290Sstevel@tonic-gate }
6300Sstevel@tonic-gate
6310Sstevel@tonic-gate switch (ipif.sctp_ipif_state) {
6320Sstevel@tonic-gate case SCTP_IPIFS_CONDEMNED:
633432Svi117747 statestr = "Condemned";
6340Sstevel@tonic-gate break;
6350Sstevel@tonic-gate case SCTP_IPIFS_INVALID:
636432Svi117747 statestr = "Invalid";
6370Sstevel@tonic-gate break;
6380Sstevel@tonic-gate case SCTP_IPIFS_DOWN:
639432Svi117747 statestr = "Down";
6400Sstevel@tonic-gate break;
6410Sstevel@tonic-gate case SCTP_IPIFS_UP:
642432Svi117747 statestr = "Up";
6430Sstevel@tonic-gate break;
6440Sstevel@tonic-gate default:
645432Svi117747 statestr = "Unknown";
6460Sstevel@tonic-gate break;
6470Sstevel@tonic-gate }
648432Svi117747 mdb_printf("\t%p\t%N% (%s", saddr->saddr_ipifp, &ipif.sctp_ipif_saddr,
649432Svi117747 statestr);
650432Svi117747 if (saddr->saddr_ipif_dontsrc == 1)
651432Svi117747 mdb_printf("/Dontsrc");
652432Svi117747 if (saddr->saddr_ipif_unconfirmed == 1)
653432Svi117747 mdb_printf("/Unconfirmed");
654432Svi117747 if (saddr->saddr_ipif_delete_pending == 1)
655432Svi117747 mdb_printf("/DeletePending");
656432Svi117747 mdb_printf(")\n");
65711042SErik.Nordmark@Sun.COM mdb_printf("\t\t\tid %d zoneid %d IPIF flags %x\n",
65811042SErik.Nordmark@Sun.COM ipif.sctp_ipif_id,
659432Svi117747 ipif.sctp_ipif_zoneid, ipif.sctp_ipif_flags);
6600Sstevel@tonic-gate return (WALK_NEXT);
6610Sstevel@tonic-gate }
6620Sstevel@tonic-gate
6630Sstevel@tonic-gate /*
6640Sstevel@tonic-gate * Given a sctp_faddr_t, print out its address. This assumes that
6650Sstevel@tonic-gate * addr contains the sctp_faddr_t structure already and this function
6660Sstevel@tonic-gate * does not need to read it in.
6670Sstevel@tonic-gate */
6680Sstevel@tonic-gate static int
print_faddr(uintptr_t ptr,const void * addr,void * cbdata)6690Sstevel@tonic-gate print_faddr(uintptr_t ptr, const void *addr, void *cbdata)
6700Sstevel@tonic-gate {
671432Svi117747 char *statestr;
6720Sstevel@tonic-gate sctp_faddr_t *faddr = (sctp_faddr_t *)addr;
6730Sstevel@tonic-gate int *i = cbdata;
6740Sstevel@tonic-gate
67513009SChandrasekar.Marimuthu@Sun.COM statestr = sctp_faddr_state(faddr->sf_state);
676432Svi117747
67713009SChandrasekar.Marimuthu@Sun.COM mdb_printf("\t%d:\t%N\t%?p (%s)\n", (*i)++, &faddr->sf_faddr, ptr,
678432Svi117747 statestr);
6790Sstevel@tonic-gate return (WALK_NEXT);
6800Sstevel@tonic-gate }
6810Sstevel@tonic-gate
6820Sstevel@tonic-gate int
sctp(uintptr_t addr,uint_t flags,int argc,const mdb_arg_t * argv)6830Sstevel@tonic-gate sctp(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
6840Sstevel@tonic-gate {
68511042SErik.Nordmark@Sun.COM sctp_t sctps, *sctp;
68611042SErik.Nordmark@Sun.COM conn_t conns, *connp;
6870Sstevel@tonic-gate int i;
6880Sstevel@tonic-gate uint_t opts = 0;
6890Sstevel@tonic-gate uint_t paddr = 0;
6900Sstevel@tonic-gate in_port_t lport, fport;
6910Sstevel@tonic-gate
6920Sstevel@tonic-gate if (!(flags & DCMD_ADDRSPEC))
6930Sstevel@tonic-gate return (DCMD_USAGE);
6940Sstevel@tonic-gate
69511042SErik.Nordmark@Sun.COM if (mdb_vread(&sctps, sizeof (sctps), addr) == -1) {
6960Sstevel@tonic-gate mdb_warn("failed to read sctp_t at: %p\n", addr);
6970Sstevel@tonic-gate return (DCMD_ERR);
6980Sstevel@tonic-gate }
69911042SErik.Nordmark@Sun.COM sctp = &sctps;
70011042SErik.Nordmark@Sun.COM
70111042SErik.Nordmark@Sun.COM if (mdb_vread(&conns, sizeof (conns),
70211042SErik.Nordmark@Sun.COM (uintptr_t)sctp->sctp_connp) == -1) {
70311042SErik.Nordmark@Sun.COM mdb_warn("failed to read conn_t at: %p\n", sctp->sctp_connp);
7040Sstevel@tonic-gate return (DCMD_ERR);
7050Sstevel@tonic-gate }
7060Sstevel@tonic-gate
70711042SErik.Nordmark@Sun.COM connp = &conns;
70811042SErik.Nordmark@Sun.COM
70911042SErik.Nordmark@Sun.COM connp->conn_sctp = sctp;
71011042SErik.Nordmark@Sun.COM sctp->sctp_connp = connp;
71111042SErik.Nordmark@Sun.COM
7120Sstevel@tonic-gate if (mdb_getopts(argc, argv,
7134691Skcpoon 'a', MDB_OPT_SETBITS, MDB_SCTP_SHOW_ALL, &opts,
7144691Skcpoon 'f', MDB_OPT_SETBITS, MDB_SCTP_SHOW_FLAGS, &opts,
7154691Skcpoon 'h', MDB_OPT_SETBITS, MDB_SCTP_SHOW_HASH, &opts,
7164691Skcpoon 'o', MDB_OPT_SETBITS, MDB_SCTP_SHOW_OUT, &opts,
7174691Skcpoon 'i', MDB_OPT_SETBITS, MDB_SCTP_SHOW_IN, &opts,
7184691Skcpoon 'm', MDB_OPT_SETBITS, MDB_SCTP_SHOW_MISC, &opts,
7194691Skcpoon 'r', MDB_OPT_SETBITS, MDB_SCTP_SHOW_RTT, &opts,
7204691Skcpoon 'S', MDB_OPT_SETBITS, MDB_SCTP_SHOW_STATS, &opts,
7214691Skcpoon 'F', MDB_OPT_SETBITS, MDB_SCTP_SHOW_FLOW, &opts,
7224691Skcpoon 'H', MDB_OPT_SETBITS, MDB_SCTP_SHOW_HDR, &opts,
7234691Skcpoon 'p', MDB_OPT_SETBITS, MDB_SCTP_SHOW_PMTUD, &opts,
7244691Skcpoon 'R', MDB_OPT_SETBITS, MDB_SCTP_SHOW_RXT, &opts,
7254691Skcpoon 'C', MDB_OPT_SETBITS, MDB_SCTP_SHOW_CONN, &opts,
7264691Skcpoon 'c', MDB_OPT_SETBITS, MDB_SCTP_SHOW_CLOSE, &opts,
7274691Skcpoon 'e', MDB_OPT_SETBITS, MDB_SCTP_SHOW_EXT, &opts,
7284691Skcpoon 'P', MDB_OPT_SETBITS, 1, &paddr,
7294691Skcpoon 'd', MDB_OPT_SETBITS, MDB_SCTP_DUMP_ADDRS, &opts) != argc) {
7300Sstevel@tonic-gate return (DCMD_USAGE);
7310Sstevel@tonic-gate }
7320Sstevel@tonic-gate
7330Sstevel@tonic-gate /* non-verbose faddrs, suitable for pipelines to sctp_faddr */
7340Sstevel@tonic-gate if (paddr != 0) {
7350Sstevel@tonic-gate sctp_faddr_t faddr, *fp;
73613009SChandrasekar.Marimuthu@Sun.COM for (fp = sctp->sctp_faddrs; fp != NULL; fp = faddr.sf_next) {
7370Sstevel@tonic-gate if (mdb_vread(&faddr, sizeof (faddr), (uintptr_t)fp)
7380Sstevel@tonic-gate == -1) {
7390Sstevel@tonic-gate mdb_warn("failed to read faddr at %p",
7400Sstevel@tonic-gate fp);
7410Sstevel@tonic-gate return (DCMD_ERR);
7420Sstevel@tonic-gate }
7430Sstevel@tonic-gate mdb_printf("%p\n", fp);
7440Sstevel@tonic-gate }
7450Sstevel@tonic-gate return (DCMD_OK);
7460Sstevel@tonic-gate }
7470Sstevel@tonic-gate
74811042SErik.Nordmark@Sun.COM mdb_nhconvert(&lport, &connp->conn_lport, sizeof (lport));
74911042SErik.Nordmark@Sun.COM mdb_nhconvert(&fport, &connp->conn_fport, sizeof (fport));
7503448Sdh155122 mdb_printf("%<u>%p% %22s S=%-6hu D=%-6hu% STACK=%d ZONE=%d%</u>", addr,
75111042SErik.Nordmark@Sun.COM state2str(sctp), lport, fport,
75211042SErik.Nordmark@Sun.COM ns_to_stackid((uintptr_t)connp->conn_netstack), connp->conn_zoneid);
7530Sstevel@tonic-gate
75411042SErik.Nordmark@Sun.COM if (sctp->sctp_faddrs) {
7550Sstevel@tonic-gate sctp_faddr_t faddr;
7560Sstevel@tonic-gate if (mdb_vread(&faddr, sizeof (faddr),
75711042SErik.Nordmark@Sun.COM (uintptr_t)sctp->sctp_faddrs) != -1)
75813009SChandrasekar.Marimuthu@Sun.COM mdb_printf("%<u> %N%</u>", &faddr.sf_faddr);
7590Sstevel@tonic-gate }
7600Sstevel@tonic-gate mdb_printf("\n");
7610Sstevel@tonic-gate
7620Sstevel@tonic-gate if (opts & MDB_SCTP_DUMP_ADDRS) {
7630Sstevel@tonic-gate mdb_printf("%<b>Local and Peer Addresses%</b>\n");
7640Sstevel@tonic-gate
7650Sstevel@tonic-gate /* Display source addresses */
76611042SErik.Nordmark@Sun.COM mdb_printf("nsaddrs\t\t%?d\n", sctp->sctp_nsaddrs);
7670Sstevel@tonic-gate (void) mdb_pwalk("sctp_walk_saddr", print_saddr, NULL, addr);
7680Sstevel@tonic-gate
7690Sstevel@tonic-gate /* Display peer addresses */
77011042SErik.Nordmark@Sun.COM mdb_printf("nfaddrs\t\t%?d\n", sctp->sctp_nfaddrs);
7710Sstevel@tonic-gate i = 1;
7720Sstevel@tonic-gate (void) mdb_pwalk("sctp_walk_faddr", print_faddr, &i, addr);
7730Sstevel@tonic-gate
7740Sstevel@tonic-gate mdb_printf("lastfaddr\t%?p\tprimary\t\t%?p\n",
77511042SErik.Nordmark@Sun.COM sctp->sctp_lastfaddr, sctp->sctp_primary);
7760Sstevel@tonic-gate mdb_printf("current\t\t%?p\tlastdata\t%?p\n",
77711042SErik.Nordmark@Sun.COM sctp->sctp_current, sctp->sctp_lastdata);
7780Sstevel@tonic-gate }
7790Sstevel@tonic-gate
7800Sstevel@tonic-gate if (opts & MDB_SCTP_SHOW_OUT) {
7810Sstevel@tonic-gate mdb_printf("%<b>Outbound Data%</b>\n");
7820Sstevel@tonic-gate mdb_printf("xmit_head\t%?p\txmit_tail\t%?p\n",
78311042SErik.Nordmark@Sun.COM sctp->sctp_xmit_head, sctp->sctp_xmit_tail);
7840Sstevel@tonic-gate mdb_printf("xmit_unsent\t%?p\txmit_unsent_tail%?p\n",
78511042SErik.Nordmark@Sun.COM sctp->sctp_xmit_unsent, sctp->sctp_xmit_unsent_tail);
78611042SErik.Nordmark@Sun.COM mdb_printf("xmit_unacked\t%?p\n", sctp->sctp_xmit_unacked);
7870Sstevel@tonic-gate mdb_printf("unacked\t\t%?u\tunsent\t\t%?ld\n",
78811042SErik.Nordmark@Sun.COM sctp->sctp_unacked, sctp->sctp_unsent);
7890Sstevel@tonic-gate mdb_printf("ltsn\t\t%?x\tlastack_rxd\t%?x\n",
79011042SErik.Nordmark@Sun.COM sctp->sctp_ltsn, sctp->sctp_lastack_rxd);
7910Sstevel@tonic-gate mdb_printf("recovery_tsn\t%?x\tadv_pap\t\t%?x\n",
79211042SErik.Nordmark@Sun.COM sctp->sctp_recovery_tsn, sctp->sctp_adv_pap);
7930Sstevel@tonic-gate mdb_printf("num_ostr\t%?hu\tostrcntrs\t%?p\n",
79411042SErik.Nordmark@Sun.COM sctp->sctp_num_ostr, sctp->sctp_ostrcntrs);
7954964Skcpoon mdb_printf("pad_mp\t\t%?p\terr_chunks\t%?p\n",
79611042SErik.Nordmark@Sun.COM sctp->sctp_pad_mp, sctp->sctp_err_chunks);
79711042SErik.Nordmark@Sun.COM mdb_printf("err_len\t\t%?u\n", sctp->sctp_err_len);
7980Sstevel@tonic-gate
7990Sstevel@tonic-gate mdb_printf("%<b>Default Send Parameters%</b>\n");
8000Sstevel@tonic-gate mdb_printf("def_stream\t%?u\tdef_flags\t%?x\n",
80111042SErik.Nordmark@Sun.COM sctp->sctp_def_stream, sctp->sctp_def_flags);
8020Sstevel@tonic-gate mdb_printf("def_ppid\t%?x\tdef_context\t%?x\n",
80311042SErik.Nordmark@Sun.COM sctp->sctp_def_ppid, sctp->sctp_def_context);
8040Sstevel@tonic-gate mdb_printf("def_timetolive\t%?u\n",
80511042SErik.Nordmark@Sun.COM sctp->sctp_def_timetolive);
8060Sstevel@tonic-gate }
8070Sstevel@tonic-gate
8080Sstevel@tonic-gate if (opts & MDB_SCTP_SHOW_IN) {
8090Sstevel@tonic-gate mdb_printf("%<b>Inbound Data%</b>\n");
8100Sstevel@tonic-gate mdb_printf("sack_info\t%?p\tsack_gaps\t%?d\n",
81111042SErik.Nordmark@Sun.COM sctp->sctp_sack_info, sctp->sctp_sack_gaps);
81211042SErik.Nordmark@Sun.COM dump_sack_info((uintptr_t)sctp->sctp_sack_info);
8130Sstevel@tonic-gate mdb_printf("ftsn\t\t%?x\tlastacked\t%?x\n",
81411042SErik.Nordmark@Sun.COM sctp->sctp_ftsn, sctp->sctp_lastacked);
8150Sstevel@tonic-gate mdb_printf("istr_nmsgs\t%?d\tsack_toggle\t%?d\n",
81611042SErik.Nordmark@Sun.COM sctp->sctp_istr_nmsgs, sctp->sctp_sack_toggle);
81711042SErik.Nordmark@Sun.COM mdb_printf("ack_mp\t\t%?p\n", sctp->sctp_ack_mp);
8180Sstevel@tonic-gate mdb_printf("num_istr\t%?hu\tinstr\t\t%?p\n",
81911042SErik.Nordmark@Sun.COM sctp->sctp_num_istr, sctp->sctp_instr);
82011042SErik.Nordmark@Sun.COM mdb_printf("unord_reass\t%?p\n", sctp->sctp_uo_frags);
8210Sstevel@tonic-gate }
8220Sstevel@tonic-gate
8230Sstevel@tonic-gate if (opts & MDB_SCTP_SHOW_RTT) {
8240Sstevel@tonic-gate mdb_printf("%<b>RTT Tracking%</b>\n");
8250Sstevel@tonic-gate mdb_printf("rtt_tsn\t\t%?x\tout_time\t%?ld\n",
82611042SErik.Nordmark@Sun.COM sctp->sctp_rtt_tsn, sctp->sctp_out_time);
8270Sstevel@tonic-gate }
8280Sstevel@tonic-gate
8290Sstevel@tonic-gate if (opts & MDB_SCTP_SHOW_FLOW) {
8300Sstevel@tonic-gate mdb_printf("%<b>Flow Control%</b>\n");
83111042SErik.Nordmark@Sun.COM mdb_printf("tconn_sndbuf\t%?d\n"
83211042SErik.Nordmark@Sun.COM "conn_sndlowat\t%?d\tfrwnd\t\t%?u\n"
833*13054SKacheong.Poon@Sun.COM "rwnd\t\t%?u\tlast advertised rwnd\t%?u\n"
83411042SErik.Nordmark@Sun.COM "rxqueued\t%?u\tcwnd_max\t%?u\n", connp->conn_sndbuf,
83511042SErik.Nordmark@Sun.COM connp->conn_sndlowat, sctp->sctp_frwnd,
836*13054SKacheong.Poon@Sun.COM sctp->sctp_rwnd, sctp->sctp_arwnd, sctp->sctp_rxqueued,
83711042SErik.Nordmark@Sun.COM sctp->sctp_cwnd_max);
8380Sstevel@tonic-gate }
8390Sstevel@tonic-gate
8400Sstevel@tonic-gate if (opts & MDB_SCTP_SHOW_HDR) {
8410Sstevel@tonic-gate mdb_printf("%<b>Composite Headers%</b>\n");
8420Sstevel@tonic-gate mdb_printf("iphc\t\t%?p\tiphc6\t\t%?p\n"
8430Sstevel@tonic-gate "iphc_len\t%?d\tiphc6_len\t%?d\n"
8440Sstevel@tonic-gate "hdr_len\t\t%?d\thdr6_len\t%?d\n"
8450Sstevel@tonic-gate "ipha\t\t%?p\tip6h\t\t%?p\n"
8460Sstevel@tonic-gate "ip_hdr_len\t%?d\tip_hdr6_len\t%?d\n"
8470Sstevel@tonic-gate "sctph\t\t%?p\tsctph6\t\t%?p\n"
84811042SErik.Nordmark@Sun.COM "lvtag\t\t%?x\tfvtag\t\t%?x\n", sctp->sctp_iphc,
84911042SErik.Nordmark@Sun.COM sctp->sctp_iphc6, sctp->sctp_iphc_len,
85011042SErik.Nordmark@Sun.COM sctp->sctp_iphc6_len, sctp->sctp_hdr_len,
85111042SErik.Nordmark@Sun.COM sctp->sctp_hdr6_len, sctp->sctp_ipha, sctp->sctp_ip6h,
85211042SErik.Nordmark@Sun.COM sctp->sctp_ip_hdr_len, sctp->sctp_ip_hdr6_len,
85311042SErik.Nordmark@Sun.COM sctp->sctp_sctph, sctp->sctp_sctph6, sctp->sctp_lvtag,
85411042SErik.Nordmark@Sun.COM sctp->sctp_fvtag);
8550Sstevel@tonic-gate }
8560Sstevel@tonic-gate
8570Sstevel@tonic-gate if (opts & MDB_SCTP_SHOW_PMTUD) {
8580Sstevel@tonic-gate mdb_printf("%<b>PMTUd%</b>\n");
8590Sstevel@tonic-gate mdb_printf("last_mtu_probe\t%?ld\tmtu_probe_intvl\t%?ld\n"
8600Sstevel@tonic-gate "mss\t\t%?u\n",
86111042SErik.Nordmark@Sun.COM sctp->sctp_last_mtu_probe, sctp->sctp_mtu_probe_intvl,
86211042SErik.Nordmark@Sun.COM sctp->sctp_mss);
8630Sstevel@tonic-gate }
8640Sstevel@tonic-gate
8650Sstevel@tonic-gate if (opts & MDB_SCTP_SHOW_RXT) {
8660Sstevel@tonic-gate mdb_printf("%<b>Retransmit Info%</b>\n");
8670Sstevel@tonic-gate mdb_printf("cookie_mp\t%?p\tstrikes\t\t%?d\n"
8680Sstevel@tonic-gate "max_init_rxt\t%?d\tpa_max_rxt\t%?d\n"
8690Sstevel@tonic-gate "pp_max_rxt\t%?d\trto_max\t\t%?u\n"
8700Sstevel@tonic-gate "rto_min\t\t%?u\trto_initial\t%?u\n"
8711735Skcpoon "init_rto_max\t%?u\n"
87211042SErik.Nordmark@Sun.COM "rxt_nxttsn\t%?u\trxt_maxtsn\t%?u\n", sctp->sctp_cookie_mp,
87311042SErik.Nordmark@Sun.COM sctp->sctp_strikes, sctp->sctp_max_init_rxt,
87411042SErik.Nordmark@Sun.COM sctp->sctp_pa_max_rxt, sctp->sctp_pp_max_rxt,
87511042SErik.Nordmark@Sun.COM sctp->sctp_rto_max, sctp->sctp_rto_min,
87612474SGeorge.Shepherd@Sun.COM sctp->sctp_rto_initial, sctp->sctp_rto_max_init,
87711042SErik.Nordmark@Sun.COM sctp->sctp_rxt_nxttsn, sctp->sctp_rxt_maxtsn);
8780Sstevel@tonic-gate }
8790Sstevel@tonic-gate
8800Sstevel@tonic-gate if (opts & MDB_SCTP_SHOW_CONN) {
8810Sstevel@tonic-gate mdb_printf("%<b>Connection State%</b>\n");
8820Sstevel@tonic-gate mdb_printf("last_secret_update%?ld\n",
88311042SErik.Nordmark@Sun.COM sctp->sctp_last_secret_update);
8840Sstevel@tonic-gate
8850Sstevel@tonic-gate mdb_printf("secret\t\t");
8860Sstevel@tonic-gate for (i = 0; i < SCTP_SECRET_LEN; i++) {
8870Sstevel@tonic-gate if (i % 2 == 0)
88811042SErik.Nordmark@Sun.COM mdb_printf("0x%02x", sctp->sctp_secret[i]);
8890Sstevel@tonic-gate else
89011042SErik.Nordmark@Sun.COM mdb_printf("%02x ", sctp->sctp_secret[i]);
8910Sstevel@tonic-gate }
8920Sstevel@tonic-gate mdb_printf("\n");
8930Sstevel@tonic-gate mdb_printf("old_secret\t");
8940Sstevel@tonic-gate for (i = 0; i < SCTP_SECRET_LEN; i++) {
8950Sstevel@tonic-gate if (i % 2 == 0)
89611042SErik.Nordmark@Sun.COM mdb_printf("0x%02x", sctp->sctp_old_secret[i]);
8970Sstevel@tonic-gate else
89811042SErik.Nordmark@Sun.COM mdb_printf("%02x ", sctp->sctp_old_secret[i]);
8990Sstevel@tonic-gate }
9000Sstevel@tonic-gate mdb_printf("\n");
9010Sstevel@tonic-gate }
9020Sstevel@tonic-gate
9030Sstevel@tonic-gate if (opts & MDB_SCTP_SHOW_STATS) {
9040Sstevel@tonic-gate mdb_printf("%<b>Stats Counters%</b>\n");
9050Sstevel@tonic-gate mdb_printf("opkts\t\t%?llu\tobchunks\t%?llu\n"
9060Sstevel@tonic-gate "odchunks\t%?llu\toudchunks\t%?llu\n"
9070Sstevel@tonic-gate "rxtchunks\t%?llu\tT1expire\t%?lu\n"
9080Sstevel@tonic-gate "T2expire\t%?lu\tT3expire\t%?lu\n"
9090Sstevel@tonic-gate "msgcount\t%?llu\tprsctpdrop\t%?llu\n"
9100Sstevel@tonic-gate "AssocStartTime\t%?lu\n",
91111042SErik.Nordmark@Sun.COM sctp->sctp_opkts, sctp->sctp_obchunks,
91211042SErik.Nordmark@Sun.COM sctp->sctp_odchunks, sctp->sctp_oudchunks,
91311042SErik.Nordmark@Sun.COM sctp->sctp_rxtchunks, sctp->sctp_T1expire,
91411042SErik.Nordmark@Sun.COM sctp->sctp_T2expire, sctp->sctp_T3expire,
91511042SErik.Nordmark@Sun.COM sctp->sctp_msgcount, sctp->sctp_prsctpdrop,
91611042SErik.Nordmark@Sun.COM sctp->sctp_assoc_start_time);
9170Sstevel@tonic-gate mdb_printf("ipkts\t\t%?llu\tibchunks\t%?llu\n"
9180Sstevel@tonic-gate "idchunks\t%?llu\tiudchunks\t%?llu\n"
9190Sstevel@tonic-gate "fragdmsgs\t%?llu\treassmsgs\t%?llu\n",
92011042SErik.Nordmark@Sun.COM sctp->sctp_ipkts, sctp->sctp_ibchunks,
92111042SErik.Nordmark@Sun.COM sctp->sctp_idchunks, sctp->sctp_iudchunks,
92211042SErik.Nordmark@Sun.COM sctp->sctp_fragdmsgs, sctp->sctp_reassmsgs);
9230Sstevel@tonic-gate }
9240Sstevel@tonic-gate
9250Sstevel@tonic-gate if (opts & MDB_SCTP_SHOW_HASH) {
9260Sstevel@tonic-gate mdb_printf("%<b>Hash Tables%</b>\n");
92711042SErik.Nordmark@Sun.COM mdb_printf("conn_hash_next\t%?p\t", sctp->sctp_conn_hash_next);
92811042SErik.Nordmark@Sun.COM mdb_printf("conn_hash_prev\t%?p\n", sctp->sctp_conn_hash_prev);
9290Sstevel@tonic-gate
9300Sstevel@tonic-gate mdb_printf("listen_hash_next%?p\t",
93111042SErik.Nordmark@Sun.COM sctp->sctp_listen_hash_next);
9320Sstevel@tonic-gate mdb_printf("listen_hash_prev%?p\n",
93311042SErik.Nordmark@Sun.COM sctp->sctp_listen_hash_prev);
93411042SErik.Nordmark@Sun.COM mdb_nhconvert(&lport, &connp->conn_lport, sizeof (lport));
9350Sstevel@tonic-gate mdb_printf("[ listen_hash bucket\t%?d ]\n",
9360Sstevel@tonic-gate SCTP_LISTEN_HASH(lport));
9370Sstevel@tonic-gate
93811042SErik.Nordmark@Sun.COM mdb_printf("conn_tfp\t%?p\t", sctp->sctp_conn_tfp);
93911042SErik.Nordmark@Sun.COM mdb_printf("listen_tfp\t%?p\n", sctp->sctp_listen_tfp);
9400Sstevel@tonic-gate
9410Sstevel@tonic-gate mdb_printf("bind_hash\t%?p\tptpbhn\t\t%?p\n",
94211042SErik.Nordmark@Sun.COM sctp->sctp_bind_hash, sctp->sctp_ptpbhn);
9430Sstevel@tonic-gate mdb_printf("bind_lockp\t%?p\n",
94411042SErik.Nordmark@Sun.COM sctp->sctp_bind_lockp);
9450Sstevel@tonic-gate mdb_printf("[ bind_hash bucket\t%?d ]\n",
9460Sstevel@tonic-gate SCTP_BIND_HASH(lport));
9470Sstevel@tonic-gate }
9480Sstevel@tonic-gate
9490Sstevel@tonic-gate if (opts & MDB_SCTP_SHOW_CLOSE) {
9500Sstevel@tonic-gate mdb_printf("%<b>Cleanup / Close%</b>\n");
9510Sstevel@tonic-gate mdb_printf("shutdown_faddr\t%?p\tclient_errno\t%?d\n"
9520Sstevel@tonic-gate "lingertime\t%?d\trefcnt\t\t%?hu\n",
95311042SErik.Nordmark@Sun.COM sctp->sctp_shutdown_faddr, sctp->sctp_client_errno,
95411042SErik.Nordmark@Sun.COM connp->conn_lingertime, sctp->sctp_refcnt);
9550Sstevel@tonic-gate }
9560Sstevel@tonic-gate
9570Sstevel@tonic-gate if (opts & MDB_SCTP_SHOW_MISC) {
9580Sstevel@tonic-gate mdb_printf("%<b>Miscellaneous%</b>\n");
9590Sstevel@tonic-gate mdb_printf("bound_if\t%?u\theartbeat_mp\t%?p\n"
9600Sstevel@tonic-gate "family\t\t%?u\tipversion\t%?hu\n"
9610Sstevel@tonic-gate "hb_interval\t%?u\tautoclose\t%?d\n"
9625586Skcpoon "active\t\t%?ld\ttx_adaptation_code%?x\n"
9635586Skcpoon "rx_adaptation_code%?x\ttimer_mp\t%?p\n"
9643845Svi117747 "partial_delivery_point\t%?d\n",
96511042SErik.Nordmark@Sun.COM connp->conn_bound_if, sctp->sctp_heartbeat_mp,
96611042SErik.Nordmark@Sun.COM connp->conn_family,
96711042SErik.Nordmark@Sun.COM connp->conn_ipversion,
96811042SErik.Nordmark@Sun.COM sctp->sctp_hb_interval, sctp->sctp_autoclose,
96911042SErik.Nordmark@Sun.COM sctp->sctp_active, sctp->sctp_tx_adaptation_code,
97011042SErik.Nordmark@Sun.COM sctp->sctp_rx_adaptation_code, sctp->sctp_timer_mp,
97111042SErik.Nordmark@Sun.COM sctp->sctp_pd_point);
9720Sstevel@tonic-gate }
9730Sstevel@tonic-gate
9740Sstevel@tonic-gate if (opts & MDB_SCTP_SHOW_EXT) {
9750Sstevel@tonic-gate mdb_printf("%<b>Extensions and Reliable Ctl Chunks%</b>\n");
9760Sstevel@tonic-gate mdb_printf("cxmit_list\t%?p\tlcsn\t\t%?x\n"
97711042SErik.Nordmark@Sun.COM "fcsn\t\t%?x\n", sctp->sctp_cxmit_list, sctp->sctp_lcsn,
97811042SErik.Nordmark@Sun.COM sctp->sctp_fcsn);
9790Sstevel@tonic-gate }
9800Sstevel@tonic-gate
9810Sstevel@tonic-gate if (opts & MDB_SCTP_SHOW_FLAGS) {
9820Sstevel@tonic-gate mdb_printf("%<b>Flags%</b>\n");
98311042SErik.Nordmark@Sun.COM show_sctp_flags(sctp);
9840Sstevel@tonic-gate }
9850Sstevel@tonic-gate
9860Sstevel@tonic-gate return (DCMD_OK);
9870Sstevel@tonic-gate }
9880Sstevel@tonic-gate
9890Sstevel@tonic-gate typedef struct fanout_walk_data {
9900Sstevel@tonic-gate int index;
9910Sstevel@tonic-gate int size;
9920Sstevel@tonic-gate uintptr_t sctp;
9930Sstevel@tonic-gate sctp_tf_t *fanout;
9940Sstevel@tonic-gate uintptr_t (*getnext)(sctp_t *);
9950Sstevel@tonic-gate } fanout_walk_data_t;
9960Sstevel@tonic-gate
9970Sstevel@tonic-gate typedef struct fanout_init {
9983448Sdh155122 const char *nested_walker_name;
9993448Sdh155122 size_t offset; /* for what used to be a symbol */
10003448Sdh155122 int (*getsize)(sctp_stack_t *);
10010Sstevel@tonic-gate uintptr_t (*getnext)(sctp_t *);
10020Sstevel@tonic-gate } fanout_init_t;
10030Sstevel@tonic-gate
10040Sstevel@tonic-gate static uintptr_t
listen_next(sctp_t * sctp)10050Sstevel@tonic-gate listen_next(sctp_t *sctp)
10060Sstevel@tonic-gate {
10070Sstevel@tonic-gate return ((uintptr_t)sctp->sctp_listen_hash_next);
10080Sstevel@tonic-gate }
10090Sstevel@tonic-gate
10103448Sdh155122 /* ARGSUSED */
10110Sstevel@tonic-gate static int
listen_size(sctp_stack_t * sctps)10123448Sdh155122 listen_size(sctp_stack_t *sctps)
10130Sstevel@tonic-gate {
10140Sstevel@tonic-gate return (SCTP_LISTEN_FANOUT_SIZE);
10150Sstevel@tonic-gate }
10160Sstevel@tonic-gate
10170Sstevel@tonic-gate static uintptr_t
conn_next(sctp_t * sctp)10180Sstevel@tonic-gate conn_next(sctp_t *sctp)
10190Sstevel@tonic-gate {
10200Sstevel@tonic-gate return ((uintptr_t)sctp->sctp_conn_hash_next);
10210Sstevel@tonic-gate }
10220Sstevel@tonic-gate
10230Sstevel@tonic-gate static int
conn_size(sctp_stack_t * sctps)10243448Sdh155122 conn_size(sctp_stack_t *sctps)
10250Sstevel@tonic-gate {
10260Sstevel@tonic-gate int size;
10273448Sdh155122 uintptr_t kaddr;
10280Sstevel@tonic-gate
10293448Sdh155122 kaddr = (uintptr_t)&sctps->sctps_conn_hash_size;
10303448Sdh155122
10313448Sdh155122 if (mdb_vread(&size, sizeof (size), kaddr) == -1) {
10323448Sdh155122 mdb_warn("can't read 'sctps_conn_hash_size' at %p", kaddr);
10330Sstevel@tonic-gate return (1);
10340Sstevel@tonic-gate }
10350Sstevel@tonic-gate return (size);
10360Sstevel@tonic-gate }
10370Sstevel@tonic-gate
10380Sstevel@tonic-gate static uintptr_t
bind_next(sctp_t * sctp)10390Sstevel@tonic-gate bind_next(sctp_t *sctp)
10400Sstevel@tonic-gate {
10410Sstevel@tonic-gate return ((uintptr_t)sctp->sctp_bind_hash);
10420Sstevel@tonic-gate }
10430Sstevel@tonic-gate
10443448Sdh155122 /* ARGSUSED */
10450Sstevel@tonic-gate static int
bind_size(sctp_stack_t * sctps)10463448Sdh155122 bind_size(sctp_stack_t *sctps)
10470Sstevel@tonic-gate {
10480Sstevel@tonic-gate return (SCTP_BIND_FANOUT_SIZE);
10490Sstevel@tonic-gate }
10500Sstevel@tonic-gate
10510Sstevel@tonic-gate static intptr_t
find_next_hash_item(fanout_walk_data_t * fw)10520Sstevel@tonic-gate find_next_hash_item(fanout_walk_data_t *fw)
10530Sstevel@tonic-gate {
10540Sstevel@tonic-gate sctp_tf_t tf;
10550Sstevel@tonic-gate sctp_t sctp;
10560Sstevel@tonic-gate
10570Sstevel@tonic-gate /* first try to continue down the hash chain */
10580Sstevel@tonic-gate if (fw->sctp != NULL) {
10590Sstevel@tonic-gate /* try to get next in hash chain */
10600Sstevel@tonic-gate if (mdb_vread(&sctp, sizeof (sctp), fw->sctp) == -1) {
10610Sstevel@tonic-gate mdb_warn("failed to read sctp at %p", fw->sctp);
10620Sstevel@tonic-gate return (NULL);
10630Sstevel@tonic-gate }
10640Sstevel@tonic-gate fw->sctp = fw->getnext(&sctp);
10650Sstevel@tonic-gate if (fw->sctp != NULL)
10660Sstevel@tonic-gate return (fw->sctp);
10670Sstevel@tonic-gate else
10680Sstevel@tonic-gate /* end of chain; go to next bucket */
10690Sstevel@tonic-gate fw->index++;
10700Sstevel@tonic-gate }
10710Sstevel@tonic-gate
10720Sstevel@tonic-gate /* find a new hash chain, traversing the buckets */
10730Sstevel@tonic-gate for (; fw->index < fw->size; fw->index++) {
10740Sstevel@tonic-gate /* read the current hash line for an sctp */
10750Sstevel@tonic-gate if (mdb_vread(&tf, sizeof (tf),
10764691Skcpoon (uintptr_t)(fw->fanout + fw->index)) == -1) {
10770Sstevel@tonic-gate mdb_warn("failed to read tf at %p",
10780Sstevel@tonic-gate fw->fanout + fw->index);
10790Sstevel@tonic-gate return (NULL);
10800Sstevel@tonic-gate }
10810Sstevel@tonic-gate if (tf.tf_sctp != NULL) {
10820Sstevel@tonic-gate /* start of a new chain */
10830Sstevel@tonic-gate fw->sctp = (uintptr_t)tf.tf_sctp;
10840Sstevel@tonic-gate return (fw->sctp);
10850Sstevel@tonic-gate }
10860Sstevel@tonic-gate }
10870Sstevel@tonic-gate return (NULL);
10880Sstevel@tonic-gate }
10890Sstevel@tonic-gate
10900Sstevel@tonic-gate static int
fanout_stack_walk_init(mdb_walk_state_t * wsp)10913448Sdh155122 fanout_stack_walk_init(mdb_walk_state_t *wsp)
10920Sstevel@tonic-gate {
10930Sstevel@tonic-gate fanout_walk_data_t *lw;
10940Sstevel@tonic-gate fanout_init_t *fi = wsp->walk_arg;
10953448Sdh155122 sctp_stack_t *sctps = (sctp_stack_t *)wsp->walk_addr;
10963448Sdh155122 uintptr_t kaddr;
10970Sstevel@tonic-gate
10983448Sdh155122 if (mdb_vread(&kaddr, sizeof (kaddr),
10993448Sdh155122 wsp->walk_addr + fi->offset) == -1) {
11003448Sdh155122 mdb_warn("can't read sctp fanout at %p",
11013448Sdh155122 wsp->walk_addr + fi->offset);
11020Sstevel@tonic-gate return (WALK_ERR);
11030Sstevel@tonic-gate }
11040Sstevel@tonic-gate
11050Sstevel@tonic-gate lw = mdb_alloc(sizeof (*lw), UM_SLEEP);
11060Sstevel@tonic-gate lw->index = 0;
11073448Sdh155122 lw->size = fi->getsize(sctps);
11080Sstevel@tonic-gate lw->sctp = NULL;
11093448Sdh155122 lw->fanout = (sctp_tf_t *)kaddr;
11100Sstevel@tonic-gate lw->getnext = fi->getnext;
11110Sstevel@tonic-gate
11120Sstevel@tonic-gate if ((wsp->walk_addr = find_next_hash_item(lw)) == NULL) {
11130Sstevel@tonic-gate return (WALK_DONE);
11140Sstevel@tonic-gate }
11150Sstevel@tonic-gate wsp->walk_data = lw;
11160Sstevel@tonic-gate return (WALK_NEXT);
11170Sstevel@tonic-gate }
11180Sstevel@tonic-gate
11190Sstevel@tonic-gate static int
fanout_stack_walk_step(mdb_walk_state_t * wsp)11203448Sdh155122 fanout_stack_walk_step(mdb_walk_state_t *wsp)
11210Sstevel@tonic-gate {
11220Sstevel@tonic-gate fanout_walk_data_t *fw = wsp->walk_data;
11230Sstevel@tonic-gate uintptr_t addr = wsp->walk_addr;
11240Sstevel@tonic-gate sctp_t sctp;
11250Sstevel@tonic-gate int status;
11260Sstevel@tonic-gate
11270Sstevel@tonic-gate if (mdb_vread(&sctp, sizeof (sctp), addr) == -1) {
11280Sstevel@tonic-gate mdb_warn("failed to read sctp at %p", addr);
11290Sstevel@tonic-gate return (WALK_DONE);
11300Sstevel@tonic-gate }
11310Sstevel@tonic-gate
11320Sstevel@tonic-gate status = wsp->walk_callback(addr, &sctp, wsp->walk_cbdata);
11330Sstevel@tonic-gate if (status != WALK_NEXT)
11340Sstevel@tonic-gate return (status);
11350Sstevel@tonic-gate
11360Sstevel@tonic-gate if ((wsp->walk_addr = find_next_hash_item(fw)) == NULL)
11370Sstevel@tonic-gate return (WALK_DONE);
11380Sstevel@tonic-gate
11390Sstevel@tonic-gate return (WALK_NEXT);
11400Sstevel@tonic-gate }
11410Sstevel@tonic-gate
11420Sstevel@tonic-gate static void
fanout_stack_walk_fini(mdb_walk_state_t * wsp)11433448Sdh155122 fanout_stack_walk_fini(mdb_walk_state_t *wsp)
11440Sstevel@tonic-gate {
11450Sstevel@tonic-gate fanout_walk_data_t *fw = wsp->walk_data;
11460Sstevel@tonic-gate
11470Sstevel@tonic-gate mdb_free(fw, sizeof (*fw));
11480Sstevel@tonic-gate }
11490Sstevel@tonic-gate
11503448Sdh155122 int
fanout_walk_init(mdb_walk_state_t * wsp)11513448Sdh155122 fanout_walk_init(mdb_walk_state_t *wsp)
11520Sstevel@tonic-gate {
11533448Sdh155122 if (mdb_layered_walk("sctp_stacks", wsp) == -1) {
11543448Sdh155122 mdb_warn("can't walk 'sctp_stacks'");
11553448Sdh155122 return (WALK_ERR);
11563448Sdh155122 }
11573448Sdh155122
11583448Sdh155122 return (WALK_NEXT);
11593448Sdh155122 }
11603448Sdh155122
11613448Sdh155122 int
fanout_walk_step(mdb_walk_state_t * wsp)11623448Sdh155122 fanout_walk_step(mdb_walk_state_t *wsp)
11633448Sdh155122 {
11643448Sdh155122 fanout_init_t *fi = wsp->walk_arg;
11653448Sdh155122
11663448Sdh155122 if (mdb_pwalk(fi->nested_walker_name, wsp->walk_callback,
11674691Skcpoon wsp->walk_cbdata, wsp->walk_addr) == -1) {
11683448Sdh155122 mdb_warn("couldn't walk '%s'for address %p",
11693448Sdh155122 fi->nested_walker_name, wsp->walk_addr);
11703448Sdh155122 return (WALK_ERR);
11713448Sdh155122 }
11720Sstevel@tonic-gate return (WALK_NEXT);
11730Sstevel@tonic-gate }
11740Sstevel@tonic-gate
11753448Sdh155122 int
sctps_walk_init(mdb_walk_state_t * wsp)11763448Sdh155122 sctps_walk_init(mdb_walk_state_t *wsp)
11770Sstevel@tonic-gate {
11780Sstevel@tonic-gate
11793448Sdh155122 if (mdb_layered_walk("sctp_stacks", wsp) == -1) {
11803448Sdh155122 mdb_warn("can't walk 'sctp_stacks'");
11810Sstevel@tonic-gate return (WALK_ERR);
11820Sstevel@tonic-gate }
11833448Sdh155122
11843448Sdh155122 return (WALK_NEXT);
11853448Sdh155122 }
11860Sstevel@tonic-gate
11873448Sdh155122 int
sctps_walk_step(mdb_walk_state_t * wsp)11883448Sdh155122 sctps_walk_step(mdb_walk_state_t *wsp)
11893448Sdh155122 {
11903448Sdh155122 uintptr_t kaddr;
11913448Sdh155122
11923448Sdh155122 kaddr = wsp->walk_addr + OFFSETOF(sctp_stack_t, sctps_g_list);
11933448Sdh155122 if (mdb_pwalk("list", wsp->walk_callback,
11944691Skcpoon wsp->walk_cbdata, kaddr) == -1) {
11953448Sdh155122 mdb_warn("couldn't walk 'list' for address %p", kaddr);
11963448Sdh155122 return (WALK_ERR);
11970Sstevel@tonic-gate }
11983448Sdh155122 return (WALK_NEXT);
11990Sstevel@tonic-gate }
12000Sstevel@tonic-gate
12010Sstevel@tonic-gate static int
sctp_walk_faddr_init(mdb_walk_state_t * wsp)12020Sstevel@tonic-gate sctp_walk_faddr_init(mdb_walk_state_t *wsp)
12030Sstevel@tonic-gate {
12040Sstevel@tonic-gate sctp_t sctp;
12050Sstevel@tonic-gate
12060Sstevel@tonic-gate if (wsp->walk_addr == NULL)
12070Sstevel@tonic-gate return (WALK_ERR);
12080Sstevel@tonic-gate
12090Sstevel@tonic-gate if (mdb_vread(&sctp, sizeof (sctp), wsp->walk_addr) == -1) {
12100Sstevel@tonic-gate mdb_warn("failed to read sctp at %p", wsp->walk_addr);
12110Sstevel@tonic-gate return (WALK_ERR);
12120Sstevel@tonic-gate }
12130Sstevel@tonic-gate if ((wsp->walk_addr = (uintptr_t)sctp.sctp_faddrs) != NULL)
12140Sstevel@tonic-gate return (WALK_NEXT);
12150Sstevel@tonic-gate else
12160Sstevel@tonic-gate return (WALK_DONE);
12170Sstevel@tonic-gate }
12180Sstevel@tonic-gate
12190Sstevel@tonic-gate static int
sctp_walk_faddr_step(mdb_walk_state_t * wsp)12200Sstevel@tonic-gate sctp_walk_faddr_step(mdb_walk_state_t *wsp)
12210Sstevel@tonic-gate {
12220Sstevel@tonic-gate uintptr_t faddr_ptr = wsp->walk_addr;
12230Sstevel@tonic-gate sctp_faddr_t sctp_faddr;
12240Sstevel@tonic-gate int status;
12250Sstevel@tonic-gate
12260Sstevel@tonic-gate if (mdb_vread(&sctp_faddr, sizeof (sctp_faddr_t), faddr_ptr) == -1) {
12270Sstevel@tonic-gate mdb_warn("failed to read sctp_faddr_t at %p", faddr_ptr);
12280Sstevel@tonic-gate return (WALK_ERR);
12290Sstevel@tonic-gate }
12300Sstevel@tonic-gate status = wsp->walk_callback(faddr_ptr, &sctp_faddr, wsp->walk_cbdata);
12310Sstevel@tonic-gate if (status != WALK_NEXT)
12320Sstevel@tonic-gate return (status);
123313009SChandrasekar.Marimuthu@Sun.COM if ((faddr_ptr = (uintptr_t)sctp_faddr.sf_next) == NULL) {
12340Sstevel@tonic-gate return (WALK_DONE);
12350Sstevel@tonic-gate } else {
12360Sstevel@tonic-gate wsp->walk_addr = faddr_ptr;
12370Sstevel@tonic-gate return (WALK_NEXT);
12380Sstevel@tonic-gate }
12390Sstevel@tonic-gate }
12400Sstevel@tonic-gate
12410Sstevel@tonic-gate /*
12420Sstevel@tonic-gate * Helper structure for sctp_walk_saddr. It stores the sctp_t being walked,
12430Sstevel@tonic-gate * the current index to the sctp_saddrs[], and the current count of the
12440Sstevel@tonic-gate * sctp_saddr_ipif_t list.
12450Sstevel@tonic-gate */
12460Sstevel@tonic-gate typedef struct {
12470Sstevel@tonic-gate sctp_t sctp;
12480Sstevel@tonic-gate int hash_index;
12490Sstevel@tonic-gate int cur_cnt;
12500Sstevel@tonic-gate } saddr_walk_t;
12510Sstevel@tonic-gate
12520Sstevel@tonic-gate static int
sctp_walk_saddr_init(mdb_walk_state_t * wsp)12530Sstevel@tonic-gate sctp_walk_saddr_init(mdb_walk_state_t *wsp)
12540Sstevel@tonic-gate {
12550Sstevel@tonic-gate sctp_t *sctp;
12560Sstevel@tonic-gate int i;
12570Sstevel@tonic-gate saddr_walk_t *swalker;
12580Sstevel@tonic-gate
12590Sstevel@tonic-gate if (wsp->walk_addr == NULL)
12600Sstevel@tonic-gate return (WALK_ERR);
12610Sstevel@tonic-gate
12620Sstevel@tonic-gate swalker = mdb_alloc(sizeof (saddr_walk_t), UM_SLEEP);
12630Sstevel@tonic-gate sctp = &swalker->sctp;
12640Sstevel@tonic-gate if (mdb_vread(sctp, sizeof (sctp_t), wsp->walk_addr) == -1) {
12650Sstevel@tonic-gate mdb_warn("failed to read sctp at %p", wsp->walk_addr);
12660Sstevel@tonic-gate mdb_free(swalker, sizeof (saddr_walk_t));
12670Sstevel@tonic-gate return (WALK_ERR);
12680Sstevel@tonic-gate }
12690Sstevel@tonic-gate
12700Sstevel@tonic-gate /* Find the first source address. */
12710Sstevel@tonic-gate for (i = 0; i < SCTP_IPIF_HASH; i++) {
12720Sstevel@tonic-gate if (sctp->sctp_saddrs[i].ipif_count > 0) {
12730Sstevel@tonic-gate list_t *addr_list;
12740Sstevel@tonic-gate
12750Sstevel@tonic-gate addr_list = &sctp->sctp_saddrs[i].sctp_ipif_list;
12760Sstevel@tonic-gate wsp->walk_addr = (uintptr_t)list_object(addr_list,
12770Sstevel@tonic-gate addr_list->list_head.list_next);
12780Sstevel@tonic-gate
12790Sstevel@tonic-gate /* Recode the current info */
12800Sstevel@tonic-gate swalker->hash_index = i;
12810Sstevel@tonic-gate swalker->cur_cnt = 1;
12820Sstevel@tonic-gate wsp->walk_data = swalker;
12830Sstevel@tonic-gate
12840Sstevel@tonic-gate return (WALK_NEXT);
12850Sstevel@tonic-gate }
12860Sstevel@tonic-gate }
12870Sstevel@tonic-gate return (WALK_DONE);
12880Sstevel@tonic-gate }
12890Sstevel@tonic-gate
12900Sstevel@tonic-gate static int
sctp_walk_saddr_step(mdb_walk_state_t * wsp)12910Sstevel@tonic-gate sctp_walk_saddr_step(mdb_walk_state_t *wsp)
12920Sstevel@tonic-gate {
12930Sstevel@tonic-gate uintptr_t saddr_ptr = wsp->walk_addr;
12940Sstevel@tonic-gate sctp_saddr_ipif_t saddr;
12950Sstevel@tonic-gate saddr_walk_t *swalker;
12960Sstevel@tonic-gate sctp_t *sctp;
12970Sstevel@tonic-gate int status;
12980Sstevel@tonic-gate int i, j;
12990Sstevel@tonic-gate
13000Sstevel@tonic-gate if (mdb_vread(&saddr, sizeof (sctp_saddr_ipif_t), saddr_ptr) == -1) {
13010Sstevel@tonic-gate mdb_warn("failed to read sctp_saddr_ipif_t at %p", saddr_ptr);
13020Sstevel@tonic-gate return (WALK_ERR);
13030Sstevel@tonic-gate }
13040Sstevel@tonic-gate status = wsp->walk_callback(saddr_ptr, &saddr, wsp->walk_cbdata);
13050Sstevel@tonic-gate if (status != WALK_NEXT)
13060Sstevel@tonic-gate return (status);
13070Sstevel@tonic-gate
13080Sstevel@tonic-gate swalker = (saddr_walk_t *)wsp->walk_data;
13090Sstevel@tonic-gate sctp = &swalker->sctp;
13100Sstevel@tonic-gate i = swalker->hash_index;
13110Sstevel@tonic-gate j = swalker->cur_cnt;
13120Sstevel@tonic-gate
13130Sstevel@tonic-gate /*
13140Sstevel@tonic-gate * If there is still a source address in the current list, return it.
13150Sstevel@tonic-gate * Otherwise, go to the next list in the sctp_saddrs[].
13160Sstevel@tonic-gate */
13170Sstevel@tonic-gate if (j++ < sctp->sctp_saddrs[i].ipif_count) {
13180Sstevel@tonic-gate wsp->walk_addr = (uintptr_t)saddr.saddr_ipif.list_next;
13190Sstevel@tonic-gate swalker->cur_cnt = j;
13200Sstevel@tonic-gate return (WALK_NEXT);
13210Sstevel@tonic-gate } else {
13220Sstevel@tonic-gate list_t *lst;
13230Sstevel@tonic-gate
13240Sstevel@tonic-gate for (i = i + 1; i < SCTP_IPIF_HASH; i++) {
13250Sstevel@tonic-gate if (sctp->sctp_saddrs[i].ipif_count > 0) {
13260Sstevel@tonic-gate lst = &sctp->sctp_saddrs[i].sctp_ipif_list;
13270Sstevel@tonic-gate wsp->walk_addr = (uintptr_t)list_object(
13280Sstevel@tonic-gate lst, lst->list_head.list_next);
13290Sstevel@tonic-gate swalker->hash_index = i;
13300Sstevel@tonic-gate swalker->cur_cnt = 1;
13310Sstevel@tonic-gate return (WALK_NEXT);
13320Sstevel@tonic-gate }
13330Sstevel@tonic-gate }
13340Sstevel@tonic-gate }
13350Sstevel@tonic-gate return (WALK_DONE);
13360Sstevel@tonic-gate }
13370Sstevel@tonic-gate
13380Sstevel@tonic-gate static void
sctp_walk_saddr_fini(mdb_walk_state_t * wsp)13390Sstevel@tonic-gate sctp_walk_saddr_fini(mdb_walk_state_t *wsp)
13400Sstevel@tonic-gate {
13410Sstevel@tonic-gate saddr_walk_t *swalker = (saddr_walk_t *)wsp->walk_data;
13420Sstevel@tonic-gate
13430Sstevel@tonic-gate mdb_free(swalker, sizeof (saddr_walk_t));
13440Sstevel@tonic-gate }
13450Sstevel@tonic-gate
13463448Sdh155122
13473448Sdh155122 typedef struct ill_walk_data {
13483448Sdh155122 sctp_ill_hash_t ills[SCTP_ILL_HASH];
13493448Sdh155122 uint32_t count;
13503448Sdh155122 } ill_walk_data_t;
13513448Sdh155122
13523448Sdh155122 typedef struct ipuf_walk_data {
13533448Sdh155122 sctp_ipif_hash_t ipifs[SCTP_IPIF_HASH];
13543448Sdh155122 uint32_t count;
13553448Sdh155122 } ipif_walk_data_t;
13563448Sdh155122
13573448Sdh155122
13583448Sdh155122 int
sctp_ill_walk_init(mdb_walk_state_t * wsp)13593448Sdh155122 sctp_ill_walk_init(mdb_walk_state_t *wsp)
13603448Sdh155122 {
13613448Sdh155122 if (mdb_layered_walk("sctp_stacks", wsp) == -1) {
13623448Sdh155122 mdb_warn("can't walk 'sctp_stacks'");
13633448Sdh155122 return (WALK_ERR);
13643448Sdh155122 }
13653448Sdh155122
13663448Sdh155122 return (WALK_NEXT);
13673448Sdh155122 }
13683448Sdh155122
13693448Sdh155122 int
sctp_ill_walk_step(mdb_walk_state_t * wsp)13703448Sdh155122 sctp_ill_walk_step(mdb_walk_state_t *wsp)
13713448Sdh155122 {
13723448Sdh155122 if (mdb_pwalk("sctp_stack_walk_ill", wsp->walk_callback,
13734691Skcpoon wsp->walk_cbdata, wsp->walk_addr) == -1) {
13743448Sdh155122 mdb_warn("couldn't walk 'sctp_stack_walk_ill' for addr %p",
13753448Sdh155122 wsp->walk_addr);
13763448Sdh155122 return (WALK_ERR);
13773448Sdh155122 }
13783448Sdh155122 return (WALK_NEXT);
13793448Sdh155122 }
13803448Sdh155122
13813448Sdh155122 /*
13823448Sdh155122 * wsp->walk_addr is the address of sctps_ill_list
13833448Sdh155122 */
13840Sstevel@tonic-gate static int
sctp_stack_ill_walk_init(mdb_walk_state_t * wsp)13853448Sdh155122 sctp_stack_ill_walk_init(mdb_walk_state_t *wsp)
13860Sstevel@tonic-gate {
13873448Sdh155122 ill_walk_data_t iw;
13880Sstevel@tonic-gate intptr_t i;
13893448Sdh155122 uintptr_t kaddr, uaddr;
13903448Sdh155122 size_t offset;
13913448Sdh155122
13923448Sdh155122 kaddr = wsp->walk_addr + OFFSETOF(sctp_stack_t, sctps_ills_count);
13933448Sdh155122 if (mdb_vread(&iw.count, sizeof (iw.count), kaddr) == -1) {
13943448Sdh155122 mdb_warn("can't read sctps_ills_count at %p", kaddr);
13953448Sdh155122 return (WALK_ERR);
13963448Sdh155122 }
13973448Sdh155122 kaddr = wsp->walk_addr + OFFSETOF(sctp_stack_t, sctps_g_ills);
13983448Sdh155122
13993448Sdh155122 if (mdb_vread(&kaddr, sizeof (kaddr), kaddr) == -1) {
14003448Sdh155122 mdb_warn("can't read scpts_g_ills %p", kaddr);
14013448Sdh155122 return (WALK_ERR);
14023448Sdh155122 }
14033448Sdh155122 if (mdb_vread(&iw.ills, sizeof (iw.ills), kaddr) == -1) {
14043448Sdh155122 mdb_warn("failed to read 'sctps_g_ills'");
14053448Sdh155122 return (NULL);
14063448Sdh155122 }
14070Sstevel@tonic-gate
14080Sstevel@tonic-gate /* Find the first ill. */
14090Sstevel@tonic-gate for (i = 0; i < SCTP_ILL_HASH; i++) {
14103448Sdh155122 if (iw.ills[i].ill_count > 0) {
14113448Sdh155122 uaddr = (uintptr_t)&iw.ills[i].sctp_ill_list;
14123448Sdh155122 offset = uaddr - (uintptr_t)&iw.ills;
14133448Sdh155122 if (mdb_pwalk("list", wsp->walk_callback,
14144691Skcpoon wsp->walk_cbdata, kaddr+offset) == -1) {
14153448Sdh155122 mdb_warn("couldn't walk 'list' for address %p",
14163448Sdh155122 kaddr);
14173448Sdh155122 return (WALK_ERR);
14180Sstevel@tonic-gate }
14190Sstevel@tonic-gate }
14200Sstevel@tonic-gate }
14210Sstevel@tonic-gate return (WALK_DONE);
14220Sstevel@tonic-gate }
14230Sstevel@tonic-gate
14240Sstevel@tonic-gate static int
sctp_stack_ill_walk_step(mdb_walk_state_t * wsp)14253448Sdh155122 sctp_stack_ill_walk_step(mdb_walk_state_t *wsp)
14263448Sdh155122 {
14273448Sdh155122 return (wsp->walk_callback(wsp->walk_addr, wsp->walk_layer,
14284691Skcpoon wsp->walk_cbdata));
14293448Sdh155122 }
14303448Sdh155122
14313448Sdh155122 int
sctp_ipif_walk_init(mdb_walk_state_t * wsp)14323448Sdh155122 sctp_ipif_walk_init(mdb_walk_state_t *wsp)
14330Sstevel@tonic-gate {
14343448Sdh155122 if (mdb_layered_walk("sctp_stacks", wsp) == -1) {
14353448Sdh155122 mdb_warn("can't walk 'sctp_stacks'");
14363448Sdh155122 return (WALK_ERR);
14373448Sdh155122 }
14383448Sdh155122 return (WALK_NEXT);
14393448Sdh155122 }
14403448Sdh155122
14413448Sdh155122 int
sctp_ipif_walk_step(mdb_walk_state_t * wsp)14423448Sdh155122 sctp_ipif_walk_step(mdb_walk_state_t *wsp)
14433448Sdh155122 {
14443448Sdh155122 if (mdb_pwalk("sctp_stack_walk_ipif", wsp->walk_callback,
14454691Skcpoon wsp->walk_cbdata, wsp->walk_addr) == -1) {
14463448Sdh155122 mdb_warn("couldn't walk 'sctp_stack_walk_ipif' for addr %p",
14473448Sdh155122 wsp->walk_addr);
14483448Sdh155122 return (WALK_ERR);
14493448Sdh155122 }
14503448Sdh155122 return (WALK_NEXT);
14513448Sdh155122 }
14523448Sdh155122
14533448Sdh155122 /*
14543448Sdh155122 * wsp->walk_addr is the address of sctps_ipif_list
14553448Sdh155122 */
14563448Sdh155122 static int
sctp_stack_ipif_walk_init(mdb_walk_state_t * wsp)14573448Sdh155122 sctp_stack_ipif_walk_init(mdb_walk_state_t *wsp)
14583448Sdh155122 {
14593448Sdh155122 ipif_walk_data_t iw;
14600Sstevel@tonic-gate intptr_t i;
14613448Sdh155122 uintptr_t kaddr, uaddr;
14623448Sdh155122 size_t offset;
14633448Sdh155122
14643448Sdh155122 kaddr = wsp->walk_addr + OFFSETOF(sctp_stack_t, sctps_g_ipifs_count);
14653448Sdh155122 if (mdb_vread(&iw.count, sizeof (iw.count), kaddr) == -1) {
14663448Sdh155122 mdb_warn("can't read sctps_g_ipifs_count at %p", kaddr);
14673448Sdh155122 return (WALK_ERR);
14683448Sdh155122 }
14693448Sdh155122 kaddr = wsp->walk_addr + OFFSETOF(sctp_stack_t, sctps_g_ipifs);
14700Sstevel@tonic-gate
14713448Sdh155122 if (mdb_vread(&kaddr, sizeof (kaddr), kaddr) == -1) {
14723448Sdh155122 mdb_warn("can't read scpts_g_ipifs %p", kaddr);
14733448Sdh155122 return (WALK_ERR);
14743448Sdh155122 }
14753448Sdh155122 if (mdb_vread(&iw.ipifs, sizeof (iw.ipifs), kaddr) == -1) {
14763448Sdh155122 mdb_warn("failed to read 'sctps_g_ipifs'");
14773448Sdh155122 return (NULL);
14783448Sdh155122 }
14793448Sdh155122
14803448Sdh155122 /* Find the first ipif. */
14810Sstevel@tonic-gate for (i = 0; i < SCTP_IPIF_HASH; i++) {
14823448Sdh155122 if (iw.ipifs[i].ipif_count > 0) {
14833448Sdh155122 uaddr = (uintptr_t)&iw.ipifs[i].sctp_ipif_list;
14843448Sdh155122 offset = uaddr - (uintptr_t)&iw.ipifs;
14853448Sdh155122 if (mdb_pwalk("list", wsp->walk_callback,
14864691Skcpoon wsp->walk_cbdata, kaddr+offset) == -1) {
14873448Sdh155122 mdb_warn("couldn't walk 'list' for address %p",
14883448Sdh155122 kaddr);
14893448Sdh155122 return (WALK_ERR);
14903448Sdh155122 }
14910Sstevel@tonic-gate }
14920Sstevel@tonic-gate }
14930Sstevel@tonic-gate return (WALK_DONE);
14940Sstevel@tonic-gate }
14950Sstevel@tonic-gate
14960Sstevel@tonic-gate static int
sctp_stack_ipif_walk_step(mdb_walk_state_t * wsp)14973448Sdh155122 sctp_stack_ipif_walk_step(mdb_walk_state_t *wsp)
14980Sstevel@tonic-gate {
14993448Sdh155122 return (wsp->walk_callback(wsp->walk_addr, wsp->walk_layer,
15004691Skcpoon wsp->walk_cbdata));
15010Sstevel@tonic-gate }
15020Sstevel@tonic-gate
150312869SKacheong.Poon@Sun.COM /*
150412869SKacheong.Poon@Sun.COM * Initialization function for the per CPU SCTP stats counter walker of a given
150512869SKacheong.Poon@Sun.COM * SCTP stack.
150612869SKacheong.Poon@Sun.COM */
150712869SKacheong.Poon@Sun.COM int
sctps_sc_walk_init(mdb_walk_state_t * wsp)150812869SKacheong.Poon@Sun.COM sctps_sc_walk_init(mdb_walk_state_t *wsp)
150912869SKacheong.Poon@Sun.COM {
151012869SKacheong.Poon@Sun.COM sctp_stack_t sctps;
151112869SKacheong.Poon@Sun.COM
151212869SKacheong.Poon@Sun.COM if (wsp->walk_addr == NULL)
151312869SKacheong.Poon@Sun.COM return (WALK_ERR);
151412869SKacheong.Poon@Sun.COM
151512869SKacheong.Poon@Sun.COM if (mdb_vread(&sctps, sizeof (sctps), wsp->walk_addr) == -1) {
151612869SKacheong.Poon@Sun.COM mdb_warn("failed to read sctp_stack_t at %p", wsp->walk_addr);
151712869SKacheong.Poon@Sun.COM return (WALK_ERR);
151812869SKacheong.Poon@Sun.COM }
151912869SKacheong.Poon@Sun.COM if (sctps.sctps_sc_cnt == 0)
152012869SKacheong.Poon@Sun.COM return (WALK_DONE);
152112869SKacheong.Poon@Sun.COM
152212869SKacheong.Poon@Sun.COM /*
152312869SKacheong.Poon@Sun.COM * Store the sctp_stack_t pointer in walk_data. The stepping function
152412869SKacheong.Poon@Sun.COM * used it to calculate if the end of the counter has reached.
152512869SKacheong.Poon@Sun.COM */
152612869SKacheong.Poon@Sun.COM wsp->walk_data = (void *)wsp->walk_addr;
152712869SKacheong.Poon@Sun.COM wsp->walk_addr = (uintptr_t)sctps.sctps_sc;
152812869SKacheong.Poon@Sun.COM return (WALK_NEXT);
152912869SKacheong.Poon@Sun.COM }
153012869SKacheong.Poon@Sun.COM
153112869SKacheong.Poon@Sun.COM /*
153212869SKacheong.Poon@Sun.COM * Stepping function for the per CPU SCTP stats counterwalker.
153312869SKacheong.Poon@Sun.COM */
153412869SKacheong.Poon@Sun.COM int
sctps_sc_walk_step(mdb_walk_state_t * wsp)153512869SKacheong.Poon@Sun.COM sctps_sc_walk_step(mdb_walk_state_t *wsp)
153612869SKacheong.Poon@Sun.COM {
153712869SKacheong.Poon@Sun.COM int status;
153812869SKacheong.Poon@Sun.COM sctp_stack_t sctps;
153912869SKacheong.Poon@Sun.COM sctp_stats_cpu_t *stats;
154012869SKacheong.Poon@Sun.COM char *next, *end;
154112869SKacheong.Poon@Sun.COM
154212869SKacheong.Poon@Sun.COM if (mdb_vread(&sctps, sizeof (sctps), (uintptr_t)wsp->walk_data) ==
154312869SKacheong.Poon@Sun.COM -1) {
154412869SKacheong.Poon@Sun.COM mdb_warn("failed to read sctp_stack_t at %p", wsp->walk_addr);
154512869SKacheong.Poon@Sun.COM return (WALK_ERR);
154612869SKacheong.Poon@Sun.COM }
154712869SKacheong.Poon@Sun.COM if (mdb_vread(&stats, sizeof (stats), wsp->walk_addr) == -1) {
154812869SKacheong.Poon@Sun.COM mdb_warn("failed ot read sctp_stats_cpu_t at %p",
154912869SKacheong.Poon@Sun.COM wsp->walk_addr);
155012869SKacheong.Poon@Sun.COM return (WALK_ERR);
155112869SKacheong.Poon@Sun.COM }
155212869SKacheong.Poon@Sun.COM status = wsp->walk_callback((uintptr_t)stats, &stats, wsp->walk_cbdata);
155312869SKacheong.Poon@Sun.COM if (status != WALK_NEXT)
155412869SKacheong.Poon@Sun.COM return (status);
155512869SKacheong.Poon@Sun.COM
155612869SKacheong.Poon@Sun.COM next = (char *)wsp->walk_addr + sizeof (sctp_stats_cpu_t *);
155712869SKacheong.Poon@Sun.COM end = (char *)sctps.sctps_sc + sctps.sctps_sc_cnt *
155812869SKacheong.Poon@Sun.COM sizeof (sctp_stats_cpu_t *);
155912869SKacheong.Poon@Sun.COM if (next >= end)
156012869SKacheong.Poon@Sun.COM return (WALK_DONE);
156112869SKacheong.Poon@Sun.COM wsp->walk_addr = (uintptr_t)next;
156212869SKacheong.Poon@Sun.COM return (WALK_NEXT);
156312869SKacheong.Poon@Sun.COM }
156412869SKacheong.Poon@Sun.COM
15650Sstevel@tonic-gate static void
sctp_help(void)15660Sstevel@tonic-gate sctp_help(void)
15670Sstevel@tonic-gate {
15680Sstevel@tonic-gate mdb_printf("Print information for a given SCTP sctp_t\n\n");
15690Sstevel@tonic-gate mdb_printf("Options:\n");
15700Sstevel@tonic-gate mdb_printf("\t-a\t All the information\n");
15710Sstevel@tonic-gate mdb_printf("\t-f\t Flags\n");
15720Sstevel@tonic-gate mdb_printf("\t-h\t Hash Tables\n");
15730Sstevel@tonic-gate mdb_printf("\t-o\t Outbound Data\n");
15740Sstevel@tonic-gate mdb_printf("\t-i\t Inbound Data\n");
15750Sstevel@tonic-gate mdb_printf("\t-m\t Miscellaneous Information\n");
15760Sstevel@tonic-gate mdb_printf("\t-r\t RTT Tracking\n");
15770Sstevel@tonic-gate mdb_printf("\t-S\t Stats Counters\n");
15780Sstevel@tonic-gate mdb_printf("\t-F\t Flow Control\n");
15790Sstevel@tonic-gate mdb_printf("\t-H\t Composite Headers\n");
15800Sstevel@tonic-gate mdb_printf("\t-p\t PMTUD\n");
15810Sstevel@tonic-gate mdb_printf("\t-R\t Retransmit Information\n");
15820Sstevel@tonic-gate mdb_printf("\t-C\t Connection State\n");
15830Sstevel@tonic-gate mdb_printf("\t-c\t Cleanup / Close\n");
15840Sstevel@tonic-gate mdb_printf("\t-e\t Extensions and Reliable Control Chunks\n");
15850Sstevel@tonic-gate mdb_printf("\t-d\t Local and Peer addresses\n");
15860Sstevel@tonic-gate mdb_printf("\t-P\t Peer addresses\n");
15870Sstevel@tonic-gate }
158812869SKacheong.Poon@Sun.COM
15890Sstevel@tonic-gate static const mdb_dcmd_t dcmds[] = {
15900Sstevel@tonic-gate { "sctp", ":[-afhoimrSFHpRCcedP]",
15910Sstevel@tonic-gate "display sctp control structure", sctp, sctp_help },
15920Sstevel@tonic-gate { "sctp_set", ":", "display a SCTP set", sctp_set },
15930Sstevel@tonic-gate { "sctp_faddr", ":", "display a faddr", sctp_faddr },
15940Sstevel@tonic-gate { "sctp_istr_msgs", ":", "display msg list on an instream",
15950Sstevel@tonic-gate sctp_istr_msgs },
15960Sstevel@tonic-gate { "sctp_mdata_chunk", ":", "display a data chunk in an mblk",
15970Sstevel@tonic-gate sctp_mdata_chunk },
15980Sstevel@tonic-gate { "sctp_xmit_list", ":", "display sctp xmit lists", sctp_xmit_list },
15990Sstevel@tonic-gate { "sctp_instr", ":", "display instr", sctp_instr },
16000Sstevel@tonic-gate { "sctp_reass_list", ":", "display reass list", sctp_reass_list },
16010Sstevel@tonic-gate { "sctp_uo_reass_list", ":", "display un-ordered reass list",
16020Sstevel@tonic-gate sctp_uo_reass_list },
16030Sstevel@tonic-gate { NULL }
16040Sstevel@tonic-gate };
16050Sstevel@tonic-gate
16060Sstevel@tonic-gate static const fanout_init_t listen_fanout_init = {
16073448Sdh155122 "sctp_stack_listen_fanout", OFFSETOF(sctp_stack_t, sctps_listen_fanout),
16083448Sdh155122 listen_size, listen_next
16090Sstevel@tonic-gate };
16100Sstevel@tonic-gate
16110Sstevel@tonic-gate static const fanout_init_t conn_fanout_init = {
16123448Sdh155122 "sctp_stack_conn_fanout", OFFSETOF(sctp_stack_t, sctps_conn_fanout),
16133448Sdh155122 conn_size, conn_next
16140Sstevel@tonic-gate };
16150Sstevel@tonic-gate
16160Sstevel@tonic-gate static const fanout_init_t bind_fanout_init = {
16173448Sdh155122 "sctp_stack_bind_fanout", OFFSETOF(sctp_stack_t, sctps_bind_fanout),
16183448Sdh155122 bind_size, bind_next
16190Sstevel@tonic-gate };
16200Sstevel@tonic-gate
16210Sstevel@tonic-gate static const mdb_walker_t walkers[] = {
16223448Sdh155122 { "sctps", "walk the full chain of sctps for all stacks",
16233448Sdh155122 sctps_walk_init, sctps_walk_step, NULL },
16243448Sdh155122 { "sctp_listen_fanout", "walk the sctp listen fanout for all stacks",
16253448Sdh155122 fanout_walk_init, fanout_walk_step, NULL,
16260Sstevel@tonic-gate (void *)&listen_fanout_init },
16273448Sdh155122 { "sctp_conn_fanout", "walk the sctp conn fanout for all stacks",
16283448Sdh155122 fanout_walk_init, fanout_walk_step, NULL,
16290Sstevel@tonic-gate (void *)&conn_fanout_init },
16303448Sdh155122 { "sctp_bind_fanout", "walk the sctp bind fanout for all stacks",
16313448Sdh155122 fanout_walk_init, fanout_walk_step, NULL,
16323448Sdh155122 (void *)&bind_fanout_init },
16333448Sdh155122 { "sctp_stack_listen_fanout",
16343448Sdh155122 "walk the sctp listen fanout for one stack",
16353448Sdh155122 fanout_stack_walk_init, fanout_stack_walk_step,
16363448Sdh155122 fanout_stack_walk_fini,
16373448Sdh155122 (void *)&listen_fanout_init },
16383448Sdh155122 { "sctp_stack_conn_fanout", "walk the sctp conn fanout for one stack",
16393448Sdh155122 fanout_stack_walk_init, fanout_stack_walk_step,
16403448Sdh155122 fanout_stack_walk_fini,
16413448Sdh155122 (void *)&conn_fanout_init },
16423448Sdh155122 { "sctp_stack_bind_fanout", "walk the sctp bind fanoutfor one stack",
16433448Sdh155122 fanout_stack_walk_init, fanout_stack_walk_step,
16443448Sdh155122 fanout_stack_walk_fini,
16450Sstevel@tonic-gate (void *)&bind_fanout_init },
16460Sstevel@tonic-gate { "sctp_walk_faddr", "walk the peer address list of a given sctp_t",
16470Sstevel@tonic-gate sctp_walk_faddr_init, sctp_walk_faddr_step, NULL },
16480Sstevel@tonic-gate { "sctp_walk_saddr", "walk the local address list of a given sctp_t",
16490Sstevel@tonic-gate sctp_walk_saddr_init, sctp_walk_saddr_step, sctp_walk_saddr_fini },
16503448Sdh155122 { "sctp_walk_ill", "walk the sctp_g_ills list for all stacks",
16513448Sdh155122 sctp_ill_walk_init, sctp_ill_walk_step, NULL },
16523448Sdh155122 { "sctp_walk_ipif", "walk the sctp_g_ipif list for all stacks",
16533448Sdh155122 sctp_ipif_walk_init, sctp_ipif_walk_step, NULL },
16543448Sdh155122 { "sctp_stack_walk_ill", "walk the sctp_g_ills list for one stack",
16553448Sdh155122 sctp_stack_ill_walk_init, sctp_stack_ill_walk_step, NULL },
16563448Sdh155122 { "sctp_stack_walk_ipif", "walk the sctp_g_ipif list for one stack",
16573448Sdh155122 sctp_stack_ipif_walk_init, sctp_stack_ipif_walk_step, NULL },
165812869SKacheong.Poon@Sun.COM { "sctps_sc", "walk all the per CPU stats counters of a sctp_stack_t",
165912869SKacheong.Poon@Sun.COM sctps_sc_walk_init, sctps_sc_walk_step, NULL },
16600Sstevel@tonic-gate { NULL }
16610Sstevel@tonic-gate };
16620Sstevel@tonic-gate
16630Sstevel@tonic-gate static const mdb_modinfo_t modinfo = { MDB_API_VERSION, dcmds, walkers };
16640Sstevel@tonic-gate
16650Sstevel@tonic-gate const mdb_modinfo_t *
_mdb_init(void)16660Sstevel@tonic-gate _mdb_init(void)
16670Sstevel@tonic-gate {
16680Sstevel@tonic-gate return (&modinfo);
16690Sstevel@tonic-gate }
1670