summaryrefslogtreecommitdiff
path: root/usr/src/cmd/mdb
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src/cmd/mdb')
-rw-r--r--usr/src/cmd/mdb/common/modules/arp/arp.c665
-rw-r--r--usr/src/cmd/mdb/common/modules/genunix/genunix.c4
-rw-r--r--usr/src/cmd/mdb/common/modules/genunix/net.c195
-rw-r--r--usr/src/cmd/mdb/common/modules/genunix/net.h3
-rw-r--r--usr/src/cmd/mdb/common/modules/genunix/streams.c1
-rw-r--r--usr/src/cmd/mdb/common/modules/genunix/vfs.c44
-rw-r--r--usr/src/cmd/mdb/common/modules/ip/ip.c735
-rw-r--r--usr/src/cmd/mdb/common/modules/sctp/sctp.c212
8 files changed, 758 insertions, 1101 deletions
diff --git a/usr/src/cmd/mdb/common/modules/arp/arp.c b/usr/src/cmd/mdb/common/modules/arp/arp.c
index f36a81170e..f97cdaab42 100644
--- a/usr/src/cmd/mdb/common/modules/arp/arp.c
+++ b/usr/src/cmd/mdb/common/modules/arp/arp.c
@@ -19,12 +19,10 @@
* CDDL HEADER END
*/
/*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <stdio.h>
#include <sys/types.h>
#include <sys/stropts.h>
@@ -36,7 +34,6 @@
#include <inet/common.h>
#include <inet/mi.h>
#include <inet/arp.h>
-#include <inet/arp_impl.h>
#include <inet/ip.h>
#include <netinet/arp.h>
@@ -50,541 +47,10 @@ typedef struct {
} arp_cmd_tbl;
/*
- * Table of ARP commands and structure types used for messages between ARP and
- * IP.
- */
-static const arp_cmd_tbl act_list[] = {
- { AR_ENTRY_ADD, "AR_ENTRY_ADD", "arp`area_t" },
- { AR_ENTRY_DELETE, "AR_ENTRY_DELETE", "arp`ared_t" },
- { AR_ENTRY_QUERY, "AR_ENTRY_QUERY", "arp`areq_t" },
- { AR_ENTRY_SQUERY, "AR_ENTRY_SQUERY", "arp`area_t" },
- { AR_MAPPING_ADD, "AR_MAPPING_ADD", "arp`arma_t" },
- { AR_CLIENT_NOTIFY, "AR_CLIENT_NOTIFY", "arp`arcn_t" },
- { AR_INTERFACE_UP, "AR_INTERFACE_UP", "arp`arc_t" },
- { AR_INTERFACE_DOWN, "AR_INTERFACE_DOWN", "arp`arc_t" },
- { AR_INTERFACE_ON, "AR_INTERFACE_ON", "arp`arc_t" },
- { AR_INTERFACE_OFF, "AR_INTERFACE_OFF", "arp`arc_t" },
- { AR_DLPIOP_DONE, "AR_DLPIOP_DONE", "arp`arc_t" },
- { AR_ARP_CLOSING, "AR_ARP_CLOSING", "arp`arc_t" },
- { AR_ARP_EXTEND, "AR_ARP_EXTEND", "arp`arc_t" },
- { 0, "unknown command", "arp`arc_t" }
-};
-
-/*
- * State information kept during walk over ACE hash table and unhashed mask
- * list.
- */
-typedef struct ace_walk_data {
- ace_t *awd_hash_tbl[ARP_HASH_SIZE];
- ace_t *awd_masks;
- int awd_idx;
-} ace_walk_data_t;
-
-/*
- * Given the kernel address of an arl_t, return the stackid
+ * removed all the ace/arl related stuff. The only thing that remains
+ * is code for dealing with ioctls and printing out arp header that
+ * should probably be moved into the ip/mdb module.
*/
-static int
-arl_to_stackid(uintptr_t addr)
-{
- arl_t arl;
- queue_t rq;
- ar_t ar;
- arp_stack_t ass;
- netstack_t nss;
-
- if (mdb_vread(&arl, sizeof (arl), addr) == -1) {
- mdb_warn("failed to read arl_t %p", addr);
- return (0);
- }
-
- addr = (uintptr_t)arl.arl_rq;
- if (mdb_vread(&rq, sizeof (rq), addr) == -1) {
- mdb_warn("failed to read queue_t %p", addr);
- return (0);
- }
-
- addr = (uintptr_t)rq.q_ptr;
- if (mdb_vread(&ar, sizeof (ar), addr) == -1) {
- mdb_warn("failed to read ar_t %p", addr);
- return (0);
- }
-
- addr = (uintptr_t)ar.ar_as;
- if (mdb_vread(&ass, sizeof (ass), addr) == -1) {
- mdb_warn("failed to read arp_stack_t %p", addr);
- return (0);
- }
- addr = (uintptr_t)ass.as_netstack;
- if (mdb_vread(&nss, sizeof (nss), addr) == -1) {
- mdb_warn("failed to read netstack_t %p", addr);
- return (0);
- }
- return (nss.netstack_stackid);
-}
-
-static int
-arp_stacks_walk_init(mdb_walk_state_t *wsp)
-{
- if (mdb_layered_walk("netstack", wsp) == -1) {
- mdb_warn("can't walk 'netstack'");
- return (WALK_ERR);
- }
- return (WALK_NEXT);
-}
-
-static int
-arp_stacks_walk_step(mdb_walk_state_t *wsp)
-{
- uintptr_t addr;
- netstack_t nss;
-
- if (mdb_vread(&nss, sizeof (nss), wsp->walk_addr) == -1) {
- mdb_warn("can't read netstack at %p", wsp->walk_addr);
- return (WALK_ERR);
- }
- addr = (uintptr_t)nss.netstack_modules[NS_ARP];
-
- return (wsp->walk_callback(addr, wsp->walk_layer, wsp->walk_cbdata));
-}
-
-static int
-arl_stack_walk_init(mdb_walk_state_t *wsp)
-{
- uintptr_t addr;
-
- if (wsp->walk_addr == NULL) {
- mdb_warn("arl_stack supports only local walks\n");
- return (WALK_ERR);
- }
-
- addr = wsp->walk_addr + OFFSETOF(arp_stack_t, as_arl_head);
- if (mdb_vread(&wsp->walk_addr, sizeof (wsp->walk_addr),
- addr) == -1) {
- mdb_warn("failed to read 'arl_g_head'");
- return (WALK_ERR);
- }
- return (WALK_NEXT);
-}
-
-static int
-arl_stack_walk_step(mdb_walk_state_t *wsp)
-{
- uintptr_t addr = wsp->walk_addr;
- arl_t arl;
-
- if (wsp->walk_addr == NULL)
- return (WALK_DONE);
-
- if (mdb_vread(&arl, sizeof (arl), addr) == -1) {
- mdb_warn("failed to read arl_t at %p", addr);
- return (WALK_ERR);
- }
-
- wsp->walk_addr = (uintptr_t)arl.arl_next;
-
- return ((*wsp->walk_callback)(addr, &arl, wsp->walk_cbdata));
-}
-
-static int
-arl_walk_init(mdb_walk_state_t *wsp)
-{
- if (mdb_layered_walk("arp_stacks", wsp) == -1) {
- mdb_warn("can't walk 'arp_stacks'");
- return (WALK_ERR);
- }
-
- return (WALK_NEXT);
-}
-
-static int
-arl_walk_step(mdb_walk_state_t *wsp)
-{
- if (mdb_pwalk("arl_stack", wsp->walk_callback,
- wsp->walk_cbdata, wsp->walk_addr) == -1) {
- mdb_warn("couldn't walk 'arl_stack' at %p", wsp->walk_addr);
- return (WALK_ERR);
- }
- return (WALK_NEXT);
-}
-
-/*
- * Called with walk_addr being the address of arp_stack_t
- */
-static int
-ace_stack_walk_init(mdb_walk_state_t *wsp)
-{
- ace_walk_data_t *aw;
- uintptr_t addr;
-
- if (wsp->walk_addr == NULL) {
- mdb_warn("ace_stack supports only local walks\n");
- return (WALK_ERR);
- }
-
- aw = mdb_alloc(sizeof (ace_walk_data_t), UM_SLEEP);
-
- addr = wsp->walk_addr + OFFSETOF(arp_stack_t, as_ce_hash_tbl);
- if (mdb_vread(aw->awd_hash_tbl, sizeof (aw->awd_hash_tbl),
- addr) == -1) {
- mdb_warn("failed to read 'as_ce_hash_tbl'");
- mdb_free(aw, sizeof (ace_walk_data_t));
- return (WALK_ERR);
- }
-
- addr = wsp->walk_addr + OFFSETOF(arp_stack_t, as_ce_mask_entries);
- if (mdb_vread(&aw->awd_masks, sizeof (aw->awd_masks),
- addr) == -1) {
- mdb_warn("failed to read 'as_ce_mask_entries'");
- mdb_free(aw, sizeof (ace_walk_data_t));
- return (WALK_ERR);
- }
-
- /* The step routine will start off by incrementing to index 0 */
- aw->awd_idx = -1;
- wsp->walk_addr = 0;
- wsp->walk_data = aw;
-
- return (WALK_NEXT);
-}
-
-static int
-ace_stack_walk_step(mdb_walk_state_t *wsp)
-{
- uintptr_t addr;
- ace_walk_data_t *aw = wsp->walk_data;
- ace_t ace;
-
- /*
- * If we're at the end of the previous list, then find the start of the
- * next list to process.
- */
- while (wsp->walk_addr == NULL) {
- if (aw->awd_idx == ARP_HASH_SIZE)
- return (WALK_DONE);
- if (++aw->awd_idx == ARP_HASH_SIZE) {
- wsp->walk_addr = (uintptr_t)aw->awd_masks;
- } else {
- wsp->walk_addr =
- (uintptr_t)aw->awd_hash_tbl[aw->awd_idx];
- }
- }
-
- addr = wsp->walk_addr;
- if (mdb_vread(&ace, sizeof (ace), addr) == -1) {
- mdb_warn("failed to read ace_t at %p", addr);
- return (WALK_ERR);
- }
-
- wsp->walk_addr = (uintptr_t)ace.ace_next;
-
- return (wsp->walk_callback(addr, &ace, wsp->walk_cbdata));
-}
-
-static void
-ace_stack_walk_fini(mdb_walk_state_t *wsp)
-{
- mdb_free(wsp->walk_data, sizeof (ace_walk_data_t));
-}
-
-static int
-ace_walk_init(mdb_walk_state_t *wsp)
-{
- if (mdb_layered_walk("arp_stacks", wsp) == -1) {
- mdb_warn("can't walk 'arp_stacks'");
- return (WALK_ERR);
- }
-
- return (WALK_NEXT);
-}
-
-static int
-ace_walk_step(mdb_walk_state_t *wsp)
-{
- if (mdb_pwalk("ace_stack", wsp->walk_callback,
- wsp->walk_cbdata, wsp->walk_addr) == -1) {
- mdb_warn("couldn't walk 'ace_stack' at %p", wsp->walk_addr);
- return (WALK_ERR);
- }
- return (WALK_NEXT);
-}
-
-
-/* Common routine to produce an 'ar' text description */
-static void
-ar_describe(const ar_t *ar, char *buf, size_t nbytes, boolean_t addmac)
-{
- if (ar->ar_arl == NULL) {
- queue_t wq, ipq;
- ill_t ill;
- char name[LIFNAMSIZ];
- GElf_Sym sym;
- boolean_t nextip;
-
- if (mdb_vread(&wq, sizeof (wq), (uintptr_t)ar->ar_wq) == -1 ||
- mdb_vread(&ipq, sizeof (ipq), (uintptr_t)wq.q_next) == -1)
- return;
-
- nextip =
- (mdb_lookup_by_obj("ip", "ipwinit", &sym) == 0 &&
- (uintptr_t)sym.st_value == (uintptr_t)ipq.q_qinfo);
-
- if (!ar->ar_on_ill_stream) {
- (void) strcpy(buf, nextip ? "Client" : "Unknown");
- return;
- }
-
- if (!nextip ||
- mdb_vread(&ill, sizeof (ill), (uintptr_t)ipq.q_ptr) == -1 ||
- mdb_readstr(name, sizeof (name),
- (uintptr_t)ill.ill_name) == -1) {
- return;
- }
- (void) mdb_snprintf(buf, nbytes, "IP %s", name);
- } else {
- arl_t arl;
- arlphy_t ap;
- ssize_t retv;
- uint32_t alen;
- uchar_t macaddr[ARP_MAX_ADDR_LEN];
-
- if (mdb_vread(&arl, sizeof (arl), (uintptr_t)ar->ar_arl) == -1)
- return;
- retv = mdb_snprintf(buf, nbytes, "ARP %s ", arl.arl_name);
- if (retv >= nbytes || !addmac)
- return;
- if (mdb_vread(&ap, sizeof (ap), (uintptr_t)arl.arl_phy) == -1)
- return;
- alen = ap.ap_hw_addrlen;
- if (ap.ap_hw_addr == NULL || alen == 0 ||
- alen > sizeof (macaddr))
- return;
- if (mdb_vread(macaddr, alen, (uintptr_t)ap.ap_hw_addr) == -1)
- return;
- mdb_mac_addr(macaddr, alen, buf + retv, nbytes - retv);
- }
-}
-
-/* ARGSUSED2 */
-static int
-ar_cb(uintptr_t addr, const void *arptr, void *dummy)
-{
- const ar_t *ar = arptr;
- char ardesc[sizeof ("ARP ") + LIFNAMSIZ];
-
- ar_describe(ar, ardesc, sizeof (ardesc), B_FALSE);
- mdb_printf("%?p %?p %?p %s\n", addr, ar->ar_wq, ar->ar_arl, ardesc);
- return (WALK_NEXT);
-}
-
-/*
- * Print out ARP client structures.
- */
-/* ARGSUSED2 */
-static int
-ar_cmd(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
-{
- ar_t ar;
-
- if (DCMD_HDRSPEC(flags) && !(flags & DCMD_PIPE_OUT)) {
- mdb_printf("%<u>%?s %?s %?s %s%</u>\n",
- "AR", "WQ", "ARL", "TYPE");
- }
-
- if (flags & DCMD_ADDRSPEC) {
- if (mdb_vread(&ar, sizeof (ar), addr) == -1) {
- mdb_warn("failed to read ar_t at %p", addr);
- return (DCMD_ERR);
- }
- (void) ar_cb(addr, &ar, NULL);
- } else {
- if (mdb_walk("ar", ar_cb, NULL) == -1) {
- mdb_warn("cannot walk ar_t structures");
- return (DCMD_ERR);
- }
- }
- return (DCMD_OK);
-}
-
-/* ARGSUSED2 */
-static int
-arl_cb(uintptr_t addr, const void *arlptr, void *dummy)
-{
- const arl_t *arl = arlptr;
- arlphy_t ap;
- uchar_t macaddr[ARP_MAX_ADDR_LEN];
- char macstr[ARP_MAX_ADDR_LEN*3];
- char flags[4];
- const char *primstr;
-
- mdb_printf("%?p ", addr);
- if (arl->arl_dlpi_pending == DL_PRIM_INVAL)
- mdb_printf("%16s", "--");
- else if ((primstr = mdb_dlpi_prim(arl->arl_dlpi_pending)) != NULL)
- mdb_printf("%16s", primstr);
- else
- mdb_printf("%16x", arl->arl_dlpi_pending);
-
- if (mdb_vread(&ap, sizeof (ap), (uintptr_t)arl->arl_phy) == -1 ||
- ap.ap_hw_addrlen == 0 || ap.ap_hw_addrlen > sizeof (macaddr)) {
- (void) strcpy(macstr, "--");
- } else if (mdb_vread(macaddr, ap.ap_hw_addrlen,
- (uintptr_t)ap.ap_hw_addr) == -1) {
- (void) strcpy(macstr, "?");
- } else {
- mdb_mac_addr(macaddr, ap.ap_hw_addrlen, macstr,
- sizeof (macstr));
- }
-
- /* Print both the link-layer state and the NOARP flag */
- flags[0] = '\0';
- if (arl->arl_flags & ARL_F_NOARP)
- (void) strcat(flags, "N");
- switch (arl->arl_state) {
- case ARL_S_DOWN:
- (void) strcat(flags, "d");
- break;
- case ARL_S_PENDING:
- (void) strcat(flags, "P");
- break;
- case ARL_S_UP:
- (void) strcat(flags, "U");
- break;
- default:
- (void) strcat(flags, "?");
- break;
- }
- mdb_printf(" %8d %-3s %-9s %-17s %5d\n",
- mdb_mblk_count(arl->arl_dlpi_deferred), flags, arl->arl_name,
- macstr, arl_to_stackid((uintptr_t)addr));
- return (WALK_NEXT);
-}
-
-/*
- * Print out ARP link-layer elements.
- */
-/* ARGSUSED2 */
-static int
-arl_cmd(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
-{
- arl_t arl;
-
- if (DCMD_HDRSPEC(flags) && !(flags & DCMD_PIPE_OUT)) {
- mdb_printf("%<u>%?s %16s %8s %3s %9s %-17s %5s%</u>\n",
- "ARL", "DLPI REQ", "DLPI CNT", "FLG", "INTERFACE",
- "HWADDR", "STACK");
- }
-
- if (flags & DCMD_ADDRSPEC) {
- if (mdb_vread(&arl, sizeof (arl), addr) == -1) {
- mdb_warn("failed to read arl_t at %p", addr);
- return (DCMD_ERR);
- }
- (void) arl_cb(addr, &arl, NULL);
- } else {
- if (mdb_walk("arl", arl_cb, NULL) == -1) {
- mdb_warn("cannot walk arl_t structures");
- return (DCMD_ERR);
- }
- }
- return (DCMD_OK);
-}
-
-/* ARGSUSED2 */
-static int
-ace_cb(uintptr_t addr, const void *aceptr, void *dummy)
-{
- const ace_t *ace = aceptr;
- uchar_t macaddr[ARP_MAX_ADDR_LEN];
- char macstr[ARP_MAX_ADDR_LEN*3];
- /* The %b format isn't compact enough for long listings */
- static const char ace_flags[] = "SPDRMLdA ofya";
- const char *cp;
- char flags[sizeof (ace_flags)], *fp;
- int flg;
- in_addr_t inaddr, mask;
- char addrstr[sizeof ("255.255.255.255/32")];
-
- /* Walk the list of flags and produce a string */
- cp = ace_flags;
- fp = flags;
- for (flg = 1; *cp != '\0'; flg <<= 1, cp++) {
- if ((flg & ace->ace_flags) && *cp != ' ')
- *fp++ = *cp;
- }
- *fp = '\0';
-
- /* If it's not resolved, then it has no hardware address */
- if (!(ace->ace_flags & ACE_F_RESOLVED) ||
- ace->ace_hw_addr_length == 0 ||
- ace->ace_hw_addr_length > sizeof (macaddr)) {
- (void) strcpy(macstr, "--");
- } else if (mdb_vread(macaddr, ace->ace_hw_addr_length,
- (uintptr_t)ace->ace_hw_addr) == -1) {
- (void) strcpy(macstr, "?");
- } else {
- mdb_mac_addr(macaddr, ace->ace_hw_addr_length, macstr,
- sizeof (macstr));
- }
-
- /*
- * Nothing other than IP uses ARP these days, so we don't try very hard
- * here to switch out on ARP protocol type. (Note that ARP protocol
- * types are roughly Ethertypes, but are allocated separately at IANA.)
- */
- if (ace->ace_proto != IP_ARP_PROTO_TYPE) {
- (void) mdb_snprintf(addrstr, sizeof (addrstr),
- "Unknown proto %x", ace->ace_proto);
- } else if (mdb_vread(&inaddr, sizeof (inaddr),
- (uintptr_t)ace->ace_proto_addr) != -1 &&
- mdb_vread(&mask, sizeof (mask), (uintptr_t)ace->ace_proto_mask) !=
- -1) {
- /*
- * If it's the standard host mask, then print it normally.
- * Otherwise, use "/n" notation.
- */
- if (mask == (in_addr_t)~0) {
- (void) mdb_snprintf(addrstr, sizeof (addrstr), "%I",
- inaddr);
- } else {
- (void) mdb_snprintf(addrstr, sizeof (addrstr), "%I/%d",
- inaddr, mask == 0 ? 0 : 33 - mdb_ffs(mask));
- }
- } else {
- (void) strcpy(addrstr, "?");
- }
- mdb_printf("%?p %-18s %-8s %-17s %5d\n", addr, addrstr, flags,
- macstr, arl_to_stackid((uintptr_t)ace->ace_arl));
- return (WALK_NEXT);
-}
-
-/*
- * Print out ARP cache entry (ace_t) elements.
- */
-/* ARGSUSED2 */
-static int
-ace_cmd(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
-{
- ace_t ace;
-
- if (DCMD_HDRSPEC(flags) && !(flags & DCMD_PIPE_OUT)) {
- mdb_printf("%<u>%?s %-18s %-8s %-17s %5s%</u>\n",
- "ACE", "PROTOADDR", "FLAGS", "HWADDR", "STACK");
- }
-
- if (flags & DCMD_ADDRSPEC) {
- if (mdb_vread(&ace, sizeof (ace), addr) == -1) {
- mdb_warn("failed to read ace_t at %p", addr);
- return (DCMD_ERR);
- }
- (void) ace_cb(addr, &ace, NULL);
- } else {
- if (mdb_walk("ace", ace_cb, NULL) == -1) {
- mdb_warn("cannot walk ace_t structures");
- return (DCMD_ERR);
- }
- }
- return (DCMD_OK);
-}
/*
* Print an ARP hardware and protocol address pair; used when printing an ARP
@@ -696,148 +162,25 @@ arphdr_cmd(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
return (DCMD_OK);
}
-/*
- * Print out an arp command formatted in a reasonable manner. This implements
- * the type switch used by ARP.
- *
- * It could also dump the data that follows the header (using offset and length
- * in the various structures), but it currently does not.
- */
-/* ARGSUSED2 */
-static int
-arpcmd_cmd(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
-{
- arc_t arc;
- const arp_cmd_tbl *tp;
- mdb_arg_t subargv;
-
- if (!(flags & DCMD_ADDRSPEC)) {
- mdb_warn("address required to print ARP command\n");
- return (DCMD_ERR);
- }
- if (mdb_vread(&arc, sizeof (arc), addr) == -1) {
- mdb_warn("unable to read arc_t at %p", addr);
- return (DCMD_ERR);
- }
- for (tp = act_list; tp->act_cmd != 0; tp++)
- if (tp->act_cmd == arc.arc_cmd)
- break;
- mdb_printf("%p %s (%s) = ", addr, tp->act_name, tp->act_type);
- subargv.a_type = MDB_TYPE_STRING;
- subargv.a_un.a_str = tp->act_type;
- if (mdb_call_dcmd("print", addr, DCMD_ADDRSPEC, 1, &subargv) == -1)
- return (DCMD_ERR);
- else
- return (DCMD_OK);
-}
-
-static size_t
-mi_osize(const queue_t *q)
-{
- /*
- * The code in common/inet/mi.c allocates an extra word to store the
- * size of the allocation. An mi_o_s is thus a size_t plus an mi_o_s.
- */
- struct mi_block {
- size_t mi_nbytes;
- struct mi_o_s mi_o;
- } m;
-
- if (mdb_vread(&m, sizeof (m), (uintptr_t)q->q_ptr - sizeof (m)) != -1)
- return (m.mi_nbytes - sizeof (m));
-
- return (0);
-}
-
-/*
- * This is called when ::stream is used and an ARP module is seen on the
- * stream. Determine what sort of ARP usage is involved and show an
- * appropriate message.
- */
-static void
-arp_qinfo(const queue_t *qp, char *buf, size_t nbytes)
-{
- size_t size = mi_osize(qp);
- ar_t ar;
-
- if (size != sizeof (ar_t))
- return;
- if (mdb_vread(&ar, sizeof (ar), (uintptr_t)qp->q_ptr) == -1)
- return;
- ar_describe(&ar, buf, nbytes, B_TRUE);
-}
-
-static uintptr_t
-arp_rnext(const queue_t *q)
-{
- size_t size = mi_osize(q);
- ar_t ar;
-
- if (size == sizeof (ar_t) && mdb_vread(&ar, sizeof (ar),
- (uintptr_t)q->q_ptr) != -1)
- return ((uintptr_t)ar.ar_rq);
-
- return (NULL);
-}
-
-static uintptr_t
-arp_wnext(const queue_t *q)
-{
- size_t size = mi_osize(q);
- ar_t ar;
-
- if (size == sizeof (ar_t) && mdb_vread(&ar, sizeof (ar),
- (uintptr_t)q->q_ptr) != -1)
- return ((uintptr_t)ar.ar_wq);
-
- return (NULL);
-}
-
static const mdb_dcmd_t dcmds[] = {
- { "ar", "?", "display ARP client streams for all stacks",
- ar_cmd, NULL },
- { "arl", "?", "display ARP link layers for all stacks", arl_cmd, NULL },
- { "ace", "?", "display ARP cache entries for all stacks",
- ace_cmd, NULL },
{ "arphdr", ":", "display an ARP header", arphdr_cmd, NULL },
- { "arpcmd", ":", "display an ARP command", arpcmd_cmd, NULL },
{ NULL }
};
/* Note: ar_t walker is in genunix.c and net.c; generic MI walker */
static const mdb_walker_t walkers[] = {
- { "arl", "walk list of arl_t links for all stacks",
- arl_walk_init, arl_walk_step, NULL },
- { "arl_stack", "walk list of arl_t links",
- arl_stack_walk_init, arl_stack_walk_step, NULL },
- { "ace", "walk list of ace_t entries for all stacks",
- ace_walk_init, ace_walk_step, NULL },
- { "ace_stack", "walk list of ace_t entries",
- ace_stack_walk_init, ace_stack_walk_step, ace_stack_walk_fini },
- { "arp_stacks", "walk all the arp_stack_t",
- arp_stacks_walk_init, arp_stacks_walk_step, NULL },
{ NULL }
};
-static const mdb_qops_t arp_qops = { arp_qinfo, arp_rnext, arp_wnext };
static const mdb_modinfo_t modinfo = { MDB_API_VERSION, dcmds, walkers };
const mdb_modinfo_t *
_mdb_init(void)
{
- GElf_Sym sym;
-
- if (mdb_lookup_by_obj("arp", "winit", &sym) == 0)
- mdb_qops_install(&arp_qops, (uintptr_t)sym.st_value);
-
return (&modinfo);
}
void
_mdb_fini(void)
{
- GElf_Sym sym;
-
- if (mdb_lookup_by_obj("arp", "winit", &sym) == 0)
- mdb_qops_remove(&arp_qops, (uintptr_t)sym.st_value);
}
diff --git a/usr/src/cmd/mdb/common/modules/genunix/genunix.c b/usr/src/cmd/mdb/common/modules/genunix/genunix.c
index 3e49d9a99c..e6fe3f7dcf 100644
--- a/usr/src/cmd/mdb/common/modules/genunix/genunix.c
+++ b/usr/src/cmd/mdb/common/modules/genunix/genunix.c
@@ -4770,8 +4770,6 @@ static const mdb_walker_t walkers[] = {
NULL, modchain_walk_step, NULL },
/* from net.c */
- { "ar", "walk ar_t structures using MI for all stacks",
- mi_payload_walk_init, mi_payload_walk_step, NULL, &mi_ar_arg },
{ "icmp", "walk ICMP control structures using MI for all stacks",
mi_payload_walk_init, mi_payload_walk_step, NULL,
&mi_icmp_arg },
@@ -4779,8 +4777,6 @@ static const mdb_walker_t walkers[] = {
mi_walk_init, mi_walk_step, mi_walk_fini, NULL },
{ "sonode", "given a sonode, walk its children",
sonode_walk_init, sonode_walk_step, sonode_walk_fini, NULL },
- { "ar_stacks", "walk all the ar_stack_t",
- ar_stacks_walk_init, ar_stacks_walk_step, NULL },
{ "icmp_stacks", "walk all the icmp_stack_t",
icmp_stacks_walk_init, icmp_stacks_walk_step, NULL },
{ "tcp_stacks", "walk all the tcp_stack_t",
diff --git a/usr/src/cmd/mdb/common/modules/genunix/net.c b/usr/src/cmd/mdb/common/modules/genunix/net.c
index d9f4717d7e..23d6202fff 100644
--- a/usr/src/cmd/mdb/common/modules/genunix/net.c
+++ b/usr/src/cmd/mdb/common/modules/genunix/net.c
@@ -45,7 +45,6 @@
#include <sys/socketvar.h>
#include <sys/cred_impl.h>
#include <inet/udp_impl.h>
-#include <inet/arp_impl.h>
#include <inet/rawip_impl.h>
#include <inet/mi.h>
#include <fs/sockfs/socktpi_impl.h>
@@ -71,31 +70,6 @@ typedef struct netstat_cb_data_s {
int af;
} netstat_cb_data_t;
-/* Walkers for various *_stack_t */
-int
-ar_stacks_walk_init(mdb_walk_state_t *wsp)
-{
- if (mdb_layered_walk("netstack", wsp) == -1) {
- mdb_warn("can't walk 'netstack'");
- return (WALK_ERR);
- }
- return (WALK_NEXT);
-}
-
-int
-ar_stacks_walk_step(mdb_walk_state_t *wsp)
-{
- uintptr_t kaddr;
- netstack_t nss;
-
- if (mdb_vread(&nss, sizeof (nss), wsp->walk_addr) == -1) {
- mdb_warn("can't read netstack at %p", wsp->walk_addr);
- return (WALK_ERR);
- }
- kaddr = (uintptr_t)nss.netstack_modules[NS_ARP];
- return (wsp->walk_callback(kaddr, wsp->walk_layer, wsp->walk_cbdata));
-}
-
int
icmp_stacks_walk_init(mdb_walk_state_t *wsp)
{
@@ -201,15 +175,15 @@ net_tcp_active(const tcp_t *tcp)
static int
net_tcp_ipv4(const tcp_t *tcp)
{
- return ((tcp->tcp_ipversion == IPV4_VERSION) ||
- (IN6_IS_ADDR_UNSPECIFIED(&tcp->tcp_ip_src_v6) &&
+ return ((tcp->tcp_connp->conn_ipversion == IPV4_VERSION) ||
+ (IN6_IS_ADDR_UNSPECIFIED(&tcp->tcp_connp->conn_laddr_v6) &&
(tcp->tcp_state <= TCPS_LISTEN)));
}
static int
net_tcp_ipv6(const tcp_t *tcp)
{
- return (tcp->tcp_ipversion == IPV6_VERSION);
+ return (tcp->tcp_connp->conn_ipversion == IPV6_VERSION);
}
static int
@@ -222,15 +196,15 @@ net_udp_active(const udp_t *udp)
static int
net_udp_ipv4(const udp_t *udp)
{
- return ((udp->udp_ipversion == IPV4_VERSION) ||
- (IN6_IS_ADDR_UNSPECIFIED(&udp->udp_v6src) &&
+ return ((udp->udp_connp->conn_ipversion == IPV4_VERSION) ||
+ (IN6_IS_ADDR_UNSPECIFIED(&udp->udp_connp->conn_laddr_v6) &&
(udp->udp_state <= TS_IDLE)));
}
static int
net_udp_ipv6(const udp_t *udp)
{
- return (udp->udp_ipversion == IPV6_VERSION);
+ return (udp->udp_connp->conn_ipversion == IPV6_VERSION);
}
int
@@ -399,11 +373,6 @@ mi_payload_walk_step(mdb_walk_state_t *wsp)
return (WALK_NEXT);
}
-const mi_payload_walk_arg_t mi_ar_arg = {
- "ar_stacks", OFFSETOF(arp_stack_t, as_head), sizeof (ar_t),
- MI_PAYLOAD_DEVICE | MI_PAYLOAD_MODULE
-};
-
const mi_payload_walk_arg_t mi_icmp_arg = {
"icmp_stacks", OFFSETOF(icmp_stack_t, is_head), sizeof (icmp_t),
MI_PAYLOAD_DEVICE | MI_PAYLOAD_MODULE
@@ -632,7 +601,7 @@ netstat_tcp_cb(uintptr_t kaddr, const void *walk_data, void *cb_data)
tcp_kaddr = (uintptr_t)connp->conn_tcp;
if (mdb_vread(&tcps, sizeof (tcp_t), tcp_kaddr) == -1) {
- mdb_warn("failed to read tcp_t at %p", kaddr);
+ mdb_warn("failed to read tcp_t at %p", tcp_kaddr);
return (WALK_ERR);
}
@@ -648,13 +617,13 @@ netstat_tcp_cb(uintptr_t kaddr, const void *walk_data, void *cb_data)
mdb_printf("%0?p %2i ", tcp_kaddr, tcp->tcp_state);
if (af == AF_INET) {
- net_ipv4addrport_pr(&tcp->tcp_ip_src_v6, tcp->tcp_lport);
+ net_ipv4addrport_pr(&connp->conn_laddr_v6, connp->conn_lport);
mdb_printf(" ");
- net_ipv4addrport_pr(&tcp->tcp_remote_v6, tcp->tcp_fport);
+ net_ipv4addrport_pr(&connp->conn_faddr_v6, connp->conn_fport);
} else if (af == AF_INET6) {
- net_ipv6addrport_pr(&tcp->tcp_ip_src_v6, tcp->tcp_lport);
+ net_ipv6addrport_pr(&connp->conn_laddr_v6, connp->conn_lport);
mdb_printf(" ");
- net_ipv6addrport_pr(&tcp->tcp_remote_v6, tcp->tcp_fport);
+ net_ipv6addrport_pr(&connp->conn_faddr_v6, connp->conn_fport);
}
mdb_printf(" %5i", ns_to_stackid((uintptr_t)connp->conn_netstack));
mdb_printf(" %4i\n", connp->conn_zoneid);
@@ -687,6 +656,9 @@ netstat_udp_cb(uintptr_t kaddr, const void *walk_data, void *cb_data)
return (WALK_ERR);
}
+ connp->conn_udp = &udp;
+ udp.udp_connp = connp;
+
if (!((opts & NETSTAT_ALL) || net_udp_active(&udp)) ||
(af == AF_INET && !net_udp_ipv4(&udp)) ||
(af == AF_INET6 && !net_udp_ipv6(&udp))) {
@@ -704,13 +676,13 @@ netstat_udp_cb(uintptr_t kaddr, const void *walk_data, void *cb_data)
mdb_printf("%0?p %10s ", (uintptr_t)connp->conn_udp, state);
if (af == AF_INET) {
- net_ipv4addrport_pr(&udp.udp_v6src, udp.udp_port);
+ net_ipv4addrport_pr(&connp->conn_laddr_v6, connp->conn_lport);
mdb_printf(" ");
- net_ipv4addrport_pr(&udp.udp_v6dst, udp.udp_dstport);
+ net_ipv4addrport_pr(&connp->conn_faddr_v6, connp->conn_fport);
} else if (af == AF_INET6) {
- net_ipv6addrport_pr(&udp.udp_v6src, udp.udp_port);
+ net_ipv6addrport_pr(&connp->conn_laddr_v6, connp->conn_lport);
mdb_printf(" ");
- net_ipv6addrport_pr(&udp.udp_v6dst, udp.udp_dstport);
+ net_ipv6addrport_pr(&connp->conn_faddr_v6, connp->conn_fport);
}
mdb_printf(" %5i", ns_to_stackid((uintptr_t)connp->conn_netstack));
mdb_printf(" %4i\n", connp->conn_zoneid);
@@ -740,8 +712,11 @@ netstat_icmp_cb(uintptr_t kaddr, const void *walk_data, void *cb_data)
return (WALK_ERR);
}
- if ((af == AF_INET && icmp.icmp_ipversion != IPV4_VERSION) ||
- (af == AF_INET6 && icmp.icmp_ipversion != IPV6_VERSION)) {
+ connp->conn_icmp = &icmp;
+ icmp.icmp_connp = connp;
+
+ if ((af == AF_INET && connp->conn_ipversion != IPV4_VERSION) ||
+ (af == AF_INET6 && connp->conn_ipversion != IPV6_VERSION)) {
return (WALK_NEXT);
}
@@ -756,16 +731,16 @@ netstat_icmp_cb(uintptr_t kaddr, const void *walk_data, void *cb_data)
mdb_printf("%0?p %10s ", (uintptr_t)connp->conn_icmp, state);
if (af == AF_INET) {
- mdb_printf("%*I ", ADDR_V4_WIDTH,
- V4_PART_OF_V6((icmp.icmp_v6src)));
- mdb_printf("%*I ", ADDR_V4_WIDTH,
- V4_PART_OF_V6((icmp.icmp_v6dst.sin6_addr)));
+ net_ipv4addrport_pr(&connp->conn_laddr_v6, connp->conn_lport);
+ mdb_printf(" ");
+ net_ipv4addrport_pr(&connp->conn_faddr_v6, connp->conn_fport);
} else if (af == AF_INET6) {
- mdb_printf("%*N ", ADDR_V6_WIDTH, &icmp.icmp_v6src);
- mdb_printf("%*N ", ADDR_V6_WIDTH, &icmp.icmp_v6dst);
+ net_ipv6addrport_pr(&connp->conn_laddr_v6, connp->conn_lport);
+ mdb_printf(" ");
+ net_ipv6addrport_pr(&connp->conn_faddr_v6, connp->conn_fport);
}
mdb_printf(" %5i", ns_to_stackid((uintptr_t)connp->conn_netstack));
- mdb_printf(" %4i\n", icmp.icmp_zoneid);
+ mdb_printf(" %4i\n", connp->conn_zoneid);
return (WALK_NEXT);
}
@@ -881,57 +856,57 @@ get_ifname(const ire_t *ire, char *intf)
ill_t ill;
*intf = '\0';
- if (ire->ire_type == IRE_CACHE) {
- queue_t stq;
-
- if (mdb_vread(&stq, sizeof (stq), (uintptr_t)ire->ire_stq) ==
- -1)
- return;
- if (mdb_vread(&ill, sizeof (ill), (uintptr_t)stq.q_ptr) == -1)
+ if (ire->ire_ill != NULL) {
+ if (mdb_vread(&ill, sizeof (ill),
+ (uintptr_t)ire->ire_ill) == -1)
return;
(void) mdb_readstr(intf, MIN(LIFNAMSIZ, ill.ill_name_length),
(uintptr_t)ill.ill_name);
- } else if (ire->ire_ipif != NULL) {
- ipif_t ipif;
- char *cp;
-
- if (mdb_vread(&ipif, sizeof (ipif),
- (uintptr_t)ire->ire_ipif) == -1)
- return;
- if (mdb_vread(&ill, sizeof (ill), (uintptr_t)ipif.ipif_ill) ==
- -1)
- return;
- (void) mdb_readstr(intf, MIN(LIFNAMSIZ, ill.ill_name_length),
- (uintptr_t)ill.ill_name);
- if (ipif.ipif_id != 0) {
- cp = intf + strlen(intf);
- (void) mdb_snprintf(cp, LIFNAMSIZ + 1 - (cp - intf),
- ":%u", ipif.ipif_id);
- }
}
}
+const in6_addr_t ipv6_all_ones =
+ { 0xffffffffU, 0xffffffffU, 0xffffffffU, 0xffffffffU };
+
static void
-get_v4flags(const ire_t *ire, char *flags)
+get_ireflags(const ire_t *ire, char *flags)
{
(void) strcpy(flags, "U");
- if (ire->ire_type == IRE_DEFAULT || ire->ire_type == IRE_PREFIX ||
- ire->ire_type == IRE_HOST || ire->ire_type == IRE_HOST_REDIRECT)
+ /* RTF_INDIRECT wins over RTF_GATEWAY - don't display both */
+ if (ire->ire_flags & RTF_INDIRECT)
+ (void) strcat(flags, "I");
+ else if (ire->ire_type & IRE_OFFLINK)
(void) strcat(flags, "G");
- if (ire->ire_mask == IP_HOST_MASK)
- (void) strcat(flags, "H");
- if (ire->ire_type == IRE_HOST_REDIRECT)
+
+ /* IRE_IF_CLONE wins over RTF_HOST - don't display both */
+ if (ire->ire_type & IRE_IF_CLONE)
+ (void) strcat(flags, "C");
+ else if (ire->ire_ipversion == IPV4_VERSION) {
+ if (ire->ire_mask == IP_HOST_MASK)
+ (void) strcat(flags, "H");
+ } else {
+ if (IN6_ARE_ADDR_EQUAL(&ire->ire_mask_v6, &ipv6_all_ones))
+ (void) strcat(flags, "H");
+ }
+
+ if (ire->ire_flags & RTF_DYNAMIC)
(void) strcat(flags, "D");
- if (ire->ire_type == IRE_CACHE)
- (void) strcat(flags, "A");
if (ire->ire_type == IRE_BROADCAST)
- (void) strcat(flags, "B");
+ (void) strcat(flags, "b");
+ if (ire->ire_type == IRE_MULTICAST)
+ (void) strcat(flags, "m");
if (ire->ire_type == IRE_LOCAL)
(void) strcat(flags, "L");
+ if (ire->ire_type == IRE_NOROUTE)
+ (void) strcat(flags, "N");
if (ire->ire_flags & RTF_MULTIRT)
(void) strcat(flags, "M");
if (ire->ire_flags & RTF_SETSRC)
(void) strcat(flags, "S");
+ if (ire->ire_flags & RTF_REJECT)
+ (void) strcat(flags, "R");
+ if (ire->ire_flags & RTF_BLACKHOLE)
+ (void) strcat(flags, "B");
}
static int
@@ -945,8 +920,10 @@ netstat_irev4_cb(uintptr_t kaddr, const void *walk_data, void *cb_data)
if (ire->ire_ipversion != IPV4_VERSION)
return (WALK_NEXT);
- if (!(*opts & NETSTAT_ALL) && (ire->ire_type == IRE_CACHE ||
- ire->ire_type == IRE_BROADCAST || ire->ire_type == IRE_LOCAL))
+ /* Skip certain IREs by default */
+ if (!(*opts & NETSTAT_ALL) &&
+ (ire->ire_type &
+ (IRE_BROADCAST|IRE_LOCAL|IRE_MULTICAST|IRE_NOROUTE|IRE_IF_CLONE)))
return (WALK_NEXT);
if (*opts & NETSTAT_FIRST) {
@@ -966,10 +943,9 @@ netstat_irev4_cb(uintptr_t kaddr, const void *walk_data, void *cb_data)
}
}
- gate = (ire->ire_type & (IRE_INTERFACE|IRE_LOOPBACK|IRE_BROADCAST)) ?
- ire->ire_src_addr : ire->ire_gateway_addr;
+ gate = ire->ire_gateway_addr;
- get_v4flags(ire, flags);
+ get_ireflags(ire, flags);
get_ifname(ire, intf);
@@ -977,8 +953,8 @@ netstat_irev4_cb(uintptr_t kaddr, const void *walk_data, void *cb_data)
mdb_printf("%?p %-*I %-*I %-*I %-6s %5u%c %4u %3u %-3s %5u "
"%u\n", kaddr, ADDR_V4_WIDTH, ire->ire_addr, ADDR_V4_WIDTH,
ire->ire_mask, ADDR_V4_WIDTH, gate, intf,
- ire->ire_max_frag, ire->ire_frag_flag ? '*' : ' ',
- ire->ire_uinfo.iulp_rtt, ire->ire_refcnt, flags,
+ 0, ' ',
+ ire->ire_metrics.iulp_rtt, ire->ire_refcnt, flags,
ire->ire_ob_pkt_count, ire->ire_ib_pkt_count);
} else {
mdb_printf("%?p %-*I %-*I %-5s %4u %5u %s\n", kaddr,
@@ -1025,7 +1001,10 @@ netstat_irev6_cb(uintptr_t kaddr, const void *walk_data, void *cb_data)
if (ire->ire_ipversion != IPV6_VERSION)
return (WALK_NEXT);
- if (!(*opts & NETSTAT_ALL) && ire->ire_type == IRE_CACHE)
+ /* Skip certain IREs by default */
+ if (!(*opts & NETSTAT_ALL) &&
+ (ire->ire_type &
+ (IRE_BROADCAST|IRE_LOCAL|IRE_MULTICAST|IRE_NOROUTE|IRE_IF_CLONE)))
return (WALK_NEXT);
if (*opts & NETSTAT_FIRST) {
@@ -1045,37 +1024,21 @@ netstat_irev6_cb(uintptr_t kaddr, const void *walk_data, void *cb_data)
}
}
- gatep = (ire->ire_type & (IRE_INTERFACE|IRE_LOOPBACK)) ?
- &ire->ire_src_addr_v6 : &ire->ire_gateway_addr_v6;
+ gatep = &ire->ire_gateway_addr_v6;
masklen = ip_mask_to_plen_v6(&ire->ire_mask_v6);
(void) mdb_snprintf(deststr, sizeof (deststr), "%N/%d",
&ire->ire_addr_v6, masklen);
- (void) strcpy(flags, "U");
- if (ire->ire_type == IRE_DEFAULT || ire->ire_type == IRE_PREFIX ||
- ire->ire_type == IRE_HOST || ire->ire_type == IRE_HOST_REDIRECT)
- (void) strcat(flags, "G");
- if (masklen == IPV6_ABITS)
- (void) strcat(flags, "H");
- if (ire->ire_type == IRE_HOST_REDIRECT)
- (void) strcat(flags, "D");
- if (ire->ire_type == IRE_CACHE)
- (void) strcat(flags, "A");
- if (ire->ire_type == IRE_LOCAL)
- (void) strcat(flags, "L");
- if (ire->ire_flags & RTF_MULTIRT)
- (void) strcat(flags, "M");
- if (ire->ire_flags & RTF_SETSRC)
- (void) strcat(flags, "S");
+ get_ireflags(ire, flags);
get_ifname(ire, intf);
if (*opts & NETSTAT_VERBOSE) {
mdb_printf("%?p %-*s %-*N %-5s %5u%c %5u %3u %-5s %6u %u\n",
kaddr, ADDR_V6_WIDTH+4, deststr, ADDR_V6_WIDTH, gatep,
- intf, ire->ire_max_frag, ire->ire_frag_flag ? '*' : ' ',
- ire->ire_uinfo.iulp_rtt, ire->ire_refcnt,
+ intf, 0, ' ',
+ ire->ire_metrics.iulp_rtt, ire->ire_refcnt,
flags, ire->ire_ob_pkt_count, ire->ire_ib_pkt_count);
} else {
mdb_printf("%?p %-*s %-*N %-5s %3u %6u %s\n", kaddr,
diff --git a/usr/src/cmd/mdb/common/modules/genunix/net.h b/usr/src/cmd/mdb/common/modules/genunix/net.h
index f2d441e78c..f72d75f75a 100644
--- a/usr/src/cmd/mdb/common/modules/genunix/net.h
+++ b/usr/src/cmd/mdb/common/modules/genunix/net.h
@@ -30,7 +30,6 @@
extern "C" {
#endif
-extern struct mi_payload_walk_arg_s mi_ar_arg;
extern struct mi_payload_walk_arg_s mi_icmp_arg;
extern struct mi_payload_walk_arg_s mi_ill_arg;
@@ -42,8 +41,6 @@ extern int mi_walk_step(mdb_walk_state_t *);
extern void mi_walk_fini(mdb_walk_state_t *);
extern int mi_payload_walk_init(mdb_walk_state_t *);
extern int mi_payload_walk_step(mdb_walk_state_t *);
-extern int ar_stacks_walk_init(mdb_walk_state_t *);
-extern int ar_stacks_walk_step(mdb_walk_state_t *);
extern int icmp_stacks_walk_init(mdb_walk_state_t *);
extern int icmp_stacks_walk_step(mdb_walk_state_t *);
extern int tcp_stacks_walk_init(mdb_walk_state_t *);
diff --git a/usr/src/cmd/mdb/common/modules/genunix/streams.c b/usr/src/cmd/mdb/common/modules/genunix/streams.c
index 0458589309..d0095c7752 100644
--- a/usr/src/cmd/mdb/common/modules/genunix/streams.c
+++ b/usr/src/cmd/mdb/common/modules/genunix/streams.c
@@ -172,7 +172,6 @@ static const struct str_flags mbf[] = {
{ SF(0x08), "unused" },
{ SF(MSGMARKNEXT), "Private: b_next's first byte marked" },
{ SF(MSGNOTMARKNEXT), "Private: ... not marked" },
- { SF(MSGHASREF), "Private: msg has reference to owner" },
{ 0, NULL, NULL }
};
diff --git a/usr/src/cmd/mdb/common/modules/genunix/vfs.c b/usr/src/cmd/mdb/common/modules/genunix/vfs.c
index 45dc27af23..8001c41b3c 100644
--- a/usr/src/cmd/mdb/common/modules/genunix/vfs.c
+++ b/usr/src/cmd/mdb/common/modules/genunix/vfs.c
@@ -572,8 +572,9 @@ sctp_getsockaddr(sctp_t *sctp, struct sockaddr *addr)
sin_t *sin4;
int scanned = 0;
boolean_t skip_lback = B_FALSE;
+ conn_t *connp = sctp->sctp_connp;
- addr->sa_family = sctp->sctp_family;
+ addr->sa_family = connp->conn_family;
if (sctp->sctp_nsaddrs == 0)
goto done;
@@ -636,18 +637,18 @@ sctp_getsockaddr(sctp_t *sctp, struct sockaddr *addr)
continue;
}
- switch (sctp->sctp_family) {
+ switch (connp->conn_family) {
case AF_INET:
/* LINTED: alignment */
sin4 = (sin_t *)addr;
if ((sctp->sctp_state <= SCTPS_LISTEN) &&
sctp->sctp_bound_to_all) {
sin4->sin_addr.s_addr = INADDR_ANY;
- sin4->sin_port = sctp->sctp_lport;
+ sin4->sin_port = connp->conn_lport;
} else {
sin4 += added;
sin4->sin_family = AF_INET;
- sin4->sin_port = sctp->sctp_lport;
+ sin4->sin_port = connp->conn_lport;
IN6_V4MAPPED_TO_INADDR(&laddr,
&sin4->sin_addr);
}
@@ -660,15 +661,14 @@ sctp_getsockaddr(sctp_t *sctp, struct sockaddr *addr)
sctp->sctp_bound_to_all) {
bzero(&sin6->sin6_addr,
sizeof (sin6->sin6_addr));
- sin6->sin6_port = sctp->sctp_lport;
+ sin6->sin6_port = connp->conn_lport;
} else {
sin6 += added;
sin6->sin6_family = AF_INET6;
- sin6->sin6_port = sctp->sctp_lport;
+ sin6->sin6_port = connp->conn_lport;
sin6->sin6_addr = laddr;
}
- sin6->sin6_flowinfo = sctp->sctp_ip6h->ip6_vcf &
- ~IPV6_VERS_AND_FLOW_MASK;
+ sin6->sin6_flowinfo = connp->conn_flowinfo;
sin6->sin6_scope_id = 0;
sin6->__sin6_src_id = 0;
break;
@@ -712,11 +712,12 @@ sctp_getpeeraddr(sctp_t *sctp, struct sockaddr *addr)
struct sockaddr_in6 *sin6;
sctp_faddr_t sctp_primary;
in6_addr_t faddr;
+ conn_t *connp = sctp->sctp_connp;
if (sctp->sctp_faddrs == NULL)
return (-1);
- addr->sa_family = sctp->sctp_family;
+ addr->sa_family = connp->conn_family;
if (mdb_vread(&sctp_primary, sizeof (sctp_faddr_t),
(uintptr_t)sctp->sctp_primary) == -1) {
mdb_warn("failed to read sctp primary faddr");
@@ -724,12 +725,12 @@ sctp_getpeeraddr(sctp_t *sctp, struct sockaddr *addr)
}
faddr = sctp_primary.faddr;
- switch (sctp->sctp_family) {
+ switch (connp->conn_family) {
case AF_INET:
/* LINTED: alignment */
sin4 = (struct sockaddr_in *)addr;
IN6_V4MAPPED_TO_INADDR(&faddr, &sin4->sin_addr);
- sin4->sin_port = sctp->sctp_fport;
+ sin4->sin_port = connp->conn_fport;
sin4->sin_family = AF_INET;
break;
@@ -737,7 +738,7 @@ sctp_getpeeraddr(sctp_t *sctp, struct sockaddr *addr)
/* LINTED: alignment */
sin6 = (struct sockaddr_in6 *)addr;
sin6->sin6_addr = faddr;
- sin6->sin6_port = sctp->sctp_fport;
+ sin6->sin6_port = connp->conn_fport;
sin6->sin6_family = AF_INET6;
sin6->sin6_flowinfo = 0;
sin6->sin6_scope_id = 0;
@@ -797,7 +798,7 @@ tcpip_sock_print(struct sonode *socknode)
mdb_printf("socket: ");
mdb_nhconvert(&port, &conn_t.conn_lport, sizeof (port));
- mdb_printf("AF_INET %I %d ", conn_t.conn_src, port);
+ mdb_printf("AF_INET %I %d ", conn_t.conn_laddr_v4, port);
/*
* If this is a listening socket, we don't print
@@ -807,7 +808,8 @@ tcpip_sock_print(struct sonode *socknode)
IPCL_IS_UDP(&conn_t) && IPCL_IS_CONNECTED(&conn_t)) {
mdb_printf("remote: ");
mdb_nhconvert(&port, &conn_t.conn_fport, sizeof (port));
- mdb_printf("AF_INET %I %d ", conn_t.conn_rem, port);
+ mdb_printf("AF_INET %I %d ", conn_t.conn_faddr_v4,
+ port);
}
break;
@@ -826,7 +828,7 @@ tcpip_sock_print(struct sonode *socknode)
mdb_printf("socket: ");
mdb_nhconvert(&port, &conn_t.conn_lport, sizeof (port));
- mdb_printf("AF_INET6 %N %d ", &conn_t.conn_srcv6, port);
+ mdb_printf("AF_INET6 %N %d ", &conn_t.conn_laddr_v4, port);
/*
* If this is a listening socket, we don't print
@@ -836,7 +838,8 @@ tcpip_sock_print(struct sonode *socknode)
IPCL_IS_UDP(&conn_t) && IPCL_IS_CONNECTED(&conn_t)) {
mdb_printf("remote: ");
mdb_nhconvert(&port, &conn_t.conn_fport, sizeof (port));
- mdb_printf("AF_INET6 %N %d ", &conn_t.conn_remv6, port);
+ mdb_printf("AF_INET6 %N %d ", &conn_t.conn_faddr_v6,
+ port);
}
break;
@@ -854,6 +857,7 @@ static int
sctp_sock_print(struct sonode *socknode)
{
sctp_t sctp_t;
+ conn_t conns;
struct sockaddr *laddr = mdb_alloc(sizeof (struct sockaddr), UM_SLEEP);
struct sockaddr *faddr = mdb_alloc(sizeof (struct sockaddr), UM_SLEEP);
@@ -864,6 +868,14 @@ sctp_sock_print(struct sonode *socknode)
return (-1);
}
+ if (mdb_vread(&conns, sizeof (conn_t),
+ (uintptr_t)sctp_t.sctp_connp) == -1) {
+ mdb_warn("failed to read conn_t at %p",
+ (uintptr_t)sctp_t.sctp_connp);
+ return (-1);
+ }
+ sctp_t.sctp_connp = &conns;
+
if (sctp_getsockaddr(&sctp_t, laddr) == 0) {
mdb_printf("socket:");
pfiles_print_addr(laddr);
diff --git a/usr/src/cmd/mdb/common/modules/ip/ip.c b/usr/src/cmd/mdb/common/modules/ip/ip.c
index 28f21efe1f..da94942eae 100644
--- a/usr/src/cmd/mdb/common/modules/ip/ip.c
+++ b/usr/src/cmd/mdb/common/modules/ip/ip.c
@@ -52,6 +52,7 @@
#include <ilb/ilb_nat.h>
#include <ilb/ilb_conn.h>
#include <sys/dlpi.h>
+#include <sys/zone.h>
#include <mdb/mdb_modapi.h>
#include <mdb/mdb_ks.h>
@@ -84,15 +85,20 @@ typedef struct illif_walk_data {
ill_if_t ill_if;
} illif_walk_data_t;
-typedef struct nce_walk_data_s {
- struct ndp_g_s nce_ip_ndp;
- int nce_hash_tbl_index;
- nce_t nce;
-} nce_walk_data_t;
+typedef struct ncec_walk_data_s {
+ struct ndp_g_s ncec_ip_ndp;
+ int ncec_hash_tbl_index;
+ ncec_t ncec;
+} ncec_walk_data_t;
+
+typedef struct ncec_cbdata_s {
+ uintptr_t ncec_addr;
+ int ncec_ipversion;
+} ncec_cbdata_t;
typedef struct nce_cbdata_s {
- uintptr_t nce_addr;
- int nce_ipversion;
+ int nce_ipversion;
+ char nce_ill_name[LIFNAMSIZ];
} nce_cbdata_t;
typedef struct ire_cbdata_s {
@@ -100,6 +106,12 @@ typedef struct ire_cbdata_s {
boolean_t verbose;
} ire_cbdata_t;
+typedef struct zi_cbdata_s {
+ const char *zone_name;
+ ip_stack_t *ipst;
+ boolean_t shared_ip_zone;
+} zi_cbdata_t;
+
typedef struct th_walk_data {
uint_t thw_non_zero_only;
boolean_t thw_match;
@@ -122,6 +134,7 @@ typedef struct ill_walk_data_s {
typedef struct ill_cbdata_s {
uintptr_t ill_addr;
int ill_ipversion;
+ ip_stack_t *ill_ipst;
boolean_t verbose;
} ill_cbdata_t;
@@ -156,7 +169,7 @@ static hash_walk_arg_t bind_hash_arg = {
};
static hash_walk_arg_t proto_hash_arg = {
- OFFSETOF(ip_stack_t, ips_ipcl_proto_fanout),
+ OFFSETOF(ip_stack_t, ips_ipcl_proto_fanout_v4),
0
};
@@ -210,13 +223,15 @@ static void ip_list_walk_fini(mdb_walk_state_t *);
static int srcid_walk_step(mdb_walk_state_t *);
static int ire_format(uintptr_t addr, const void *, void *);
-static int nce_format(uintptr_t addr, const nce_t *nce, int ipversion);
-static int nce(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv);
-static int nce_walk_step(mdb_walk_state_t *wsp);
-static int nce_stack_walk_init(mdb_walk_state_t *wsp);
-static int nce_stack_walk_step(mdb_walk_state_t *wsp);
-static void nce_stack_walk_fini(mdb_walk_state_t *wsp);
-static int nce_cb(uintptr_t addr, const nce_walk_data_t *iw, nce_cbdata_t *id);
+static int ncec_format(uintptr_t addr, const ncec_t *ncec, int ipversion);
+static int ncec(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv);
+static int ncec_walk_step(mdb_walk_state_t *wsp);
+static int ncec_stack_walk_init(mdb_walk_state_t *wsp);
+static int ncec_stack_walk_step(mdb_walk_state_t *wsp);
+static void ncec_stack_walk_fini(mdb_walk_state_t *wsp);
+static int ncec_cb(uintptr_t addr, const ncec_walk_data_t *iw,
+ ncec_cbdata_t *id);
+static char *nce_l2_addr(const nce_t *, const ill_t *);
static int ipcl_hash_walk_init(mdb_walk_state_t *);
static int ipcl_hash_walk_step(mdb_walk_state_t *);
@@ -262,6 +277,69 @@ ips_to_stackid(uintptr_t kaddr)
return (nss.netstack_stackid);
}
+/* ARGSUSED */
+static int
+zone_to_ips_cb(uintptr_t addr, const void *zi_arg, void *zi_cb_arg)
+{
+ zi_cbdata_t *zi_cb = zi_cb_arg;
+ zone_t zone;
+ char zone_name[ZONENAME_MAX];
+ netstack_t ns;
+
+ if (mdb_vread(&zone, sizeof (zone_t), addr) == -1) {
+ mdb_warn("can't read zone at %p", addr);
+ return (WALK_ERR);
+ }
+
+ (void) mdb_readstr(zone_name, ZONENAME_MAX, (uintptr_t)zone.zone_name);
+
+ if (strcmp(zi_cb->zone_name, zone_name) != 0)
+ return (WALK_NEXT);
+
+ zi_cb->shared_ip_zone = (!(zone.zone_flags & ZF_NET_EXCL) &&
+ (strcmp(zone_name, "global") != 0));
+
+ if (mdb_vread(&ns, sizeof (netstack_t), (uintptr_t)zone.zone_netstack)
+ == -1) {
+ mdb_warn("can't read netstack at %p", zone.zone_netstack);
+ return (WALK_ERR);
+ }
+
+ zi_cb->ipst = ns.netstack_ip;
+ return (WALK_DONE);
+}
+
+static ip_stack_t *
+zone_to_ips(const char *zone_name)
+{
+ zi_cbdata_t zi_cb;
+
+ if (zone_name == NULL)
+ return (NULL);
+
+ zi_cb.zone_name = zone_name;
+ zi_cb.ipst = NULL;
+ zi_cb.shared_ip_zone = B_FALSE;
+
+ if (mdb_walk("zone", (mdb_walk_cb_t)zone_to_ips_cb, &zi_cb) == -1) {
+ mdb_warn("failed to walk zone");
+ return (NULL);
+ }
+
+ if (zi_cb.shared_ip_zone) {
+ mdb_warn("%s is a Shared-IP zone, try '-s global' instead\n",
+ zone_name);
+ return (NULL);
+ }
+
+ if (zi_cb.ipst == NULL) {
+ mdb_warn("failed to find zone %s\n", zone_name);
+ return (NULL);
+ }
+
+ return (zi_cb.ipst);
+}
+
int
ip_stacks_walk_init(mdb_walk_state_t *wsp)
{
@@ -529,10 +607,10 @@ illif_help(void)
}
int
-ire_walk_init(mdb_walk_state_t *wsp)
+nce_walk_init(mdb_walk_state_t *wsp)
{
- if (mdb_layered_walk("ire_cache", wsp) == -1) {
- mdb_warn("can't walk 'ire_cache'");
+ if (mdb_layered_walk("nce_cache", wsp) == -1) {
+ mdb_warn("can't walk 'nce_cache'");
return (WALK_ERR);
}
@@ -540,60 +618,129 @@ ire_walk_init(mdb_walk_state_t *wsp)
}
int
-ire_walk_step(mdb_walk_state_t *wsp)
+nce_walk_step(mdb_walk_state_t *wsp)
{
- ire_t ire;
+ nce_t nce;
- if (mdb_vread(&ire, sizeof (ire), wsp->walk_addr) == -1) {
- mdb_warn("can't read ire at %p", wsp->walk_addr);
+ if (mdb_vread(&nce, sizeof (nce), wsp->walk_addr) == -1) {
+ mdb_warn("can't read nce at %p", wsp->walk_addr);
return (WALK_ERR);
}
- return (wsp->walk_callback(wsp->walk_addr, &ire, wsp->walk_cbdata));
+ return (wsp->walk_callback(wsp->walk_addr, &nce, wsp->walk_cbdata));
}
+static int
+nce_format(uintptr_t addr, const nce_t *ncep, void *nce_cb_arg)
+{
+ nce_cbdata_t *nce_cb = nce_cb_arg;
+ ill_t ill;
+ char ill_name[LIFNAMSIZ];
+ ncec_t ncec;
+
+ if (mdb_vread(&ncec, sizeof (ncec),
+ (uintptr_t)ncep->nce_common) == -1) {
+ mdb_warn("can't read ncec at %p", ncep->nce_common);
+ return (WALK_NEXT);
+ }
+ if (nce_cb->nce_ipversion != 0 &&
+ ncec.ncec_ipversion != nce_cb->nce_ipversion)
+ return (WALK_NEXT);
+
+ if (mdb_vread(&ill, sizeof (ill), (uintptr_t)ncep->nce_ill) == -1) {
+ mdb_snprintf(ill_name, sizeof (ill_name), "--");
+ } else {
+ (void) mdb_readstr(ill_name,
+ MIN(LIFNAMSIZ, ill.ill_name_length),
+ (uintptr_t)ill.ill_name);
+ }
+
+ if (nce_cb->nce_ill_name[0] != '\0' &&
+ strncmp(nce_cb->nce_ill_name, ill_name, LIFNAMSIZ) != 0)
+ return (WALK_NEXT);
+
+ if (ncec.ncec_ipversion == IPV6_VERSION) {
+
+ mdb_printf("%?p %5s %-18s %?p %6d %N\n",
+ addr, ill_name,
+ nce_l2_addr(ncep, &ill),
+ ncep->nce_fp_mp,
+ ncep->nce_refcnt,
+ &ncep->nce_addr);
+
+ } else {
+ struct in_addr nceaddr;
+
+ IN6_V4MAPPED_TO_INADDR(&ncep->nce_addr, &nceaddr);
+ mdb_printf("%?p %5s %-18s %?p %6d %I\n",
+ addr, ill_name,
+ nce_l2_addr(ncep, &ill),
+ ncep->nce_fp_mp,
+ ncep->nce_refcnt,
+ nceaddr.s_addr);
+ }
+
+ return (WALK_NEXT);
+}
int
-ire_ctable_walk_step(mdb_walk_state_t *wsp)
+dce_walk_init(mdb_walk_state_t *wsp)
{
- uintptr_t kaddr;
- irb_t *irb;
- uint32_t cache_table_size;
- int i;
- ire_cbdata_t ire_cb;
+ wsp->walk_data = (void *)wsp->walk_addr;
- ire_cb.verbose = B_FALSE;
- ire_cb.ire_ipversion = 0;
+ if (mdb_layered_walk("dce_cache", wsp) == -1) {
+ mdb_warn("can't walk 'dce_cache'");
+ return (WALK_ERR);
+ }
+ return (WALK_NEXT);
+}
- kaddr = wsp->walk_addr + OFFSETOF(ip_stack_t, ips_ip_cache_table_size);
+int
+dce_walk_step(mdb_walk_state_t *wsp)
+{
+ dce_t dce;
- if (mdb_vread(&cache_table_size, sizeof (uint32_t), kaddr) == -1) {
- mdb_warn("can't read ips_ip_cache_table at %p", kaddr);
+ if (mdb_vread(&dce, sizeof (dce), wsp->walk_addr) == -1) {
+ mdb_warn("can't read dce at %p", wsp->walk_addr);
return (WALK_ERR);
}
- kaddr = wsp->walk_addr + OFFSETOF(ip_stack_t, ips_ip_cache_table);
- if (mdb_vread(&kaddr, sizeof (kaddr), kaddr) == -1) {
- mdb_warn("can't read ips_ip_cache_table at %p", kaddr);
+ /* If ip_stack_t is specified, skip DCEs that don't belong to it. */
+ if ((wsp->walk_data != NULL) && (wsp->walk_data != dce.dce_ipst))
+ return (WALK_NEXT);
+
+ return (wsp->walk_callback(wsp->walk_addr, &dce, wsp->walk_cbdata));
+}
+
+int
+ire_walk_init(mdb_walk_state_t *wsp)
+{
+ wsp->walk_data = (void *)wsp->walk_addr;
+
+ if (mdb_layered_walk("ire_cache", wsp) == -1) {
+ mdb_warn("can't walk 'ire_cache'");
return (WALK_ERR);
}
- irb = mdb_alloc(sizeof (irb_t) * cache_table_size, UM_SLEEP|UM_GC);
- if (mdb_vread(irb, sizeof (irb_t) * cache_table_size, kaddr) == -1) {
- mdb_warn("can't read irb at %p", kaddr);
+ return (WALK_NEXT);
+}
+
+int
+ire_walk_step(mdb_walk_state_t *wsp)
+{
+ ire_t ire;
+
+ if (mdb_vread(&ire, sizeof (ire), wsp->walk_addr) == -1) {
+ mdb_warn("can't read ire at %p", wsp->walk_addr);
return (WALK_ERR);
}
- for (i = 0; i < cache_table_size; i++) {
- kaddr = (uintptr_t)irb[i].irb_ire;
- if (mdb_pwalk("ire_next", ire_format, &ire_cb,
- kaddr) == -1) {
- mdb_warn("can't walk 'ire_next' for ire %p", kaddr);
- return (WALK_ERR);
- }
- }
- return (WALK_NEXT);
+ /* If ip_stack_t is specified, skip IREs that don't belong to it. */
+ if ((wsp->walk_data != NULL) && (wsp->walk_data != ire.ire_ipst))
+ return (WALK_NEXT);
+
+ return (wsp->walk_callback(wsp->walk_addr, &ire, wsp->walk_cbdata));
}
/* ARGSUSED */
@@ -633,6 +780,9 @@ ire_format(uintptr_t addr, const void *ire_arg, void *ire_cb_arg)
const ire_t *irep = ire_arg;
ire_cbdata_t *ire_cb = ire_cb_arg;
boolean_t verbose = ire_cb->verbose;
+ ill_t ill;
+ char ill_name[LIFNAMSIZ];
+ boolean_t condemned = irep->ire_generation == IRE_GENERATION_CONDEMNED;
static const mdb_bitmask_t tmasks[] = {
{ "BROADCAST", IRE_BROADCAST, IRE_BROADCAST },
@@ -640,22 +790,12 @@ ire_format(uintptr_t addr, const void *ire_arg, void *ire_cb_arg)
{ "LOCAL", IRE_LOCAL, IRE_LOCAL },
{ "LOOPBACK", IRE_LOOPBACK, IRE_LOOPBACK },
{ "PREFIX", IRE_PREFIX, IRE_PREFIX },
- { "CACHE", IRE_CACHE, IRE_CACHE },
+ { "MULTICAST", IRE_MULTICAST, IRE_MULTICAST },
+ { "NOROUTE", IRE_NOROUTE, IRE_NOROUTE },
{ "IF_NORESOLVER", IRE_IF_NORESOLVER, IRE_IF_NORESOLVER },
{ "IF_RESOLVER", IRE_IF_RESOLVER, IRE_IF_RESOLVER },
+ { "IF_CLONE", IRE_IF_CLONE, IRE_IF_CLONE },
{ "HOST", IRE_HOST, IRE_HOST },
- { "HOST_REDIRECT", IRE_HOST_REDIRECT, IRE_HOST_REDIRECT },
- { NULL, 0, 0 }
- };
-
- static const mdb_bitmask_t mmasks[] = {
- { "CONDEMNED", IRE_MARK_CONDEMNED, IRE_MARK_CONDEMNED },
- { "TESTHIDDEN", IRE_MARK_TESTHIDDEN, IRE_MARK_TESTHIDDEN },
- { "NOADD", IRE_MARK_NOADD, IRE_MARK_NOADD },
- { "TEMPORARY", IRE_MARK_TEMPORARY, IRE_MARK_TEMPORARY },
- { "USESRC", IRE_MARK_USESRC_CHECK, IRE_MARK_USESRC_CHECK },
- { "PRIVATE", IRE_MARK_PRIVATE_ADDR, IRE_MARK_PRIVATE_ADDR },
- { "UNCACHED", IRE_MARK_UNCACHED, IRE_MARK_UNCACHED },
{ NULL, 0, 0 }
};
@@ -678,6 +818,7 @@ ire_format(uintptr_t addr, const void *ire_arg, void *ire_cb_arg)
{ "PROTO1", RTF_PROTO1, RTF_PROTO1 },
{ "MULTIRT", RTF_MULTIRT, RTF_MULTIRT },
{ "SETSRC", RTF_SETSRC, RTF_SETSRC },
+ { "INDIRECT", RTF_INDIRECT, RTF_INDIRECT },
{ NULL, 0, 0 }
};
@@ -685,40 +826,53 @@ ire_format(uintptr_t addr, const void *ire_arg, void *ire_cb_arg)
irep->ire_ipversion != ire_cb->ire_ipversion)
return (WALK_NEXT);
+ if (mdb_vread(&ill, sizeof (ill), (uintptr_t)irep->ire_ill) == -1) {
+ mdb_snprintf(ill_name, sizeof (ill_name), "--");
+ } else {
+ (void) mdb_readstr(ill_name,
+ MIN(LIFNAMSIZ, ill.ill_name_length),
+ (uintptr_t)ill.ill_name);
+ }
+
if (irep->ire_ipversion == IPV6_VERSION && verbose) {
- mdb_printf("%<b>%?p%</b> %40N <%hb>\n"
- "%?s %40N <%hb>\n"
- "%?s %40d %4d <%hb>\n",
- addr, &irep->ire_src_addr_v6, irep->ire_type, tmasks,
- "", &irep->ire_addr_v6, (ushort_t)irep->ire_marks, mmasks,
+ mdb_printf("%<b>%?p%</b>%3s %40N <%hb%s>\n"
+ "%?s %40N\n"
+ "%?s %40d %4d <%hb> %s\n",
+ addr, condemned ? "(C)" : "", &irep->ire_setsrc_addr_v6,
+ irep->ire_type, tmasks,
+ (irep->ire_testhidden ? ", HIDDEN" : ""),
+ "", &irep->ire_addr_v6,
"", ips_to_stackid((uintptr_t)irep->ire_ipst),
irep->ire_zoneid,
- irep->ire_flags, fmasks);
+ irep->ire_flags, fmasks, ill_name);
} else if (irep->ire_ipversion == IPV6_VERSION) {
- mdb_printf("%?p %30N %30N %5d %4d\n",
- addr, &irep->ire_src_addr_v6,
+ mdb_printf("%?p%3s %30N %30N %5d %4d %s\n",
+ addr, condemned ? "(C)" : "", &irep->ire_setsrc_addr_v6,
&irep->ire_addr_v6,
ips_to_stackid((uintptr_t)irep->ire_ipst),
- irep->ire_zoneid);
+ irep->ire_zoneid, ill_name);
} else if (verbose) {
- mdb_printf("%<b>%?p%</b> %40I <%hb>\n"
- "%?s %40I <%hb>\n"
- "%?s %40d %4d <%hb>\n",
- addr, irep->ire_src_addr, irep->ire_type, tmasks,
- "", irep->ire_addr, (ushort_t)irep->ire_marks, mmasks,
+ mdb_printf("%<b>%?p%</b>%3s %40I <%hb%s>\n"
+ "%?s %40I\n"
+ "%?s %40d %4d <%hb> %s\n",
+ addr, condemned ? "(C)" : "", irep->ire_setsrc_addr,
+ irep->ire_type, tmasks,
+ (irep->ire_testhidden ? ", HIDDEN" : ""),
+ "", irep->ire_addr,
"", ips_to_stackid((uintptr_t)irep->ire_ipst),
- irep->ire_zoneid, irep->ire_flags, fmasks);
+ irep->ire_zoneid, irep->ire_flags, fmasks, ill_name);
} else {
- mdb_printf("%?p %30I %30I %5d %4d\n", addr, irep->ire_src_addr,
+ mdb_printf("%?p%3s %30I %30I %5d %4d %s\n", addr,
+ condemned ? "(C)" : "", irep->ire_setsrc_addr,
irep->ire_addr, ips_to_stackid((uintptr_t)irep->ire_ipst),
- irep->ire_zoneid);
+ irep->ire_zoneid, ill_name);
}
return (WALK_NEXT);
@@ -1040,6 +1194,140 @@ ip6hdr(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
}
int
+nce(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
+{
+ nce_t nce;
+ nce_cbdata_t nce_cb;
+ int ipversion = 0;
+ const char *opt_P = NULL, *opt_ill;
+
+ if (mdb_getopts(argc, argv,
+ 'i', MDB_OPT_STR, &opt_ill,
+ 'P', MDB_OPT_STR, &opt_P, NULL) != argc)
+ return (DCMD_USAGE);
+
+ if (opt_P != NULL) {
+ if (strcmp("v4", opt_P) == 0) {
+ ipversion = IPV4_VERSION;
+ } else if (strcmp("v6", opt_P) == 0) {
+ ipversion = IPV6_VERSION;
+ } else {
+ mdb_warn("invalid protocol '%s'\n", opt_P);
+ return (DCMD_USAGE);
+ }
+ }
+
+ if ((flags & DCMD_LOOPFIRST) || !(flags & DCMD_LOOP)) {
+ mdb_printf("%<u>%?s %5s %18s %?s %s %s %</u>\n",
+ "ADDR", "INTF", "LLADDR", "FP_MP", "REFCNT",
+ "NCE_ADDR");
+ }
+
+ bzero(&nce_cb, sizeof (nce_cb));
+ if (opt_ill != NULL) {
+ strcpy(nce_cb.nce_ill_name, opt_ill);
+ }
+ nce_cb.nce_ipversion = ipversion;
+
+ if (flags & DCMD_ADDRSPEC) {
+ (void) mdb_vread(&nce, sizeof (nce_t), addr);
+ (void) nce_format(addr, &nce, &nce_cb);
+ } else if (mdb_walk("nce", (mdb_walk_cb_t)nce_format, &nce_cb) == -1) {
+ mdb_warn("failed to walk ire table");
+ return (DCMD_ERR);
+ }
+
+ return (DCMD_OK);
+}
+
+/* ARGSUSED */
+static int
+dce_format(uintptr_t addr, const dce_t *dcep, void *dce_cb_arg)
+{
+ static const mdb_bitmask_t dmasks[] = {
+ { "D", DCEF_DEFAULT, DCEF_DEFAULT },
+ { "P", DCEF_PMTU, DCEF_PMTU },
+ { "U", DCEF_UINFO, DCEF_UINFO },
+ { "S", DCEF_TOO_SMALL_PMTU, DCEF_TOO_SMALL_PMTU },
+ { NULL, 0, 0 }
+ };
+ char flagsbuf[2 * A_CNT(dmasks)];
+ int ipversion = *(int *)dce_cb_arg;
+ boolean_t condemned = dcep->dce_generation == DCE_GENERATION_CONDEMNED;
+
+ if (ipversion != 0 && ipversion != dcep->dce_ipversion)
+ return (WALK_NEXT);
+
+ mdb_snprintf(flagsbuf, sizeof (flagsbuf), "%b", dcep->dce_flags,
+ dmasks);
+
+ switch (dcep->dce_ipversion) {
+ case IPV4_VERSION:
+ mdb_printf("%<u>%?p%3s %8s %8d %30I %</u>\n", addr, condemned ?
+ "(C)" : "", flagsbuf, dcep->dce_pmtu, &dcep->dce_v4addr);
+ break;
+ case IPV6_VERSION:
+ mdb_printf("%<u>%?p%3s %8s %8d %30N %</u>\n", addr, condemned ?
+ "(C)" : "", flagsbuf, dcep->dce_pmtu, &dcep->dce_v6addr);
+ break;
+ default:
+ mdb_printf("%<u>%?p%3s %8s %8d %30s %</u>\n", addr, condemned ?
+ "(C)" : "", flagsbuf, dcep->dce_pmtu, "");
+ }
+
+ return (WALK_NEXT);
+}
+
+int
+dce(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
+{
+ dce_t dce;
+ const char *opt_P = NULL;
+ const char *zone_name = NULL;
+ ip_stack_t *ipst = NULL;
+ int ipversion = 0;
+
+ if (mdb_getopts(argc, argv,
+ 's', MDB_OPT_STR, &zone_name,
+ 'P', MDB_OPT_STR, &opt_P, NULL) != argc)
+ return (DCMD_USAGE);
+
+ /* Follow the specified zone name to find a ip_stack_t*. */
+ if (zone_name != NULL) {
+ ipst = zone_to_ips(zone_name);
+ if (ipst == NULL)
+ return (DCMD_USAGE);
+ }
+
+ if (opt_P != NULL) {
+ if (strcmp("v4", opt_P) == 0) {
+ ipversion = IPV4_VERSION;
+ } else if (strcmp("v6", opt_P) == 0) {
+ ipversion = IPV6_VERSION;
+ } else {
+ mdb_warn("invalid protocol '%s'\n", opt_P);
+ return (DCMD_USAGE);
+ }
+ }
+
+ if ((flags & DCMD_LOOPFIRST) || !(flags & DCMD_LOOP)) {
+ mdb_printf("%<u>%?s%3s %8s %8s %30s %</u>\n",
+ "ADDR", "", "FLAGS", "PMTU", "DST_ADDR");
+ }
+
+ if (flags & DCMD_ADDRSPEC) {
+ (void) mdb_vread(&dce, sizeof (dce_t), addr);
+ (void) dce_format(addr, &dce, &ipversion);
+ } else if (mdb_pwalk("dce", (mdb_walk_cb_t)dce_format, &ipversion,
+ (uintptr_t)ipst) == -1) {
+ mdb_warn("failed to walk dce cache");
+ return (DCMD_ERR);
+ }
+
+ return (DCMD_OK);
+}
+
+int
ire(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
{
uint_t verbose = FALSE;
@@ -1047,12 +1335,22 @@ ire(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
ire_cbdata_t ire_cb;
int ipversion = 0;
const char *opt_P = NULL;
+ const char *zone_name = NULL;
+ ip_stack_t *ipst = NULL;
if (mdb_getopts(argc, argv,
'v', MDB_OPT_SETBITS, TRUE, &verbose,
+ 's', MDB_OPT_STR, &zone_name,
'P', MDB_OPT_STR, &opt_P, NULL) != argc)
return (DCMD_USAGE);
+ /* Follow the specified zone name to find a ip_stack_t*. */
+ if (zone_name != NULL) {
+ ipst = zone_to_ips(zone_name);
+ if (ipst == NULL)
+ return (DCMD_USAGE);
+ }
+
if (opt_P != NULL) {
if (strcmp("v4", opt_P) == 0) {
ipversion = IPV4_VERSION;
@@ -1069,13 +1367,13 @@ ire(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
if (verbose) {
mdb_printf("%?s %40s %-20s%\n"
"%?s %40s %-20s%\n"
- "%<u>%?s %40s %4s %-20s%</u>\n",
+ "%<u>%?s %40s %4s %-20s %s%</u>\n",
"ADDR", "SRC", "TYPE",
"", "DST", "MARKS",
- "", "STACK", "ZONE", "FLAGS");
+ "", "STACK", "ZONE", "FLAGS", "INTF");
} else {
- mdb_printf("%<u>%?s %30s %30s %5s %4s%</u>\n",
- "ADDR", "SRC", "DST", "STACK", "ZONE");
+ mdb_printf("%<u>%?s %30s %30s %5s %4s %s%</u>\n",
+ "ADDR", "SRC", "DST", "STACK", "ZONE", "INTF");
}
}
@@ -1085,7 +1383,8 @@ ire(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
if (flags & DCMD_ADDRSPEC) {
(void) mdb_vread(&ire, sizeof (ire_t), addr);
(void) ire_format(addr, &ire, &ire_cb);
- } else if (mdb_walk("ire", (mdb_walk_cb_t)ire_format, &ire_cb) == -1) {
+ } else if (mdb_pwalk("ire", (mdb_walk_cb_t)ire_format, &ire_cb,
+ (uintptr_t)ipst) == -1) {
mdb_warn("failed to walk ire table");
return (DCMD_ERR);
}
@@ -1338,7 +1637,7 @@ th_trace(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
static void
th_trace_help(void)
{
- mdb_printf("If given an address of an ill_t, ipif_t, ire_t, or nce_t, "
+ mdb_printf("If given an address of an ill_t, ipif_t, ire_t, or ncec_t, "
"print the\n"
"corresponding th_trace_t structure in detail. Otherwise, if no "
"address is\n"
@@ -1354,8 +1653,8 @@ static const mdb_dcmd_t dcmds[] = {
{ "srcid_status", ":",
"display connection structures from ipcl hash tables",
srcid_status },
- { "ill", "?[-v] [-P v4 | v6]", "display ill_t structures",
- ill, ill_help },
+ { "ill", "?[-v] [-P v4 | v6] [-s exclusive-ip-zone-name]",
+ "display ill_t structures", ill, ill_help },
{ "illif", "?[-P v4 | v6]",
"display or filter IP Lower Level InterFace structures", illif,
illif_help },
@@ -1363,10 +1662,14 @@ static const mdb_dcmd_t dcmds[] = {
{ "ip6hdr", ":[-vf]", "display an IPv6 header", ip6hdr },
{ "ipif", "?[-v] [-P v4 | v6]", "display ipif structures",
ipif, ipif_help },
- { "ire", "?[-v] [-P v4|v6]",
+ { "ire", "?[-v] [-P v4|v6] [-s exclusive-ip-zone-name]",
"display Internet Route Entry structures", ire },
- { "nce", "?[-P v4 | v6]", "display Neighbor Cache Entry structures",
- nce },
+ { "nce", "?[-P v4|v6] [-i <interface>]",
+ "display interface-specific Neighbor Cache structures", nce },
+ { "ncec", "?[-P v4 | v6]", "display Neighbor Cache Entry structures",
+ ncec },
+ { "dce", "?[-P v4|v6] [-s exclusive-ip-zone-name]",
+ "display Destination Cache Entry structures", dce },
{ "squeue", ":[-v]", "print core squeue_t info", squeue,
ip_squeue_help },
{ "tcphdr", ":", "display a TCP header", tcphdr },
@@ -1385,7 +1688,7 @@ static const mdb_walker_t walkers[] = {
{ "illif_stack", "walk list of ill interface types",
illif_stack_walk_init, illif_stack_walk_step,
illif_stack_walk_fini },
- { "ill", "walk list of nce structures for all stacks",
+ { "ill", "walk active ill_t structures for all stacks",
ill_walk_init, ill_walk_step, NULL },
{ "ipif", "walk list of ipif structures for all stacks",
ipif_walk_init, ipif_walk_step, NULL },
@@ -1400,19 +1703,21 @@ static const mdb_walker_t walkers[] = {
&srcid_walk_arg },
{ "ire", "walk active ire_t structures",
ire_walk_init, ire_walk_step, NULL },
- { "ire_ctable", "walk ire_t structures in the ctable",
- ip_stacks_common_walk_init, ire_ctable_walk_step, NULL },
{ "ire_next", "walk ire_t structures in the ctable",
ire_next_walk_init, ire_next_walk_step, NULL },
+ { "nce", "walk active nce_t structures",
+ nce_walk_init, nce_walk_step, NULL },
+ { "dce", "walk active dce_t structures",
+ dce_walk_init, dce_walk_step, NULL },
{ "ip_stacks", "walk all the ip_stack_t",
ip_stacks_walk_init, ip_stacks_walk_step, NULL },
{ "th_hash", "walk all the th_hash_t entries",
th_hash_walk_init, th_hash_walk_step, NULL },
- { "nce", "walk list of nce structures for all stacks",
- ip_stacks_common_walk_init, nce_walk_step, NULL },
- { "nce_stack", "walk list of nce structures",
- nce_stack_walk_init, nce_stack_walk_step,
- nce_stack_walk_fini},
+ { "ncec", "walk list of ncec structures for all stacks",
+ ip_stacks_common_walk_init, ncec_walk_step, NULL },
+ { "ncec_stack", "walk list of ncec structures",
+ ncec_stack_walk_init, ncec_stack_walk_step,
+ ncec_stack_walk_fini},
{ "udp_hash", "walk list of conn_t structures in ips_ipcl_udp_fanout",
ipcl_hash_walk_init, ipcl_hash_walk_step,
ipcl_hash_walk_fini, &udp_hash_arg},
@@ -1471,9 +1776,9 @@ _mdb_fini(void)
}
static char *
-nce_state(int nce_state)
+ncec_state(int ncec_state)
{
- switch (nce_state) {
+ switch (ncec_state) {
case ND_UNCHANGED:
return ("unchanged");
case ND_INCOMPLETE:
@@ -1496,36 +1801,61 @@ nce_state(int nce_state)
}
static char *
-nce_l2_addr(const nce_t *nce, const ill_t *ill)
+ncec_l2_addr(const ncec_t *ncec, const ill_t *ill)
{
uchar_t *h;
static char addr_buf[L2MAXADDRSTRLEN];
- mblk_t mp;
- size_t mblen;
- if (ill->ill_flags & ILLF_XRESOLV) {
- return ("XRESOLV");
+ if (ncec->ncec_lladdr == NULL) {
+ return ("None");
}
- if (nce->nce_res_mp == NULL) {
+ if (ill->ill_net_type == IRE_IF_RESOLVER) {
+
+ if (ill->ill_phys_addr_length == 0)
+ return ("None");
+ h = mdb_zalloc(ill->ill_phys_addr_length, UM_SLEEP);
+ if (mdb_vread(h, ill->ill_phys_addr_length,
+ (uintptr_t)ncec->ncec_lladdr) == -1) {
+ mdb_warn("failed to read hwaddr at %p",
+ ncec->ncec_lladdr);
+ return ("Unknown");
+ }
+ mdb_mac_addr(h, ill->ill_phys_addr_length,
+ addr_buf, sizeof (addr_buf));
+ } else {
return ("None");
}
+ mdb_free(h, ill->ill_phys_addr_length);
+ return (addr_buf);
+}
- if (ill->ill_net_type == IRE_IF_RESOLVER) {
+static char *
+nce_l2_addr(const nce_t *nce, const ill_t *ill)
+{
+ uchar_t *h;
+ static char addr_buf[L2MAXADDRSTRLEN];
+ mblk_t mp;
+ size_t mblen;
+
+ if (nce->nce_dlur_mp == NULL)
+ return ("None");
+ if (ill->ill_net_type == IRE_IF_RESOLVER) {
if (mdb_vread(&mp, sizeof (mblk_t),
- (uintptr_t)nce->nce_res_mp) == -1) {
- mdb_warn("failed to read nce_res_mp at %p",
- nce->nce_res_mp);
+ (uintptr_t)nce->nce_dlur_mp) == -1) {
+ mdb_warn("failed to read nce_dlur_mp at %p",
+ nce->nce_dlur_mp);
+ return ("None");
}
-
- if (ill->ill_nd_lla_len == 0)
+ if (ill->ill_phys_addr_length == 0)
return ("None");
mblen = mp.b_wptr - mp.b_rptr;
if (mblen > (sizeof (dl_unitdata_req_t) + MAX_SAP_LEN) ||
- ill->ill_nd_lla_len > MAX_SAP_LEN ||
- NCE_LL_ADDR_OFFSET(ill) + ill->ill_nd_lla_len > mblen) {
- return ("Truncated");
+ ill->ill_phys_addr_length > MAX_SAP_LEN ||
+ (NCE_LL_ADDR_OFFSET(ill) +
+ ill->ill_phys_addr_length) > mblen) {
+ return ("Unknown");
}
h = mdb_zalloc(mblen, UM_SLEEP);
if (mdb_vread(h, mblen, (uintptr_t)(mp.b_rptr)) == -1) {
@@ -1533,8 +1863,8 @@ nce_l2_addr(const nce_t *nce, const ill_t *ill)
mp.b_rptr + NCE_LL_ADDR_OFFSET(ill));
return ("Unknown");
}
- mdb_mac_addr(h + NCE_LL_ADDR_OFFSET(ill), ill->ill_nd_lla_len,
- addr_buf, sizeof (addr_buf));
+ mdb_mac_addr(h + NCE_LL_ADDR_OFFSET(ill),
+ ill->ill_phys_addr_length, addr_buf, sizeof (addr_buf));
} else {
return ("None");
}
@@ -1543,7 +1873,7 @@ nce_l2_addr(const nce_t *nce, const ill_t *ill)
}
static void
-nce_header(uint_t flags)
+ncec_header(uint_t flags)
{
if ((flags & DCMD_LOOPFIRST) || !(flags & DCMD_LOOP)) {
@@ -1553,10 +1883,10 @@ nce_header(uint_t flags)
}
int
-nce(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
+ncec(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
{
- nce_t nce;
- nce_cbdata_t id;
+ ncec_t ncec;
+ ncec_cbdata_t id;
int ipversion = 0;
const char *opt_P = NULL;
@@ -1577,23 +1907,23 @@ nce(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
if (flags & DCMD_ADDRSPEC) {
- if (mdb_vread(&nce, sizeof (nce_t), addr) == -1) {
- mdb_warn("failed to read nce at %p\n", addr);
+ if (mdb_vread(&ncec, sizeof (ncec_t), addr) == -1) {
+ mdb_warn("failed to read ncec at %p\n", addr);
return (DCMD_ERR);
}
- if (ipversion != 0 && nce.nce_ipversion != ipversion) {
+ if (ipversion != 0 && ncec.ncec_ipversion != ipversion) {
mdb_printf("IP Version mismatch\n");
return (DCMD_ERR);
}
- nce_header(flags);
- return (nce_format(addr, &nce, ipversion));
+ ncec_header(flags);
+ return (ncec_format(addr, &ncec, ipversion));
} else {
- id.nce_addr = addr;
- id.nce_ipversion = ipversion;
- nce_header(flags);
- if (mdb_walk("nce", (mdb_walk_cb_t)nce_cb, &id) == -1) {
- mdb_warn("failed to walk nce table\n");
+ id.ncec_addr = addr;
+ id.ncec_ipversion = ipversion;
+ ncec_header(flags);
+ if (mdb_walk("ncec", (mdb_walk_cb_t)ncec_cb, &id) == -1) {
+ mdb_warn("failed to walk ncec table\n");
return (DCMD_ERR);
}
}
@@ -1601,10 +1931,10 @@ nce(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
}
static int
-nce_format(uintptr_t addr, const nce_t *nce, int ipversion)
+ncec_format(uintptr_t addr, const ncec_t *ncec, int ipversion)
{
- static const mdb_bitmask_t nce_flags[] = {
- { "P", NCE_F_PERMANENT, NCE_F_PERMANENT },
+ static const mdb_bitmask_t ncec_flags[] = {
+ { "P", NCE_F_NONUD, NCE_F_NONUD },
{ "R", NCE_F_ISROUTER, NCE_F_ISROUTER },
{ "N", NCE_F_NONUD, NCE_F_NONUD },
{ "A", NCE_F_ANYCAST, NCE_F_ANYCAST },
@@ -1613,15 +1943,15 @@ nce_format(uintptr_t addr, const nce_t *nce, int ipversion)
{ "B", NCE_F_BCAST, NCE_F_BCAST },
{ NULL, 0, 0 }
};
-#define NCE_MAX_FLAGS (sizeof (nce_flags) / sizeof (mdb_bitmask_t))
+#define NCE_MAX_FLAGS (sizeof (ncec_flags) / sizeof (mdb_bitmask_t))
struct in_addr nceaddr;
ill_t ill;
char ill_name[LIFNAMSIZ];
char flagsbuf[NCE_MAX_FLAGS];
- if (mdb_vread(&ill, sizeof (ill), (uintptr_t)nce->nce_ill) == -1) {
- mdb_warn("failed to read nce_ill at %p",
- nce->nce_ill);
+ if (mdb_vread(&ill, sizeof (ill), (uintptr_t)ncec->ncec_ill) == -1) {
+ mdb_warn("failed to read ncec_ill at %p",
+ ncec->ncec_ill);
return (DCMD_ERR);
}
@@ -1629,33 +1959,33 @@ nce_format(uintptr_t addr, const nce_t *nce, int ipversion)
(uintptr_t)ill.ill_name);
mdb_snprintf(flagsbuf, sizeof (flagsbuf), "%hb",
- nce->nce_flags, nce_flags);
+ ncec->ncec_flags, ncec_flags);
- if (ipversion != 0 && nce->nce_ipversion != ipversion)
+ if (ipversion != 0 && ncec->ncec_ipversion != ipversion)
return (DCMD_OK);
- if (nce->nce_ipversion == IPV4_VERSION) {
- IN6_V4MAPPED_TO_INADDR(&nce->nce_addr, &nceaddr);
+ if (ncec->ncec_ipversion == IPV4_VERSION) {
+ IN6_V4MAPPED_TO_INADDR(&ncec->ncec_addr, &nceaddr);
mdb_printf("%?p %-20s %-10s "
"%-8s "
"%-5s %I\n",
- addr, nce_l2_addr(nce, &ill),
- nce_state(nce->nce_state),
+ addr, ncec_l2_addr(ncec, &ill),
+ ncec_state(ncec->ncec_state),
flagsbuf,
ill_name, nceaddr.s_addr);
} else {
mdb_printf("%?p %-20s %-10s %-8s %-5s %N\n",
- addr, nce_l2_addr(nce, &ill),
- nce_state(nce->nce_state),
+ addr, ncec_l2_addr(ncec, &ill),
+ ncec_state(ncec->ncec_state),
flagsbuf,
- ill_name, &nce->nce_addr);
+ ill_name, &ncec->ncec_addr);
}
return (DCMD_OK);
}
static uintptr_t
-nce_get_next_hash_tbl(uintptr_t start, int *index, struct ndp_g_s ndp)
+ncec_get_next_hash_tbl(uintptr_t start, int *index, struct ndp_g_s ndp)
{
uintptr_t addr = start;
int i = *index;
@@ -1671,7 +2001,7 @@ nce_get_next_hash_tbl(uintptr_t start, int *index, struct ndp_g_s ndp)
}
static int
-nce_walk_step(mdb_walk_state_t *wsp)
+ncec_walk_step(mdb_walk_state_t *wsp)
{
uintptr_t kaddr4, kaddr6;
@@ -1686,15 +2016,15 @@ nce_walk_step(mdb_walk_state_t *wsp)
mdb_warn("can't read ips_ip_cache_table at %p", kaddr6);
return (WALK_ERR);
}
- if (mdb_pwalk("nce_stack", wsp->walk_callback, wsp->walk_cbdata,
+ if (mdb_pwalk("ncec_stack", wsp->walk_callback, wsp->walk_cbdata,
kaddr4) == -1) {
- mdb_warn("couldn't walk 'nce_stack' for ips_ndp4 %p",
+ mdb_warn("couldn't walk 'ncec_stack' for ips_ndp4 %p",
kaddr4);
return (WALK_ERR);
}
- if (mdb_pwalk("nce_stack", wsp->walk_callback,
+ if (mdb_pwalk("ncec_stack", wsp->walk_callback,
wsp->walk_cbdata, kaddr6) == -1) {
- mdb_warn("couldn't walk 'nce_stack' for ips_ndp6 %p",
+ mdb_warn("couldn't walk 'ncec_stack' for ips_ndp6 %p",
kaddr6);
return (WALK_ERR);
}
@@ -1743,7 +2073,7 @@ ipcl_hash_walk_init(mdb_walk_state_t *wsp)
mdb_free(iw, sizeof (ipcl_hash_walk_data_t));
return (WALK_ERR);
}
- if (arg->tbl_off == OFFSETOF(ip_stack_t, ips_ipcl_proto_fanout) ||
+ if (arg->tbl_off == OFFSETOF(ip_stack_t, ips_ipcl_proto_fanout_v4) ||
arg->tbl_off == OFFSETOF(ip_stack_t, ips_ipcl_proto_fanout_v6)) {
iw->hash_tbl_size = IPPROTO_MAX;
} else {
@@ -1809,72 +2139,75 @@ ipcl_hash_walk_fini(mdb_walk_state_t *wsp)
* Called with walk_addr being the address of ips_ndp{4,6}
*/
static int
-nce_stack_walk_init(mdb_walk_state_t *wsp)
+ncec_stack_walk_init(mdb_walk_state_t *wsp)
{
- nce_walk_data_t *nw;
+ ncec_walk_data_t *nw;
if (wsp->walk_addr == NULL) {
- mdb_warn("nce_stack requires ndp_g_s address\n");
+ mdb_warn("ncec_stack requires ndp_g_s address\n");
return (WALK_ERR);
}
- nw = mdb_alloc(sizeof (nce_walk_data_t), UM_SLEEP);
+ nw = mdb_alloc(sizeof (ncec_walk_data_t), UM_SLEEP);
- if (mdb_vread(&nw->nce_ip_ndp, sizeof (struct ndp_g_s),
+ if (mdb_vread(&nw->ncec_ip_ndp, sizeof (struct ndp_g_s),
wsp->walk_addr) == -1) {
mdb_warn("failed to read 'ip_ndp' at %p",
wsp->walk_addr);
- mdb_free(nw, sizeof (nce_walk_data_t));
+ mdb_free(nw, sizeof (ncec_walk_data_t));
return (WALK_ERR);
}
- nw->nce_hash_tbl_index = 0;
- wsp->walk_addr = nce_get_next_hash_tbl(NULL,
- &nw->nce_hash_tbl_index, nw->nce_ip_ndp);
+ /*
+ * ncec_get_next_hash_tbl() starts at ++i , so initialize index to -1
+ */
+ nw->ncec_hash_tbl_index = -1;
+ wsp->walk_addr = ncec_get_next_hash_tbl(NULL,
+ &nw->ncec_hash_tbl_index, nw->ncec_ip_ndp);
wsp->walk_data = nw;
return (WALK_NEXT);
}
static int
-nce_stack_walk_step(mdb_walk_state_t *wsp)
+ncec_stack_walk_step(mdb_walk_state_t *wsp)
{
uintptr_t addr = wsp->walk_addr;
- nce_walk_data_t *nw = wsp->walk_data;
+ ncec_walk_data_t *nw = wsp->walk_data;
if (addr == NULL)
return (WALK_DONE);
- if (mdb_vread(&nw->nce, sizeof (nce_t), addr) == -1) {
- mdb_warn("failed to read nce_t at %p", addr);
+ if (mdb_vread(&nw->ncec, sizeof (ncec_t), addr) == -1) {
+ mdb_warn("failed to read ncec_t at %p", addr);
return (WALK_ERR);
}
- wsp->walk_addr = (uintptr_t)nw->nce.nce_next;
+ wsp->walk_addr = (uintptr_t)nw->ncec.ncec_next;
- wsp->walk_addr = nce_get_next_hash_tbl(wsp->walk_addr,
- &nw->nce_hash_tbl_index, nw->nce_ip_ndp);
+ wsp->walk_addr = ncec_get_next_hash_tbl(wsp->walk_addr,
+ &nw->ncec_hash_tbl_index, nw->ncec_ip_ndp);
return (wsp->walk_callback(addr, nw, wsp->walk_cbdata));
}
static void
-nce_stack_walk_fini(mdb_walk_state_t *wsp)
+ncec_stack_walk_fini(mdb_walk_state_t *wsp)
{
- mdb_free(wsp->walk_data, sizeof (nce_walk_data_t));
+ mdb_free(wsp->walk_data, sizeof (ncec_walk_data_t));
}
/* ARGSUSED */
static int
-nce_cb(uintptr_t addr, const nce_walk_data_t *iw, nce_cbdata_t *id)
+ncec_cb(uintptr_t addr, const ncec_walk_data_t *iw, ncec_cbdata_t *id)
{
- nce_t nce;
+ ncec_t ncec;
- if (mdb_vread(&nce, sizeof (nce_t), addr) == -1) {
- mdb_warn("failed to read nce at %p", addr);
+ if (mdb_vread(&ncec, sizeof (ncec_t), addr) == -1) {
+ mdb_warn("failed to read ncec at %p", addr);
return (WALK_NEXT);
}
- (void) nce_format(addr, &nce, id->nce_ipversion);
+ (void) ncec_format(addr, &ncec, id->ncec_ipversion);
return (WALK_NEXT);
}
@@ -1918,6 +2251,11 @@ ill_cb(uintptr_t addr, const ill_walk_data_t *iw, ill_cbdata_t *id)
mdb_warn("failed to read ill at %p", addr);
return (WALK_NEXT);
}
+
+ /* If ip_stack_t is specified, skip ILLs that don't belong to it. */
+ if (id->ill_ipst != NULL && ill.ill_ipst != id->ill_ipst)
+ return (WALK_NEXT);
+
return (ill_format((uintptr_t)addr, &ill, id));
}
@@ -2013,7 +2351,7 @@ ill_format(uintptr_t addr, const void *illptr, void *ill_cb_arg)
break;
}
cnt = ill->ill_refcnt + ill->ill_ire_cnt + ill->ill_nce_cnt +
- ill->ill_ilm_walker_cnt + ill->ill_ilm_cnt;
+ ill->ill_ilm_cnt + ill->ill_ncec_cnt;
mdb_printf("%-?p %-8s %-3s ",
addr, ill_name, ill->ill_isv6 ? "v6" : "v4");
if (typebuf != NULL)
@@ -2035,11 +2373,10 @@ ill_format(uintptr_t addr, const void *illptr, void *ill_cb_arg)
strlen(sbuf), "", ill->ill_ire_cnt, "ill_ire_cnt");
mdb_printf("%*s %7d %-18s nces referencing this ill\n",
strlen(sbuf), "", ill->ill_nce_cnt, "ill_nce_cnt");
+ mdb_printf("%*s %7d %-18s ncecs referencing this ill\n",
+ strlen(sbuf), "", ill->ill_ncec_cnt, "ill_ncec_cnt");
mdb_printf("%*s %7d %-18s ilms referencing this ill\n",
strlen(sbuf), "", ill->ill_ilm_cnt, "ill_ilm_cnt");
- mdb_printf("%*s %7d %-18s active ilm walkers\n\n",
- strlen(sbuf), "", ill->ill_ilm_walker_cnt,
- "ill_ilm_walker_cnt");
} else {
mdb_printf("%4d %-?p %-llb\n",
cnt, ill->ill_wq,
@@ -2054,14 +2391,24 @@ ill(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
ill_t ill_data;
ill_cbdata_t id;
int ipversion = 0;
+ const char *zone_name = NULL;
const char *opt_P = NULL;
uint_t verbose = FALSE;
+ ip_stack_t *ipst = NULL;
if (mdb_getopts(argc, argv,
'v', MDB_OPT_SETBITS, TRUE, &verbose,
+ 's', MDB_OPT_STR, &zone_name,
'P', MDB_OPT_STR, &opt_P, NULL) != argc)
return (DCMD_USAGE);
+ /* Follow the specified zone name to find a ip_stack_t*. */
+ if (zone_name != NULL) {
+ ipst = zone_to_ips(zone_name);
+ if (ipst == NULL)
+ return (DCMD_USAGE);
+ }
+
if (opt_P != NULL) {
if (strcmp("v4", opt_P) == 0) {
ipversion = IPV4_VERSION;
@@ -2076,6 +2423,7 @@ ill(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
id.verbose = verbose;
id.ill_addr = addr;
id.ill_ipversion = ipversion;
+ id.ill_ipst = ipst;
ill_header(verbose);
if (flags & DCMD_ADDRSPEC) {
@@ -2254,7 +2602,6 @@ ipif_format(uintptr_t addr, const void *ipifptr, void *ipif_cb_arg)
{ "CO", IPIF_CONDEMNED, IPIF_CONDEMNED},
{ "CH", IPIF_CHANGING, IPIF_CHANGING},
{ "SL", IPIF_SET_LINKLOCAL, IPIF_SET_LINKLOCAL},
- { "ZS", IPIF_ZERO_SOURCE, IPIF_ZERO_SOURCE},
{ NULL, 0, 0 }
};
static const mdb_bitmask_t fmasks[] = {
@@ -2299,16 +2646,14 @@ ipif_format(uintptr_t addr, const void *ipifptr, void *ipif_cb_arg)
}
mdb_snprintf(bitfields, sizeof (bitfields), "%s",
ipif->ipif_addr_ready ? ",ADR" : "",
- ipif->ipif_multicast_up ? ",MU" : "",
ipif->ipif_was_up ? ",WU" : "",
- ipif->ipif_was_dup ? ",WD" : "",
- ipif->ipif_joined_allhosts ? ",JA" : "");
+ ipif->ipif_was_dup ? ",WD" : "");
mdb_snprintf(flagsbuf, sizeof (flagsbuf), "%llb%s",
ipif->ipif_flags, fmasks, bitfields);
mdb_snprintf(sflagsbuf, sizeof (sflagsbuf), "%b",
ipif->ipif_state_flags, sfmasks);
- cnt = ipif->ipif_refcnt + ipif->ipif_ire_cnt + ipif->ipif_ilm_cnt;
+ cnt = ipif->ipif_refcnt;
if (ipifcb->ill.ill_isv6) {
mdb_snprintf(addrstr, sizeof (addrstr), "%N",
@@ -2329,12 +2674,6 @@ ipif_format(uintptr_t addr, const void *ipifptr, void *ipif_cb_arg)
mdb_printf("%s |\n%s +---> %4d %-15s "
"Active consistent reader cnt\n",
sbuf, sbuf, ipif->ipif_refcnt, "ipif_refcnt");
- mdb_printf("%*s %10d %-15s "
- "Number of ire's referencing this ipif\n",
- strlen(sbuf), "", ipif->ipif_ire_cnt, "ipif_ire_cnt");
- mdb_printf("%*s %10d %-15s "
- "Number of ilm's referencing this ipif\n\n",
- strlen(sbuf), "", ipif->ipif_ilm_cnt, "ipif_ilm_cnt");
mdb_printf("%-s/%d\n",
addrstr, mask_to_prefixlen(af, &ipif->ipif_v6net_mask));
if (ipifcb->ill.ill_isv6) {
@@ -2473,16 +2812,16 @@ conn_status_cb(uintptr_t addr, const void *walk_data,
mdb_printf("%-?p %-?p %?d %?d\n", addr, conn->conn_wq,
nss.netstack_stackid, conn->conn_zoneid);
- if (conn->conn_af_isv6) {
+ if (conn->conn_family == AF_INET6) {
mdb_snprintf(src_addrstr, sizeof (rem_addrstr), "%N",
- &conn->conn_srcv6);
+ &conn->conn_laddr_v6);
mdb_snprintf(rem_addrstr, sizeof (rem_addrstr), "%N",
- &conn->conn_remv6);
+ &conn->conn_faddr_v6);
} else {
mdb_snprintf(src_addrstr, sizeof (src_addrstr), "%I",
- V4_PART_OF_V6((conn->conn_srcv6)));
+ V4_PART_OF_V6((conn->conn_laddr_v6)));
mdb_snprintf(rem_addrstr, sizeof (rem_addrstr), "%I",
- V4_PART_OF_V6((conn->conn_remv6)));
+ V4_PART_OF_V6((conn->conn_faddr_v6)));
}
mdb_printf("%s:%-5d\n%s:%-5d\n",
src_addrstr, conn->conn_lport, rem_addrstr, conn->conn_fport);
@@ -2519,7 +2858,7 @@ conn_status_help(void)
{
mdb_printf("Prints conn_t structures from the following hash tables: "
"\n\tips_ipcl_udp_fanout\n\tips_ipcl_bind_fanout"
- "\n\tips_ipcl_conn_fanout\n\tips_ipcl_proto_fanout"
+ "\n\tips_ipcl_conn_fanout\n\tips_ipcl_proto_fanout_v4"
"\n\tips_ipcl_proto_fanout_v6\n");
}
diff --git a/usr/src/cmd/mdb/common/modules/sctp/sctp.c b/usr/src/cmd/mdb/common/modules/sctp/sctp.c
index 05f0c385c8..4165a56ca4 100644
--- a/usr/src/cmd/mdb/common/modules/sctp/sctp.c
+++ b/usr/src/cmd/mdb/common/modules/sctp/sctp.c
@@ -20,12 +20,10 @@
*/
/*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <sys/types.h>
#include <sys/stream.h>
#include <sys/mdb_modapi.h>
@@ -164,7 +162,7 @@ sctp_faddr(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
mdb_printf("lastactive\t%?ld\thb_secret\t%?#lx\n", fa->lastactive,
fa->hb_secret);
mdb_printf("rxt_unacked\t%?u\n", fa->rxt_unacked);
- mdb_printf("timer_mp\t%?p\tire\t\t%?p\n", fa->timer_mp, fa->ire);
+ mdb_printf("timer_mp\t%?p\tixa\t\t%?p\n", fa->timer_mp, fa->ixa);
mdb_printf("hb_enabled\t%?d\thb_pending\t%?d\n"
"timer_running\t%?d\tdf\t\t%?d\n"
"pmtu_discovered\t%?d\tisv4\t\t%?d\n"
@@ -566,11 +564,12 @@ show_sctp_flags(sctp_t *sctp)
{
mdb_printf("\tunderstands_asconf\t%d\n",
sctp->sctp_understands_asconf);
- mdb_printf("\tdebug\t\t\t%d\n", sctp->sctp_debug);
+ mdb_printf("\tdebug\t\t\t%d\n", sctp->sctp_connp->conn_debug);
mdb_printf("\tcchunk_pend\t\t%d\n", sctp->sctp_cchunk_pend);
- mdb_printf("\tdgram_errind\t\t%d\n", sctp->sctp_dgram_errind);
+ mdb_printf("\tdgram_errind\t\t%d\n",
+ sctp->sctp_connp->conn_dgram_errind);
- mdb_printf("\tlinger\t\t\t%d\n", sctp->sctp_linger);
+ mdb_printf("\tlinger\t\t\t%d\n", sctp->sctp_connp->conn_linger);
if (sctp->sctp_lingering)
return;
mdb_printf("\tlingering\t\t%d\n", sctp->sctp_lingering);
@@ -578,7 +577,8 @@ show_sctp_flags(sctp_t *sctp)
mdb_printf("\tforce_sack\t\t%d\n", sctp->sctp_force_sack);
mdb_printf("\tack_timer_runing\t%d\n", sctp->sctp_ack_timer_running);
- mdb_printf("\trecvdstaddr\t\t%d\n", sctp->sctp_recvdstaddr);
+ mdb_printf("\trecvdstaddr\t\t%d\n",
+ sctp->sctp_connp->conn_recv_ancillary.crb_recvdstaddr);
mdb_printf("\thwcksum\t\t\t%d\n", sctp->sctp_hwcksum);
mdb_printf("\tunderstands_addip\t%d\n", sctp->sctp_understands_addip);
@@ -654,8 +654,8 @@ print_saddr(uintptr_t ptr, const void *addr, void *cbdata)
if (saddr->saddr_ipif_delete_pending == 1)
mdb_printf("/DeletePending");
mdb_printf(")\n");
- mdb_printf("\t\t\tMTU %d id %d zoneid %d IPIF flags %x\n",
- ipif.sctp_ipif_mtu, ipif.sctp_ipif_id,
+ mdb_printf("\t\t\tid %d zoneid %d IPIF flags %x\n",
+ ipif.sctp_ipif_id,
ipif.sctp_ipif_zoneid, ipif.sctp_ipif_flags);
return (WALK_NEXT);
}
@@ -682,8 +682,8 @@ print_faddr(uintptr_t ptr, const void *addr, void *cbdata)
int
sctp(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
{
- sctp_t sctp;
- conn_t connp;
+ sctp_t sctps, *sctp;
+ conn_t conns, *connp;
int i;
uint_t opts = 0;
uint_t paddr = 0;
@@ -692,16 +692,23 @@ sctp(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
if (!(flags & DCMD_ADDRSPEC))
return (DCMD_USAGE);
- if (mdb_vread(&sctp, sizeof (sctp), addr) == -1) {
+ if (mdb_vread(&sctps, sizeof (sctps), addr) == -1) {
mdb_warn("failed to read sctp_t at: %p\n", addr);
return (DCMD_ERR);
}
- if (mdb_vread(&connp, sizeof (connp),
- (uintptr_t)sctp.sctp_connp) == -1) {
- mdb_warn("failed to read conn_t at: %p\n", sctp.sctp_connp);
+ sctp = &sctps;
+
+ if (mdb_vread(&conns, sizeof (conns),
+ (uintptr_t)sctp->sctp_connp) == -1) {
+ mdb_warn("failed to read conn_t at: %p\n", sctp->sctp_connp);
return (DCMD_ERR);
}
+ connp = &conns;
+
+ connp->conn_sctp = sctp;
+ sctp->sctp_connp = connp;
+
if (mdb_getopts(argc, argv,
'a', MDB_OPT_SETBITS, MDB_SCTP_SHOW_ALL, &opts,
'f', MDB_OPT_SETBITS, MDB_SCTP_SHOW_FLAGS, &opts,
@@ -726,7 +733,7 @@ sctp(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
/* non-verbose faddrs, suitable for pipelines to sctp_faddr */
if (paddr != 0) {
sctp_faddr_t faddr, *fp;
- for (fp = sctp.sctp_faddrs; fp != NULL; fp = faddr.next) {
+ for (fp = sctp->sctp_faddrs; fp != NULL; fp = faddr.next) {
if (mdb_vread(&faddr, sizeof (faddr), (uintptr_t)fp)
== -1) {
mdb_warn("failed to read faddr at %p",
@@ -738,16 +745,16 @@ sctp(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
return (DCMD_OK);
}
- mdb_nhconvert(&lport, &sctp.sctp_lport, sizeof (lport));
- mdb_nhconvert(&fport, &sctp.sctp_fport, sizeof (fport));
+ mdb_nhconvert(&lport, &connp->conn_lport, sizeof (lport));
+ mdb_nhconvert(&fport, &connp->conn_fport, sizeof (fport));
mdb_printf("%<u>%p% %22s S=%-6hu D=%-6hu% STACK=%d ZONE=%d%</u>", addr,
- state2str(&sctp), lport, fport,
- ns_to_stackid((uintptr_t)connp.conn_netstack), connp.conn_zoneid);
+ state2str(sctp), lport, fport,
+ ns_to_stackid((uintptr_t)connp->conn_netstack), connp->conn_zoneid);
- if (sctp.sctp_faddrs) {
+ if (sctp->sctp_faddrs) {
sctp_faddr_t faddr;
if (mdb_vread(&faddr, sizeof (faddr),
- (uintptr_t)sctp.sctp_faddrs) != -1)
+ (uintptr_t)sctp->sctp_faddrs) != -1)
mdb_printf("%<u> %N%</u>", &faddr.faddr);
}
mdb_printf("\n");
@@ -756,78 +763,78 @@ sctp(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
mdb_printf("%<b>Local and Peer Addresses%</b>\n");
/* Display source addresses */
- mdb_printf("nsaddrs\t\t%?d\n", sctp.sctp_nsaddrs);
+ mdb_printf("nsaddrs\t\t%?d\n", sctp->sctp_nsaddrs);
(void) mdb_pwalk("sctp_walk_saddr", print_saddr, NULL, addr);
/* Display peer addresses */
- mdb_printf("nfaddrs\t\t%?d\n", sctp.sctp_nfaddrs);
+ mdb_printf("nfaddrs\t\t%?d\n", sctp->sctp_nfaddrs);
i = 1;
(void) mdb_pwalk("sctp_walk_faddr", print_faddr, &i, addr);
mdb_printf("lastfaddr\t%?p\tprimary\t\t%?p\n",
- sctp.sctp_lastfaddr, sctp.sctp_primary);
+ sctp->sctp_lastfaddr, sctp->sctp_primary);
mdb_printf("current\t\t%?p\tlastdata\t%?p\n",
- sctp.sctp_current, sctp.sctp_lastdata);
+ sctp->sctp_current, sctp->sctp_lastdata);
}
if (opts & MDB_SCTP_SHOW_OUT) {
mdb_printf("%<b>Outbound Data%</b>\n");
mdb_printf("xmit_head\t%?p\txmit_tail\t%?p\n",
- sctp.sctp_xmit_head, sctp.sctp_xmit_tail);
+ sctp->sctp_xmit_head, sctp->sctp_xmit_tail);
mdb_printf("xmit_unsent\t%?p\txmit_unsent_tail%?p\n",
- sctp.sctp_xmit_unsent, sctp.sctp_xmit_unsent_tail);
- mdb_printf("xmit_unacked\t%?p\n", sctp.sctp_xmit_unacked);
+ sctp->sctp_xmit_unsent, sctp->sctp_xmit_unsent_tail);
+ mdb_printf("xmit_unacked\t%?p\n", sctp->sctp_xmit_unacked);
mdb_printf("unacked\t\t%?u\tunsent\t\t%?ld\n",
- sctp.sctp_unacked, sctp.sctp_unsent);
+ sctp->sctp_unacked, sctp->sctp_unsent);
mdb_printf("ltsn\t\t%?x\tlastack_rxd\t%?x\n",
- sctp.sctp_ltsn, sctp.sctp_lastack_rxd);
+ sctp->sctp_ltsn, sctp->sctp_lastack_rxd);
mdb_printf("recovery_tsn\t%?x\tadv_pap\t\t%?x\n",
- sctp.sctp_recovery_tsn, sctp.sctp_adv_pap);
+ sctp->sctp_recovery_tsn, sctp->sctp_adv_pap);
mdb_printf("num_ostr\t%?hu\tostrcntrs\t%?p\n",
- sctp.sctp_num_ostr, sctp.sctp_ostrcntrs);
+ sctp->sctp_num_ostr, sctp->sctp_ostrcntrs);
mdb_printf("pad_mp\t\t%?p\terr_chunks\t%?p\n",
- sctp.sctp_pad_mp, sctp.sctp_err_chunks);
- mdb_printf("err_len\t\t%?u\n", sctp.sctp_err_len);
+ sctp->sctp_pad_mp, sctp->sctp_err_chunks);
+ mdb_printf("err_len\t\t%?u\n", sctp->sctp_err_len);
mdb_printf("%<b>Default Send Parameters%</b>\n");
mdb_printf("def_stream\t%?u\tdef_flags\t%?x\n",
- sctp.sctp_def_stream, sctp.sctp_def_flags);
+ sctp->sctp_def_stream, sctp->sctp_def_flags);
mdb_printf("def_ppid\t%?x\tdef_context\t%?x\n",
- sctp.sctp_def_ppid, sctp.sctp_def_context);
+ sctp->sctp_def_ppid, sctp->sctp_def_context);
mdb_printf("def_timetolive\t%?u\n",
- sctp.sctp_def_timetolive);
+ sctp->sctp_def_timetolive);
}
if (opts & MDB_SCTP_SHOW_IN) {
mdb_printf("%<b>Inbound Data%</b>\n");
mdb_printf("sack_info\t%?p\tsack_gaps\t%?d\n",
- sctp.sctp_sack_info, sctp.sctp_sack_gaps);
- dump_sack_info((uintptr_t)sctp.sctp_sack_info);
+ sctp->sctp_sack_info, sctp->sctp_sack_gaps);
+ dump_sack_info((uintptr_t)sctp->sctp_sack_info);
mdb_printf("ftsn\t\t%?x\tlastacked\t%?x\n",
- sctp.sctp_ftsn, sctp.sctp_lastacked);
+ sctp->sctp_ftsn, sctp->sctp_lastacked);
mdb_printf("istr_nmsgs\t%?d\tsack_toggle\t%?d\n",
- sctp.sctp_istr_nmsgs, sctp.sctp_sack_toggle);
- mdb_printf("ack_mp\t\t%?p\n", sctp.sctp_ack_mp);
+ sctp->sctp_istr_nmsgs, sctp->sctp_sack_toggle);
+ mdb_printf("ack_mp\t\t%?p\n", sctp->sctp_ack_mp);
mdb_printf("num_istr\t%?hu\tinstr\t\t%?p\n",
- sctp.sctp_num_istr, sctp.sctp_instr);
- mdb_printf("unord_reass\t%?p\n", sctp.sctp_uo_frags);
+ sctp->sctp_num_istr, sctp->sctp_instr);
+ mdb_printf("unord_reass\t%?p\n", sctp->sctp_uo_frags);
}
if (opts & MDB_SCTP_SHOW_RTT) {
mdb_printf("%<b>RTT Tracking%</b>\n");
mdb_printf("rtt_tsn\t\t%?x\tout_time\t%?ld\n",
- sctp.sctp_rtt_tsn, sctp.sctp_out_time);
+ sctp->sctp_rtt_tsn, sctp->sctp_out_time);
}
if (opts & MDB_SCTP_SHOW_FLOW) {
mdb_printf("%<b>Flow Control%</b>\n");
- mdb_printf("txmit_hiwater\t%?d\n"
- "xmit_lowater\t%?d\tfrwnd\t\t%?u\n"
+ mdb_printf("tconn_sndbuf\t%?d\n"
+ "conn_sndlowat\t%?d\tfrwnd\t\t%?u\n"
"rwnd\t\t%?u\tinitial rwnd\t%?u\n"
- "rxqueued\t%?u\tcwnd_max\t%?u\n", sctp.sctp_xmit_hiwater,
- sctp.sctp_xmit_lowater, sctp.sctp_frwnd,
- sctp.sctp_rwnd, sctp.sctp_irwnd, sctp.sctp_rxqueued,
- sctp.sctp_cwnd_max);
+ "rxqueued\t%?u\tcwnd_max\t%?u\n", connp->conn_sndbuf,
+ connp->conn_sndlowat, sctp->sctp_frwnd,
+ sctp->sctp_rwnd, sctp->sctp_irwnd, sctp->sctp_rxqueued,
+ sctp->sctp_cwnd_max);
}
if (opts & MDB_SCTP_SHOW_HDR) {
@@ -838,21 +845,21 @@ sctp(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
"ipha\t\t%?p\tip6h\t\t%?p\n"
"ip_hdr_len\t%?d\tip_hdr6_len\t%?d\n"
"sctph\t\t%?p\tsctph6\t\t%?p\n"
- "lvtag\t\t%?x\tfvtag\t\t%?x\n", sctp.sctp_iphc,
- sctp.sctp_iphc6, sctp.sctp_iphc_len,
- sctp.sctp_iphc6_len, sctp.sctp_hdr_len,
- sctp.sctp_hdr6_len, sctp.sctp_ipha, sctp.sctp_ip6h,
- sctp.sctp_ip_hdr_len, sctp.sctp_ip_hdr6_len,
- sctp.sctp_sctph, sctp.sctp_sctph6, sctp.sctp_lvtag,
- sctp.sctp_fvtag);
+ "lvtag\t\t%?x\tfvtag\t\t%?x\n", sctp->sctp_iphc,
+ sctp->sctp_iphc6, sctp->sctp_iphc_len,
+ sctp->sctp_iphc6_len, sctp->sctp_hdr_len,
+ sctp->sctp_hdr6_len, sctp->sctp_ipha, sctp->sctp_ip6h,
+ sctp->sctp_ip_hdr_len, sctp->sctp_ip_hdr6_len,
+ sctp->sctp_sctph, sctp->sctp_sctph6, sctp->sctp_lvtag,
+ sctp->sctp_fvtag);
}
if (opts & MDB_SCTP_SHOW_PMTUD) {
mdb_printf("%<b>PMTUd%</b>\n");
mdb_printf("last_mtu_probe\t%?ld\tmtu_probe_intvl\t%?ld\n"
"mss\t\t%?u\n",
- sctp.sctp_last_mtu_probe, sctp.sctp_mtu_probe_intvl,
- sctp.sctp_mss);
+ sctp->sctp_last_mtu_probe, sctp->sctp_mtu_probe_intvl,
+ sctp->sctp_mss);
}
if (opts & MDB_SCTP_SHOW_RXT) {
@@ -862,33 +869,33 @@ sctp(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
"pp_max_rxt\t%?d\trto_max\t\t%?u\n"
"rto_min\t\t%?u\trto_initial\t%?u\n"
"init_rto_max\t%?u\n"
- "rxt_nxttsn\t%?u\trxt_maxtsn\t%?u\n", sctp.sctp_cookie_mp,
- sctp.sctp_strikes, sctp.sctp_max_init_rxt,
- sctp.sctp_pa_max_rxt, sctp.sctp_pp_max_rxt,
- sctp.sctp_rto_max, sctp.sctp_rto_min,
- sctp.sctp_rto_initial, sctp.sctp_init_rto_max,
- sctp.sctp_rxt_nxttsn, sctp.sctp_rxt_maxtsn);
+ "rxt_nxttsn\t%?u\trxt_maxtsn\t%?u\n", sctp->sctp_cookie_mp,
+ sctp->sctp_strikes, sctp->sctp_max_init_rxt,
+ sctp->sctp_pa_max_rxt, sctp->sctp_pp_max_rxt,
+ sctp->sctp_rto_max, sctp->sctp_rto_min,
+ sctp->sctp_rto_initial, sctp->sctp_init_rto_max,
+ sctp->sctp_rxt_nxttsn, sctp->sctp_rxt_maxtsn);
}
if (opts & MDB_SCTP_SHOW_CONN) {
mdb_printf("%<b>Connection State%</b>\n");
mdb_printf("last_secret_update%?ld\n",
- sctp.sctp_last_secret_update);
+ sctp->sctp_last_secret_update);
mdb_printf("secret\t\t");
for (i = 0; i < SCTP_SECRET_LEN; i++) {
if (i % 2 == 0)
- mdb_printf("0x%02x", sctp.sctp_secret[i]);
+ mdb_printf("0x%02x", sctp->sctp_secret[i]);
else
- mdb_printf("%02x ", sctp.sctp_secret[i]);
+ mdb_printf("%02x ", sctp->sctp_secret[i]);
}
mdb_printf("\n");
mdb_printf("old_secret\t");
for (i = 0; i < SCTP_SECRET_LEN; i++) {
if (i % 2 == 0)
- mdb_printf("0x%02x", sctp.sctp_old_secret[i]);
+ mdb_printf("0x%02x", sctp->sctp_old_secret[i]);
else
- mdb_printf("%02x ", sctp.sctp_old_secret[i]);
+ mdb_printf("%02x ", sctp->sctp_old_secret[i]);
}
mdb_printf("\n");
}
@@ -901,40 +908,40 @@ sctp(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
"T2expire\t%?lu\tT3expire\t%?lu\n"
"msgcount\t%?llu\tprsctpdrop\t%?llu\n"
"AssocStartTime\t%?lu\n",
- sctp.sctp_opkts, sctp.sctp_obchunks,
- sctp.sctp_odchunks, sctp.sctp_oudchunks,
- sctp.sctp_rxtchunks, sctp.sctp_T1expire,
- sctp.sctp_T2expire, sctp.sctp_T3expire,
- sctp.sctp_msgcount, sctp.sctp_prsctpdrop,
- sctp.sctp_assoc_start_time);
+ sctp->sctp_opkts, sctp->sctp_obchunks,
+ sctp->sctp_odchunks, sctp->sctp_oudchunks,
+ sctp->sctp_rxtchunks, sctp->sctp_T1expire,
+ sctp->sctp_T2expire, sctp->sctp_T3expire,
+ sctp->sctp_msgcount, sctp->sctp_prsctpdrop,
+ sctp->sctp_assoc_start_time);
mdb_printf("ipkts\t\t%?llu\tibchunks\t%?llu\n"
"idchunks\t%?llu\tiudchunks\t%?llu\n"
"fragdmsgs\t%?llu\treassmsgs\t%?llu\n",
- sctp.sctp_ipkts, sctp.sctp_ibchunks,
- sctp.sctp_idchunks, sctp.sctp_iudchunks,
- sctp.sctp_fragdmsgs, sctp.sctp_reassmsgs);
+ sctp->sctp_ipkts, sctp->sctp_ibchunks,
+ sctp->sctp_idchunks, sctp->sctp_iudchunks,
+ sctp->sctp_fragdmsgs, sctp->sctp_reassmsgs);
}
if (opts & MDB_SCTP_SHOW_HASH) {
mdb_printf("%<b>Hash Tables%</b>\n");
- mdb_printf("conn_hash_next\t%?p\t", sctp.sctp_conn_hash_next);
- mdb_printf("conn_hash_prev\t%?p\n", sctp.sctp_conn_hash_prev);
+ mdb_printf("conn_hash_next\t%?p\t", sctp->sctp_conn_hash_next);
+ mdb_printf("conn_hash_prev\t%?p\n", sctp->sctp_conn_hash_prev);
mdb_printf("listen_hash_next%?p\t",
- sctp.sctp_listen_hash_next);
+ sctp->sctp_listen_hash_next);
mdb_printf("listen_hash_prev%?p\n",
- sctp.sctp_listen_hash_prev);
- mdb_nhconvert(&lport, &sctp.sctp_lport, sizeof (lport));
+ sctp->sctp_listen_hash_prev);
+ mdb_nhconvert(&lport, &connp->conn_lport, sizeof (lport));
mdb_printf("[ listen_hash bucket\t%?d ]\n",
SCTP_LISTEN_HASH(lport));
- mdb_printf("conn_tfp\t%?p\t", sctp.sctp_conn_tfp);
- mdb_printf("listen_tfp\t%?p\n", sctp.sctp_listen_tfp);
+ mdb_printf("conn_tfp\t%?p\t", sctp->sctp_conn_tfp);
+ mdb_printf("listen_tfp\t%?p\n", sctp->sctp_listen_tfp);
mdb_printf("bind_hash\t%?p\tptpbhn\t\t%?p\n",
- sctp.sctp_bind_hash, sctp.sctp_ptpbhn);
+ sctp->sctp_bind_hash, sctp->sctp_ptpbhn);
mdb_printf("bind_lockp\t%?p\n",
- sctp.sctp_bind_lockp);
+ sctp->sctp_bind_lockp);
mdb_printf("[ bind_hash bucket\t%?d ]\n",
SCTP_BIND_HASH(lport));
}
@@ -943,8 +950,8 @@ sctp(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
mdb_printf("%<b>Cleanup / Close%</b>\n");
mdb_printf("shutdown_faddr\t%?p\tclient_errno\t%?d\n"
"lingertime\t%?d\trefcnt\t\t%?hu\n",
- sctp.sctp_shutdown_faddr, sctp.sctp_client_errno,
- sctp.sctp_lingertime, sctp.sctp_refcnt);
+ sctp->sctp_shutdown_faddr, sctp->sctp_client_errno,
+ connp->conn_lingertime, sctp->sctp_refcnt);
}
if (opts & MDB_SCTP_SHOW_MISC) {
@@ -955,24 +962,25 @@ sctp(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
"active\t\t%?ld\ttx_adaptation_code%?x\n"
"rx_adaptation_code%?x\ttimer_mp\t%?p\n"
"partial_delivery_point\t%?d\n",
- sctp.sctp_bound_if, sctp.sctp_heartbeat_mp,
- sctp.sctp_family, sctp.sctp_ipversion,
- sctp.sctp_hb_interval, sctp.sctp_autoclose,
- sctp.sctp_active, sctp.sctp_tx_adaptation_code,
- sctp.sctp_rx_adaptation_code, sctp.sctp_timer_mp,
- sctp.sctp_pd_point);
+ connp->conn_bound_if, sctp->sctp_heartbeat_mp,
+ connp->conn_family,
+ connp->conn_ipversion,
+ sctp->sctp_hb_interval, sctp->sctp_autoclose,
+ sctp->sctp_active, sctp->sctp_tx_adaptation_code,
+ sctp->sctp_rx_adaptation_code, sctp->sctp_timer_mp,
+ sctp->sctp_pd_point);
}
if (opts & MDB_SCTP_SHOW_EXT) {
mdb_printf("%<b>Extensions and Reliable Ctl Chunks%</b>\n");
mdb_printf("cxmit_list\t%?p\tlcsn\t\t%?x\n"
- "fcsn\t\t%?x\n", sctp.sctp_cxmit_list, sctp.sctp_lcsn,
- sctp.sctp_fcsn);
+ "fcsn\t\t%?x\n", sctp->sctp_cxmit_list, sctp->sctp_lcsn,
+ sctp->sctp_fcsn);
}
if (opts & MDB_SCTP_SHOW_FLAGS) {
mdb_printf("%<b>Flags%</b>\n");
- show_sctp_flags(&sctp);
+ show_sctp_flags(sctp);
}
return (DCMD_OK);