summaryrefslogtreecommitdiff
path: root/usr/src/cmd
diff options
context:
space:
mode:
authorErik Nordmark <Erik.Nordmark@Sun.COM>2009-11-11 11:49:49 -0800
committerErik Nordmark <Erik.Nordmark@Sun.COM>2009-11-11 11:49:49 -0800
commitbd670b35a010421b6e1a5536c34453a827007c81 (patch)
tree97c2057b6771dd40411a12eb89d2db2e2b2cce31 /usr/src/cmd
parentb3388e4fc5f5c24c8a39fbe132a00b02dae5b717 (diff)
downloadillumos-joyent-bd670b35a010421b6e1a5536c34453a827007c81.tar.gz
PSARC/2009/331 IP Datapath Refactoring
PSARC/2008/522 EOF of 2001/070 IPsec HW Acceleration support PSARC/2009/495 netstat -r flags for blackhole and reject routes PSARC 2009/496 EOF of XRESOLV PSARC/2009/494 IP_DONTFRAG socket option PSARC/2009/515 fragmentation controls for ping and traceroute 6798716 ip_newroute delenda est 6798739 ARP and IP are too separate 6807265 IPv4 ip2mac() support 6756382 Please remove Venus IPsec HWACCEL code 6880632 sendto/sendmsg never returns EHOSTUNREACH in Solaris 6748582 sendmsg() return OK, but doesn't send message using IPv4-mapped x IPv6 addr 1119790 TCP and path mtu discovery 4637227 should support equal-cost multi-path (ECMP) 5078568 getsockopt() for IPV6_PATHMTU on a non-connected socket should not succeed 6419648 "AR* contract private note" should be removed as part of ATM SW EOL 6274715 Arp could keep the old entry in the cache while it waits for an arp response 6605615 Remove duplicated TCP/IP opt_set/opt_get code; use conn_t 6874677 IP_TTL can be used to send with ttl zero 4034090 arp should not let you delete your own entry 6882140 Implement IP_DONTFRAG socket option 6883858 Implement ping -D option; traceroute -F should work for IPv6 and shared-IP zones 1119792 TCP/IP black hole detection is broken on receiver 4078796 Directed broadcast forwarding code has problems 4104337 restrict the IPPROTO_IP and IPPROTO_IPV6 options based on the socket family 4203747 Source address selection for source routed packets 4230259 pmtu is increased every ip_ire_pathmtu_interval timer value. 4300533 When sticky option ipv6_pktinfo set to bogus address subsequent connect time out 4471035 ire_delete_cache_gw is called through ire_walk unnecessarily 4514572 SO_DONTROUTE socket option doesn't work with IPv6 4524980 tcp_lookup_ipv4() should compare the ifindex against tcpb->tcpb_bound_if 4532714 machine fails to switch quickly among failed default routes 4634219 IPv6 path mtu discovery is broken when using routing header 4691581 udp broadcast handling causes too many replicas 4708405 mcast is broken on machines when all interfaces are IFF_POINTOPOINT 4770457 netstat/route: source address of interface routes pretends to be gateway address 4786974 use routing table to determine routes/interface for multicast 4792619 An ip_fanout_udp_ipc_v6() routine might lead to some simpler code 4816115 Nuke ipsec_out_use_global_policy 4862844 ipsec offload corner case 4867533 tcp_rq and tcp_wq are redundant 4868589 NCEs should be shared across an IPMP group 4872093 unplumbing an improper virtual interface panics in ip_newroute_get_dst_ill() 4901671 FireEngine needs some cleanup 4907617 IPsec identity latching should be done before sending SYN-ACK 4941461 scopeid and IPV6_PKTINFO with UDP/ICMP connect() does not work properly 4944981 ip does nothing with IP6I_NEXTHOP 4963353 IPv4 and IPv6 proto fanout codes could be brought closer 4963360 consider passing zoneid using ip6i_t instead of ipsec_out_t in NDP 4963734 new ip6_asp locking is used incorrectly in ip_newroute_v6() 5008315 IPv6 code passes ip6i_t to IPsec code instead of ip6_t 5009636 memory leak in ip_fanout_proto_v6() 5092337 tcp/udp option handling can use some cleanup 5035841 Solaris can fail to create a valid broadcast ire 5043747 ar_query_xmit: Could not find the ace 5051574 tcp_check_policy is missing some checks 6305037 full hardware checksum is discarded when there're more than 2 mblks in the chain 6311149 ip.c needs to be put through a woodchipper 4708860 Unable to reassemble CGTP fragmented multicast packets 6224628 Large IPv6 packets with IPsec protection sometimes have length mismatch. 6213243 Solaris does not currently support Dead Gateway Detection 5029091 duplicate code in IP's input path for TCP/UDP/SCTP 4674643 through IPv6 CGTP routes, the very first packet is sent only after a while 6207318 Multiple default routes do not round robin connections to routers. 4823410 IP has an inconsistent view of link mtu 5105520 adding interface route to down interface causes ifconfig hang 5105707 advanced sockets API introduced some dead code 6318399 IP option handling for icmp and udp is too complicated 6321434 Every dropped packet in IP should use ip_drop_packet() 6341693 ifconfig mtu should operate on the physical interface, not individual ipif's 6352430 The credentials attached to an mblk are not particularly useful 6357894 uninitialised ipp_hoplimit needs to be cleaned up. 6363568 ip_xmit_v6() may be missing IRE releases in error cases 6364828 ip_rput_forward needs a makeover 6384416 System panics when running as multicast forwarder using multicast tunnels 6402382 TX: UDP v6 slowpath is not modified to handle mac_exempt conns 6418413 assertion failed ipha->ipha_ident == 0||ipha->ipha_ident == 0xFFFF 6420916 assertion failures in ipv6 wput path 6430851 use of b_prev to store ifindex is not 100% safe 6446106 IPv6 packets stored in nce->nce_qd_mp will be sent with incorrect tcp/udp checksums 6453711 SCTP OOTB sent as if genetated by global zone 6465212 ARP/IP merge should remove ire_freemblk.esballoc 6490163 ip_input() could misbehave if the first mblk's size is not big enough 6496664 missing ipif_refrele leads to reference leak and deferred crash in ip_wput_ipsec_out_v6 6504856 memory leak in ip_fanout_proto_v6() when using link local outer tunnel addresses 6507765 IRE cache hash function performs badly 6510186 IP_FORWARD_PROG bit is easily overlooked 6514727 cgtp ipv6 failure on snv54 6528286 MULTIRT (CGTP) should offload checksum to hardware 6533904 SCTP: doesn't support traffic class for IPv6 6539415 TX: ipif source selection is flawed for unlabeled gateways 6539851 plumbed unworking nic blocks sending broadcast packets 6564468 non-solaris SCTP stack over rawip socket: netstat command counts rawipInData not rawipOutDatagrams 6568511 ipIfStatsOutDiscards not bumped when discarding an ipsec packet on the wrong NIC 6584162 tcp_g_q_inactive() makes incorrect use of taskq_dispatch() 6603974 round-robin default with many interfaces causes infinite temporary IRE thrashing 6611750 ilm_lookup_ill_index_v4 was born an orphan 6618423 ip_wput_frag_mdt sends out packets that void pfhooks 6620964 IRE max bucket count calculations performed in ip_ire_init() are flawed 6626266 various _broadcasts seem redundant 6638182 IP_PKTINFO + SO_DONTROUTE + CIPSO IP option == panic 6647710 IPv6 possible DoS vulnerability 6657357 nce should be kmem_cache alloc'ed from an nce_cache. 6685131 ilg_add -> conn_ilg_alloc interacting with conn_ilg[] walkers can cause panic. 6730298 adding 0.0.0.0 key with mask != 0 causes 'route delete default' to fail 6730976 vni and ipv6 doesn't quite work. 6740956 assertion failed: mp->b_next == 0L && mp->b_prev == 0L in nce_queue_mp_common() 6748515 BUMP_MIB() is occasionally done on the wrong ill 6753250 ip_output_v6() `notv6' error path has an errant ill_refrele() 6756411 NULL-pointer dereference in ip_wput_local() 6769582 IP must forward packet returned from FW-HOOK 6781525 bogus usesrc usage leads directly to panic 6422839 System paniced in ip_multicast_loopback due to NULL pointer dereference 6785521 initial IPv6 DAD solicitation is dropped in ip_newroute_ipif_v6() 6787370 ipnet devices not seeing forwarded IP packets on outgoing interface 6791187 ip*dbg() calls in ip_output_options() claim to originate from ip_wput() 6794047 nce_fp_mp prevents sharing of NCEs across an IPMP group 6797926 many unnecessary ip0dbg() in ip_rput_data_v6 6846919 Packet queued for ND gets sent in the clear. 6856591 ping doesn't send packets with DF set 6861113 arp module has incorrect dependency path for hook module 6865664 IPV6_NEXTHOP does not work with TCP socket 6874681 No ICMP time exceeded when a router receives packet with ttl = 0 6880977 ip_wput_ire() uses over 1k of stack 6595433 IPsec performance could be significantly better when calling hw crypto provider synchronously 6848397 ifconfig down of an interface can hang. 6849602 IPV6_PATHMTU size issue for UDP 6885359 Add compile-time option for testing pure IPsec overhead 6889268 Odd loopback source address selection with IPMP 6895420 assertion failed: connp->conn_helper_info == NULL 6851189 Routing-related panic occurred during reboot on T2000 system running snv_117 6896174 Post-async-encryption, AH+ESP packets may have misinitialized ipha/ip6 6896687 iptun presents IPv6 with an MTU < 1280 6897006 assertion failed: ipif->ipif_id != 0 in ip_sioctl_slifzone_restart
Diffstat (limited to 'usr/src/cmd')
-rw-r--r--usr/src/cmd/cmd-inet/usr.bin/netstat/netstat.c378
-rw-r--r--usr/src/cmd/cmd-inet/usr.lib/in.mpathd/mpd_main.c2
-rw-r--r--usr/src/cmd/cmd-inet/usr.lib/mdnsd/mDNSUNP.c9
-rw-r--r--usr/src/cmd/cmd-inet/usr.sbin/ifconfig/ifconfig.c18
-rw-r--r--usr/src/cmd/cmd-inet/usr.sbin/ping/ping.c51
-rw-r--r--usr/src/cmd/cmd-inet/usr.sbin/route.c47
-rw-r--r--usr/src/cmd/cmd-inet/usr.sbin/traceroute/traceroute.c20
-rw-r--r--usr/src/cmd/devfsadm/misc_link.c3
-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
16 files changed, 1126 insertions, 1261 deletions
diff --git a/usr/src/cmd/cmd-inet/usr.bin/netstat/netstat.c b/usr/src/cmd/cmd-inet/usr.bin/netstat/netstat.c
index 96bcec530c..1919d21356 100644
--- a/usr/src/cmd/cmd-inet/usr.bin/netstat/netstat.c
+++ b/usr/src/cmd/cmd-inet/usr.bin/netstat/netstat.c
@@ -196,6 +196,7 @@ static void ire_report(const mib_item_t *item);
static void tcp_report(const mib_item_t *item);
static void udp_report(const mib_item_t *item);
static void group_report(mib_item_t *item);
+static void dce_report(mib_item_t *item);
static void print_ip_stats(mib2_ip_t *ip);
static void print_icmp_stats(mib2_icmp_t *icmp);
static void print_ip6_stats(mib2_ipv6IfStatsEntry_t *ip6);
@@ -236,7 +237,7 @@ static void fatal(int errcode, char *str1, ...);
static boolean_t Aflag = B_FALSE; /* All sockets/ifs/rtng-tbls */
-static boolean_t Dflag = B_FALSE; /* Debug Info */
+static boolean_t Dflag = B_FALSE; /* DCE info */
static boolean_t Iflag = B_FALSE; /* IP Traffic Interfaces */
static boolean_t Mflag = B_FALSE; /* STREAMS Memory Statistics */
static boolean_t Nflag = B_FALSE; /* Numeric Network Addresses */
@@ -248,6 +249,7 @@ static boolean_t Pflag = B_FALSE; /* Net to Media Tables */
static boolean_t Gflag = B_FALSE; /* Multicast group membership */
static boolean_t MMflag = B_FALSE; /* Multicast routing table */
static boolean_t DHCPflag = B_FALSE; /* DHCP statistics */
+static boolean_t Xflag = B_FALSE; /* Debug Info */
static int v4compat = 0; /* Compatible printing format for status */
@@ -276,6 +278,8 @@ static int ipv6NetToMediaEntrySize;
static int ipv6MemberEntrySize;
static int ipv6GroupSourceEntrySize;
+static int ipDestEntrySize;
+
static int transportMLPSize;
static int tcpConnEntrySize;
static int tcp6ConnEntrySize;
@@ -298,7 +302,7 @@ static m_label_t *zone_security_label = NULL;
/* Flags on routes */
#define FLF_A 0x00000001
-#define FLF_B 0x00000002
+#define FLF_b 0x00000002
#define FLF_D 0x00000004
#define FLF_G 0x00000008
#define FLF_H 0x00000010
@@ -306,7 +310,12 @@ static m_label_t *zone_security_label = NULL;
#define FLF_U 0x00000040
#define FLF_M 0x00000080
#define FLF_S 0x00000100
-static const char flag_list[] = "ABDGHLUMS";
+#define FLF_C 0x00000200 /* IRE_IF_CLONE */
+#define FLF_I 0x00000400 /* RTF_INDIRECT */
+#define FLF_R 0x00000800 /* RTF_REJECT */
+#define FLF_B 0x00001000 /* RTF_BLACKHOLE */
+
+static const char flag_list[] = "AbDGHLUMSCIRB";
typedef struct filter_rule filter_t;
@@ -379,14 +388,15 @@ main(int argc, char **argv)
(void) setlocale(LC_ALL, "");
(void) textdomain(TEXT_DOMAIN);
- while ((c = getopt(argc, argv, "adimnrspMgvf:P:I:DRT:")) != -1) {
+ while ((c = getopt(argc, argv, "adimnrspMgvxf:P:I:DRT:")) != -1) {
switch ((char)c) {
case 'a': /* all connections */
Aflag = B_TRUE;
break;
- case 'd': /* turn on debugging */
+ case 'd': /* DCE info */
Dflag = B_TRUE;
+ IFLAGMOD(Iflag_only, 1, 0); /* see macro def'n */
break;
case 'i': /* interface (ill/ipif report) */
@@ -438,6 +448,10 @@ main(int argc, char **argv)
IFLAGMOD(Iflag_only, 1, 0); /* see macro def'n */
break;
+ case 'x': /* turn on debugging */
+ Xflag = B_TRUE;
+ break;
+
case 'f':
process_filter(optarg);
break;
@@ -603,7 +617,7 @@ main(int argc, char **argv)
mib_item_destroy(&previtem);
}
- if (!(Iflag || Rflag || Sflag || Mflag ||
+ if (!(Dflag || Iflag || Rflag || Sflag || Mflag ||
MMflag || Pflag || Gflag || DHCPflag)) {
if (protocol_selected(IPPROTO_UDP))
udp_report(item);
@@ -634,12 +648,14 @@ main(int argc, char **argv)
if (family_selected(AF_INET6))
ndp_report(item);
}
+ if (Dflag)
+ dce_report(item);
mib_item_destroy(&curritem);
}
/* netstat: AF_UNIX behaviour */
if (family_selected(AF_UNIX) &&
- (!(Iflag || Rflag || Sflag || Mflag ||
+ (!(Dflag || Iflag || Rflag || Sflag || Mflag ||
MMflag || Pflag || Gflag)))
unixpr(kc);
(void) kstat_close(kc);
@@ -729,7 +745,7 @@ mibget(int sd)
* us information concerning IRE_MARK_TESTHIDDEN routes.
*/
req = (struct opthdr *)&tor[1];
- req->level = EXPER_IP_AND_TESTHIDDEN;
+ req->level = EXPER_IP_AND_ALL_IRES;
req->name = 0;
req->len = 0;
@@ -755,7 +771,7 @@ mibget(int sd)
getcode = getmsg(sd, &ctlbuf, (struct strbuf *)0, &flags);
if (getcode == -1) {
perror("mibget getmsg(ctl) failed");
- if (Dflag) {
+ if (Xflag) {
(void) fputs("# level name len\n",
stderr);
i = 0;
@@ -774,7 +790,7 @@ mibget(int sd)
toa->PRIM_type == T_OPTMGMT_ACK &&
toa->MGMT_flags == T_SUCCESS &&
req->len == 0) {
- if (Dflag)
+ if (Xflag)
(void) printf("mibget getmsg() %d returned "
"EOD (level %ld, name %ld)\n",
j, req->level, req->name);
@@ -826,7 +842,7 @@ mibget(int sd)
last_item->valp = malloc((int)req->len);
if (last_item->valp == NULL)
goto error_exit;
- if (Dflag)
+ if (Xflag)
(void) printf("msg %d: group = %4d mib_id = %5d"
"length = %d\n",
j, last_item->group, last_item->mib_id,
@@ -1754,6 +1770,7 @@ mib_get_constants(mib_item_t *item)
ipGroupSourceEntrySize = ip->ipGroupSourceEntrySize;
ipRouteAttributeSize = ip->ipRouteAttributeSize;
transportMLPSize = ip->transportMLPSize;
+ ipDestEntrySize = ip->ipDestEntrySize;
assert(IS_P2ALIGNED(ipAddrEntrySize,
sizeof (mib2_ipAddrEntry_t *)));
assert(IS_P2ALIGNED(ipRouteEntrySize,
@@ -1850,7 +1867,7 @@ mib_get_constants(mib_item_t *item)
}
} /* 'for' loop 1 ends */
- if (Dflag) {
+ if (Xflag) {
(void) puts("mib_get_constants:");
(void) printf("\tipv6IfStatsEntrySize %d\n",
ipv6IfStatsEntrySize);
@@ -1872,6 +1889,7 @@ mib_get_constants(mib_item_t *item)
ipv6MemberEntrySize);
(void) printf("\tipv6IfIcmpEntrySize %d\n",
ipv6IfIcmpEntrySize);
+ (void) printf("\tipDestEntrySize %d\n", ipDestEntrySize);
(void) printf("\ttransportMLPSize %d\n", transportMLPSize);
(void) printf("\ttcpConnEntrySize %d\n", tcpConnEntrySize);
(void) printf("\ttcp6ConnEntrySize %d\n", tcp6ConnEntrySize);
@@ -1895,7 +1913,7 @@ stat_report(mib_item_t *item)
/* 'for' loop 1: */
for (; item; item = item->next_item) {
- if (Dflag) {
+ if (Xflag) {
(void) printf("\n--- Entry %d ---\n", ++jtemp);
(void) printf("Group = %d, mib_id = %d, "
"length = %d, valp = 0x%p\n",
@@ -2542,7 +2560,7 @@ mrt_stat_report(mib_item_t *curritem)
for (tempitem = curritem;
tempitem;
tempitem = tempitem->next_item) {
- if (Dflag) {
+ if (Xflag) {
(void) printf("\n--- Entry %d ---\n", ++jtemp);
(void) printf("Group = %d, mib_id = %d, "
"length = %d, valp = 0x%p\n",
@@ -2603,7 +2621,7 @@ if_report(mib_item_t *item, char *matchname,
/* 'for' loop 1: */
for (; item; item = item->next_item) {
- if (Dflag) {
+ if (Xflag) {
(void) printf("\n--- Entry %d ---\n", ++jtemp);
(void) printf("Group = %d, mib_id = %d, "
"length = %d, valp = 0x%p\n",
@@ -2632,7 +2650,7 @@ if_report(mib_item_t *item, char *matchname,
boolean_t first = B_TRUE;
uint32_t new_ifindex;
- if (Dflag)
+ if (Xflag)
(void) printf("if_report: %d items\n",
(item->length)
/ sizeof (mib2_ipAddrEntry_t));
@@ -2944,7 +2962,7 @@ if_report(mib_item_t *item, char *matchname,
boolean_t first = B_TRUE;
uint32_t new_ifindex;
- if (Dflag)
+ if (Xflag)
(void) printf("if_report: %d items\n",
(item->length)
/ sizeof (mib2_ipv6AddrEntry_t));
@@ -3287,10 +3305,10 @@ if_report_ip4(mib2_ipAddrEntry_t *ap,
(void) pr_netaddr(ap->ipAdEntAddr, ap->ipAdEntNetMask,
abuf, sizeof (abuf));
- (void) printf("%-13s %-14s %-6llu %-5s %-6llu "
+ (void) printf("%-13s %-14s %-6llu %-5s %-6s "
"%-5s %-6s %-6llu\n", abuf,
pr_addr(ap->ipAdEntAddr, dstbuf, sizeof (dstbuf)),
- statptr->ipackets, "N/A", statptr->opackets, "N/A", "N/A",
+ statptr->ipackets, "N/A", "N/A", "N/A", "N/A",
0LL);
}
}
@@ -3337,11 +3355,10 @@ if_report_ip6(mib2_ipv6AddrEntry_t *ap6,
else
(void) pr_prefix6(&ap6->ipv6AddrAddress,
ap6->ipv6AddrPfxLength, abuf, sizeof (abuf));
- (void) printf("%-27s %-27s %-6llu %-5s %-6llu %-5s %-6s\n",
+ (void) printf("%-27s %-27s %-6llu %-5s %-6s %-5s %-6s\n",
abuf, pr_addr6(&ap6->ipv6AddrAddress, dstbuf,
sizeof (dstbuf)),
- statptr->ipackets, "N/A",
- statptr->opackets, "N/A", "N/A");
+ statptr->ipackets, "N/A", "N/A", "N/A", "N/A");
}
}
@@ -3490,7 +3507,7 @@ group_report(mib_item_t *item)
/* 'for' loop 1: */
for (; item; item = item->next_item) {
- if (Dflag) {
+ if (Xflag) {
(void) printf("\n--- Entry %d ---\n", ++jtemp);
(void) printf("Group = %d, mib_id = %d, "
"length = %d, valp = 0x%p\n",
@@ -3501,12 +3518,12 @@ group_report(mib_item_t *item)
switch (item->mib_id) {
case EXPER_IP_GROUP_MEMBERSHIP:
v4grp = item;
- if (Dflag)
+ if (Xflag)
(void) printf("item is v4grp info\n");
break;
case EXPER_IP_GROUP_SOURCES:
v4src = item;
- if (Dflag)
+ if (Xflag)
(void) printf("item is v4src info\n");
break;
default:
@@ -3518,12 +3535,12 @@ group_report(mib_item_t *item)
switch (item->mib_id) {
case EXPER_IP6_GROUP_MEMBERSHIP:
v6grp = item;
- if (Dflag)
+ if (Xflag)
(void) printf("item is v6grp info\n");
break;
case EXPER_IP6_GROUP_SOURCES:
v6src = item;
- if (Dflag)
+ if (Xflag)
(void) printf("item is v6src info\n");
break;
default:
@@ -3533,7 +3550,7 @@ group_report(mib_item_t *item)
}
if (family_selected(AF_INET) && v4grp != NULL) {
- if (Dflag)
+ if (Xflag)
(void) printf("%u records for ipGroupMember:\n",
v4grp->length / sizeof (ip_member_t));
@@ -3564,7 +3581,7 @@ group_report(mib_item_t *item)
if (!Vflag || v4src == NULL)
continue;
- if (Dflag)
+ if (Xflag)
(void) printf("scanning %u ipGroupSource "
"records...\n",
v4src->length/sizeof (ip_grpsrc_t));
@@ -3609,7 +3626,7 @@ group_report(mib_item_t *item)
}
if (family_selected(AF_INET6) && v6grp != NULL) {
- if (Dflag)
+ if (Xflag)
(void) printf("%u records for ipv6GroupMember:\n",
v6grp->length / sizeof (ipv6_member_t));
@@ -3638,7 +3655,7 @@ group_report(mib_item_t *item)
if (!Vflag || v6src == NULL)
continue;
- if (Dflag)
+ if (Xflag)
(void) printf("scanning %u ipv6GroupSource "
"records...\n",
v6src->length/sizeof (ipv6_grpsrc_t));
@@ -3683,6 +3700,126 @@ group_report(mib_item_t *item)
(void) fflush(stdout);
}
+/* --------------------- DCE_REPORT (netstat -d) ------------------------- */
+
+#define FLBUFSIZE 8
+
+/* Assumes flbuf is at least 5 characters; callers use FLBUFSIZE */
+static char *
+dceflags2str(uint32_t flags, char *flbuf)
+{
+ char *str = flbuf;
+
+ if (flags & DCEF_DEFAULT)
+ *str++ = 'D';
+ if (flags & DCEF_PMTU)
+ *str++ = 'P';
+ if (flags & DCEF_UINFO)
+ *str++ = 'U';
+ if (flags & DCEF_TOO_SMALL_PMTU)
+ *str++ = 'S';
+ *str++ = '\0';
+ return (flbuf);
+}
+
+static void
+dce_report(mib_item_t *item)
+{
+ mib_item_t *v4dce = NULL;
+ mib_item_t *v6dce = NULL;
+ int jtemp = 0;
+ char ifname[LIFNAMSIZ + 1];
+ char abuf[MAXHOSTNAMELEN + 1];
+ char flbuf[FLBUFSIZE];
+ boolean_t first;
+ dest_cache_entry_t *dce;
+
+ /* 'for' loop 1: */
+ for (; item; item = item->next_item) {
+ if (Xflag) {
+ (void) printf("\n--- Entry %d ---\n", ++jtemp);
+ (void) printf("Group = %d, mib_id = %d, "
+ "length = %d, valp = 0x%p\n",
+ item->group, item->mib_id, item->length,
+ item->valp);
+ }
+ if (item->group == MIB2_IP && family_selected(AF_INET) &&
+ item->mib_id == EXPER_IP_DCE) {
+ v4dce = item;
+ if (Xflag)
+ (void) printf("item is v4dce info\n");
+ }
+ if (item->group == MIB2_IP6 && family_selected(AF_INET6) &&
+ item->mib_id == EXPER_IP_DCE) {
+ v6dce = item;
+ if (Xflag)
+ (void) printf("item is v6dce info\n");
+ }
+ }
+
+ if (family_selected(AF_INET) && v4dce != NULL) {
+ if (Xflag)
+ (void) printf("%u records for DestCacheEntry:\n",
+ v4dce->length / ipDestEntrySize);
+
+ first = B_TRUE;
+ for (dce = (dest_cache_entry_t *)v4dce->valp;
+ (char *)dce < (char *)v4dce->valp + v4dce->length;
+ /* LINTED: (note 1) */
+ dce = (dest_cache_entry_t *)((char *)dce +
+ ipDestEntrySize)) {
+ if (first) {
+ (void) putchar('\n');
+ (void) puts("Destination Cache Entries: IPv4");
+ (void) puts(
+ "Address PMTU Age Flags");
+ (void) puts(
+ "-------------------- ------ ----- -----");
+ first = B_FALSE;
+ }
+
+ (void) printf("%-20s %6u %5u %-5s\n",
+ pr_addr(dce->DestIpv4Address, abuf, sizeof (abuf)),
+ dce->DestPmtu, dce->DestAge,
+ dceflags2str(dce->DestFlags, flbuf));
+ }
+ }
+
+ if (family_selected(AF_INET6) && v6dce != NULL) {
+ if (Xflag)
+ (void) printf("%u records for DestCacheEntry:\n",
+ v6dce->length / ipDestEntrySize);
+
+ first = B_TRUE;
+ for (dce = (dest_cache_entry_t *)v6dce->valp;
+ (char *)dce < (char *)v6dce->valp + v6dce->length;
+ /* LINTED: (note 1) */
+ dce = (dest_cache_entry_t *)((char *)dce +
+ ipDestEntrySize)) {
+ if (first) {
+ (void) putchar('\n');
+ (void) puts("Destination Cache Entries: IPv6");
+ (void) puts(
+ "Address PMTU "
+ " Age Flags If ");
+ (void) puts(
+ "--------------------------- ------ "
+ "----- ----- ---");
+ first = B_FALSE;
+ }
+
+ (void) printf("%-27s %6u %5u %-5s %s\n",
+ pr_addr6(&dce->DestIpv6Address, abuf,
+ sizeof (abuf)),
+ dce->DestPmtu, dce->DestAge,
+ dceflags2str(dce->DestFlags, flbuf),
+ dce->DestIfindex == 0 ? "" :
+ ifindex2str(dce->DestIfindex, ifname));
+ }
+ }
+ (void) fflush(stdout);
+}
+
/* --------------------- ARP_REPORT (netstat -p) -------------------------- */
static void
@@ -3703,7 +3840,7 @@ arp_report(mib_item_t *item)
/* 'for' loop 1: */
for (; item; item = item->next_item) {
- if (Dflag) {
+ if (Xflag) {
(void) printf("\n--- Entry %d ---\n", ++jtemp);
(void) printf("Group = %d, mib_id = %d, "
"length = %d, valp = 0x%p\n",
@@ -3713,7 +3850,7 @@ arp_report(mib_item_t *item)
if (!(item->group == MIB2_IP && item->mib_id == MIB2_IP_MEDIA))
continue; /* 'for' loop 1 */
- if (Dflag)
+ if (Xflag)
(void) printf("%u records for "
"ipNetToMediaEntryTable:\n",
item->length/sizeof (mib2_ipNetToMediaEntry_t));
@@ -3798,7 +3935,7 @@ ndp_report(mib_item_t *item)
/* 'for' loop 1: */
for (; item; item = item->next_item) {
- if (Dflag) {
+ if (Xflag) {
(void) printf("\n--- Entry %d ---\n", ++jtemp);
(void) printf("Group = %d, mib_id = %d, "
"length = %d, valp = 0x%p\n",
@@ -3973,7 +4110,7 @@ ire_report(const mib_item_t *item)
v4a = v4_attrs;
v6a = v6_attrs;
for (; item != NULL; item = item->next_item) {
- if (Dflag) {
+ if (Xflag) {
(void) printf("\n--- Entry %d ---\n", ++jtemp);
(void) printf("Group = %d, mib_id = %d, "
"length = %d, valp = 0x%p\n",
@@ -3991,7 +4128,7 @@ ire_report(const mib_item_t *item)
else if (item->group == MIB2_IP6 && !family_selected(AF_INET6))
continue; /* 'for' loop 1 */
- if (Dflag) {
+ if (Xflag) {
if (item->group == MIB2_IP) {
(void) printf("%u records for "
"ipRouteEntryTable:\n",
@@ -4161,29 +4298,29 @@ form_v4_route_flags(const mib2_ipRouteEntry_t *rp, char *flags)
flag_b = FLF_U;
(void) strcpy(flags, "U");
- if (rp->ipRouteInfo.re_ire_type == IRE_DEFAULT ||
- rp->ipRouteInfo.re_ire_type == IRE_PREFIX ||
- rp->ipRouteInfo.re_ire_type == IRE_HOST ||
- rp->ipRouteInfo.re_ire_type == IRE_HOST_REDIRECT) {
+ /* RTF_INDIRECT wins over RTF_GATEWAY - don't display both */
+ if (rp->ipRouteInfo.re_flags & RTF_INDIRECT) {
+ (void) strcat(flags, "I");
+ flag_b |= FLF_I;
+ } else if (rp->ipRouteInfo.re_ire_type & IRE_OFFLINK) {
(void) strcat(flags, "G");
flag_b |= FLF_G;
}
- if (rp->ipRouteMask == IP_HOST_MASK) {
+ /* IRE_IF_CLONE wins over RTF_HOST - don't display both */
+ if (rp->ipRouteInfo.re_ire_type & IRE_IF_CLONE) {
+ (void) strcat(flags, "C");
+ flag_b |= FLF_C;
+ } else if (rp->ipRouteMask == IP_HOST_MASK) {
(void) strcat(flags, "H");
flag_b |= FLF_H;
}
- if (rp->ipRouteInfo.re_ire_type == IRE_HOST_REDIRECT) {
+ if (rp->ipRouteInfo.re_flags & RTF_DYNAMIC) {
(void) strcat(flags, "D");
flag_b |= FLF_D;
}
- if (rp->ipRouteInfo.re_ire_type == IRE_CACHE) {
- /* Address resolution */
- (void) strcat(flags, "A");
- flag_b |= FLF_A;
- }
if (rp->ipRouteInfo.re_ire_type == IRE_BROADCAST) { /* Broadcast */
- (void) strcat(flags, "B");
- flag_b |= FLF_B;
+ (void) strcat(flags, "b");
+ flag_b |= FLF_b;
}
if (rp->ipRouteInfo.re_ire_type == IRE_LOCAL) { /* Local */
(void) strcat(flags, "L");
@@ -4197,6 +4334,14 @@ form_v4_route_flags(const mib2_ipRouteEntry_t *rp, char *flags)
(void) strcat(flags, "S"); /* Setsrc */
flag_b |= FLF_S;
}
+ if (rp->ipRouteInfo.re_flags & RTF_REJECT) {
+ (void) strcat(flags, "R");
+ flag_b |= FLF_R;
+ }
+ if (rp->ipRouteInfo.re_flags & RTF_BLACKHOLE) {
+ (void) strcat(flags, "B");
+ flag_b |= FLF_B;
+ }
return (flag_b);
}
@@ -4205,9 +4350,9 @@ static const char ire_hdr_v4[] =
static const char ire_hdr_v4_compat[] =
"\n%s Table:\n";
static const char ire_hdr_v4_verbose[] =
-" Destination Mask Gateway Device Mxfrg "
-"Rtt Ref Flg Out In/Fwd %s\n"
-"-------------------- --------------- -------------------- ------ ----- "
+" Destination Mask Gateway Device "
+" MTU Ref Flg Out In/Fwd %s\n"
+"-------------------- --------------- -------------------- ------ "
"----- --- --- ----- ------ %s\n";
static const char ire_hdr_v4_normal[] =
@@ -4226,8 +4371,10 @@ ire_report_item_v4(const mib2_ipRouteEntry_t *rp, boolean_t first,
char flags[10]; /* RTF_ flags */
uint_t flag_b;
- if (!(Aflag || (rp->ipRouteInfo.re_ire_type != IRE_CACHE &&
+ if (!(Aflag || (rp->ipRouteInfo.re_ire_type != IRE_IF_CLONE &&
rp->ipRouteInfo.re_ire_type != IRE_BROADCAST &&
+ rp->ipRouteInfo.re_ire_type != IRE_MULTICAST &&
+ rp->ipRouteInfo.re_ire_type != IRE_NOROUTE &&
rp->ipRouteInfo.re_ire_type != IRE_LOCAL))) {
return (first);
}
@@ -4253,15 +4400,13 @@ ire_report_item_v4(const mib2_ipRouteEntry_t *rp, boolean_t first,
dstbuf, sizeof (dstbuf));
}
if (Vflag) {
- (void) printf("%-20s %-15s %-20s %-6s %5u%c %4u %3u "
+ (void) printf("%-20s %-15s %-20s %-6s %5u %3u "
"%-4s%6u %6u %s\n",
dstbuf,
pr_mask(rp->ipRouteMask, maskbuf, sizeof (maskbuf)),
pr_addrnz(rp->ipRouteNextHop, gwbuf, sizeof (gwbuf)),
octetstr(&rp->ipRouteIfIndex, 'a', ifname, sizeof (ifname)),
rp->ipRouteInfo.re_max_frag,
- rp->ipRouteInfo.re_frag_flag ? '*' : ' ',
- rp->ipRouteInfo.re_rtt,
rp->ipRouteInfo.re_ref,
flags,
rp->ipRouteInfo.re_obpkt,
@@ -4391,58 +4536,39 @@ ire_filter_match_v6(const mib2_ipv6RouteEntry_t *rp6, uint_t flag_b)
return (B_TRUE);
}
-static const char ire_hdr_v6[] =
-"\n%s Table: IPv6\n";
-static const char ire_hdr_v6_verbose[] =
-" Destination/Mask Gateway If PMTU Rtt "
-"Ref Flags Out In/Fwd %s\n"
-"--------------------------- --------------------------- ----- ------ ----- "
-"--- ----- ------ ------ %s\n";
-static const char ire_hdr_v6_normal[] =
-" Destination/Mask Gateway Flags Ref Use "
-" If %s\n"
-"--------------------------- --------------------------- ----- --- ------- "
-"----- %s\n";
-
-static boolean_t
-ire_report_item_v6(const mib2_ipv6RouteEntry_t *rp6, boolean_t first,
- const sec_attr_list_t *attrs)
+/*
+ * Given an IPv6 MIB2 route entry, form the list of flags for the
+ * route.
+ */
+static uint_t
+form_v6_route_flags(const mib2_ipv6RouteEntry_t *rp6, char *flags)
{
- char dstbuf[MAXHOSTNAMELEN + 1];
- char gwbuf[MAXHOSTNAMELEN + 1];
- char ifname[LIFNAMSIZ + 1];
- char flags[10]; /* RTF_ flags */
- uint_t flag_b;
-
- if (!(Aflag || (rp6->ipv6RouteInfo.re_ire_type != IRE_CACHE &&
- rp6->ipv6RouteInfo.re_ire_type != IRE_LOCAL))) {
- return (first);
- }
+ uint_t flag_b;
flag_b = FLF_U;
(void) strcpy(flags, "U");
- if (rp6->ipv6RouteInfo.re_ire_type == IRE_DEFAULT ||
- rp6->ipv6RouteInfo.re_ire_type == IRE_PREFIX ||
- rp6->ipv6RouteInfo.re_ire_type == IRE_HOST ||
- rp6->ipv6RouteInfo.re_ire_type == IRE_HOST_REDIRECT) {
+ /* RTF_INDIRECT wins over RTF_GATEWAY - don't display both */
+ if (rp6->ipv6RouteInfo.re_flags & RTF_INDIRECT) {
+ (void) strcat(flags, "I");
+ flag_b |= FLF_I;
+ } else if (rp6->ipv6RouteInfo.re_ire_type & IRE_OFFLINK) {
(void) strcat(flags, "G");
flag_b |= FLF_G;
}
- if (rp6->ipv6RoutePfxLength == IPV6_ABITS) {
+ /* IRE_IF_CLONE wins over RTF_HOST - don't display both */
+ if (rp6->ipv6RouteInfo.re_ire_type & IRE_IF_CLONE) {
+ (void) strcat(flags, "C");
+ flag_b |= FLF_C;
+ } else if (rp6->ipv6RoutePfxLength == IPV6_ABITS) {
(void) strcat(flags, "H");
flag_b |= FLF_H;
}
- if (rp6->ipv6RouteInfo.re_ire_type == IRE_HOST_REDIRECT) {
+ if (rp6->ipv6RouteInfo.re_flags & RTF_DYNAMIC) {
(void) strcat(flags, "D");
flag_b |= FLF_D;
}
- if (rp6->ipv6RouteInfo.re_ire_type == IRE_CACHE) {
- /* Address resolution */
- (void) strcat(flags, "A");
- flag_b |= FLF_A;
- }
if (rp6->ipv6RouteInfo.re_ire_type == IRE_LOCAL) { /* Local */
(void) strcat(flags, "L");
flag_b |= FLF_L;
@@ -4455,6 +4581,48 @@ ire_report_item_v6(const mib2_ipv6RouteEntry_t *rp6, boolean_t first,
(void) strcat(flags, "S"); /* Setsrc */
flag_b |= FLF_S;
}
+ if (rp6->ipv6RouteInfo.re_flags & RTF_REJECT) {
+ (void) strcat(flags, "R");
+ flag_b |= FLF_R;
+ }
+ if (rp6->ipv6RouteInfo.re_flags & RTF_BLACKHOLE) {
+ (void) strcat(flags, "B");
+ flag_b |= FLF_B;
+ }
+ return (flag_b);
+}
+
+static const char ire_hdr_v6[] =
+"\n%s Table: IPv6\n";
+static const char ire_hdr_v6_verbose[] =
+" Destination/Mask Gateway If MTU "
+"Ref Flags Out In/Fwd %s\n"
+"--------------------------- --------------------------- ----- ----- "
+"--- ----- ------ ------ %s\n";
+static const char ire_hdr_v6_normal[] =
+" Destination/Mask Gateway Flags Ref Use "
+" If %s\n"
+"--------------------------- --------------------------- ----- --- ------- "
+"----- %s\n";
+
+static boolean_t
+ire_report_item_v6(const mib2_ipv6RouteEntry_t *rp6, boolean_t first,
+ const sec_attr_list_t *attrs)
+{
+ char dstbuf[MAXHOSTNAMELEN + 1];
+ char gwbuf[MAXHOSTNAMELEN + 1];
+ char ifname[LIFNAMSIZ + 1];
+ char flags[10]; /* RTF_ flags */
+ uint_t flag_b;
+
+ if (!(Aflag || (rp6->ipv6RouteInfo.re_ire_type != IRE_IF_CLONE &&
+ rp6->ipv6RouteInfo.re_ire_type != IRE_MULTICAST &&
+ rp6->ipv6RouteInfo.re_ire_type != IRE_NOROUTE &&
+ rp6->ipv6RouteInfo.re_ire_type != IRE_LOCAL))) {
+ return (first);
+ }
+
+ flag_b = form_v6_route_flags(rp6, flags);
if (!ire_filter_match_v6(rp6, flag_b))
return (first);
@@ -4468,7 +4636,7 @@ ire_report_item_v6(const mib2_ipv6RouteEntry_t *rp6, boolean_t first,
}
if (Vflag) {
- (void) printf("%-27s %-27s %-5s %5u%c %5u %3u "
+ (void) printf("%-27s %-27s %-5s %5u %3u "
"%-5s %6u %6u %s\n",
pr_prefix6(&rp6->ipv6RouteDest,
rp6->ipv6RoutePfxLength, dstbuf, sizeof (dstbuf)),
@@ -4478,8 +4646,6 @@ ire_report_item_v6(const mib2_ipv6RouteEntry_t *rp6, boolean_t first,
octetstr(&rp6->ipv6RouteIfIndex, 'a',
ifname, sizeof (ifname)),
rp6->ipv6RouteInfo.re_max_frag,
- rp6->ipv6RouteInfo.re_frag_flag ? '*' : ' ',
- rp6->ipv6RouteInfo.re_rtt,
rp6->ipv6RouteInfo.re_ref,
flags,
rp6->ipv6RouteInfo.re_obpkt,
@@ -4617,7 +4783,7 @@ tcp_report(const mib_item_t *item)
v4a = v4_attrs;
v6a = v6_attrs;
for (; item != NULL; item = item->next_item) {
- if (Dflag) {
+ if (Xflag) {
(void) printf("\n--- Entry %d ---\n", ++jtemp);
(void) printf("Group = %d, mib_id = %d, "
"length = %d, valp = 0x%p\n",
@@ -4841,7 +5007,7 @@ udp_report(const mib_item_t *item)
v6a = v6_attrs;
/* 'for' loop 1: */
for (; item; item = item->next_item) {
- if (Dflag) {
+ if (Xflag) {
(void) printf("\n--- Entry %d ---\n", ++jtemp);
(void) printf("Group = %d, mib_id = %d, "
"length = %d, valp = 0x%p\n",
@@ -4916,10 +5082,7 @@ udp_report_item_v4(const mib2_udpEntry_t *ude, boolean_t first,
"",
miudp_state(ude->udpEntryInfo.ue_state, attr));
- /*
- * UDP sockets don't have remote attributes, so there's no need to
- * print them here.
- */
+ print_transport_label(attr);
return (first);
}
@@ -4956,10 +5119,7 @@ udp_report_item_v6(const mib2_udp6Entry_t *ude6, boolean_t first,
miudp_state(ude6->udp6EntryInfo.ue_state, attr),
ifnamep == NULL ? "" : ifnamep);
- /*
- * UDP sockets don't have remote attributes, so there's no need to
- * print them here.
- */
+ print_transport_label(attr);
return (first);
}
@@ -5321,7 +5481,7 @@ mrt_report(mib_item_t *item)
/* 'for' loop 1: */
for (; item; item = item->next_item) {
- if (Dflag) {
+ if (Xflag) {
(void) printf("\n--- Entry %d ---\n", ++jtemp);
(void) printf("Group = %d, mib_id = %d, "
"length = %d, valp = 0x%p\n",
@@ -5334,7 +5494,7 @@ mrt_report(mib_item_t *item)
switch (item->mib_id) {
case EXPER_DVMRP_VIF:
- if (Dflag)
+ if (Xflag)
(void) printf("%u records for ipVifTable:\n",
item->length/sizeof (struct vifctl));
if (item->length/sizeof (struct vifctl) == 0) {
@@ -5377,7 +5537,7 @@ mrt_report(mib_item_t *item)
break;
case EXPER_DVMRP_MRT:
- if (Dflag)
+ if (Xflag)
(void) printf("%u records for ipMfcTable:\n",
item->length/sizeof (struct vifctl));
if (item->length/sizeof (struct vifctl) == 0) {
diff --git a/usr/src/cmd/cmd-inet/usr.lib/in.mpathd/mpd_main.c b/usr/src/cmd/cmd-inet/usr.lib/in.mpathd/mpd_main.c
index 28416c4d7f..c0621996d3 100644
--- a/usr/src/cmd/cmd-inet/usr.lib/in.mpathd/mpd_main.c
+++ b/usr/src/cmd/cmd-inet/usr.lib/in.mpathd/mpd_main.c
@@ -2875,7 +2875,7 @@ mibwalk(void (*proc)(mib_item_t *))
* us information concerning IRE_MARK_TESTHIDDEN routes.
*/
req = (struct opthdr *)&tor[1];
- req->level = EXPER_IP_AND_TESTHIDDEN;
+ req->level = EXPER_IP_AND_ALL_IRES;
req->name = 0;
req->len = 0;
diff --git a/usr/src/cmd/cmd-inet/usr.lib/mdnsd/mDNSUNP.c b/usr/src/cmd/cmd-inet/usr.lib/mdnsd/mDNSUNP.c
index b76341e303..2cea11b454 100644
--- a/usr/src/cmd/cmd-inet/usr.lib/mdnsd/mDNSUNP.c
+++ b/usr/src/cmd/cmd-inet/usr.lib/mdnsd/mDNSUNP.c
@@ -407,6 +407,15 @@ select_src_ifi_info_solaris(int sockfd, int numifs,
if (ifflags & (IFF_NOXMIT | IFF_NOLOCAL | IFF_PRIVATE))
continue;
+ /* A DHCP client will have IFF_UP set yet the address is zero. Ignore */
+ if (lifr->lifr_addr.ss_family == AF_INET) {
+ struct sockaddr_in *sinptr;
+
+ sinptr = (struct sockaddr_in *) &lifr->lifr_addr;
+ if (sinptr->sin_addr.s_addr == INADDR_ANY)
+ continue;
+ }
+
if (*best_lifr != NULL) {
/*
* Check if we found a better interface by checking
diff --git a/usr/src/cmd/cmd-inet/usr.sbin/ifconfig/ifconfig.c b/usr/src/cmd/cmd-inet/usr.sbin/ifconfig/ifconfig.c
index 506b15a307..868f9ab5e2 100644
--- a/usr/src/cmd/cmd-inet/usr.sbin/ifconfig/ifconfig.c
+++ b/usr/src/cmd/cmd-inet/usr.sbin/ifconfig/ifconfig.c
@@ -3541,18 +3541,6 @@ ifplumb(const char *linkname, const char *ifname, boolean_t genppa, int af)
Perror2_exit("I_PUSH", IP_MOD_NAME);
/*
- * Push the ARP module onto the interface stream. IP uses
- * this to send resolution requests up to ARP. We need to
- * do this before the SLIFNAME ioctl is sent down because
- * the interface becomes publicly known as soon as the SLIFNAME
- * ioctl completes. Thus some other process trying to bring up
- * the interface after SLIFNAME but before we have pushed ARP
- * could hang. We pop the module again later if it is not needed.
- */
- if (ioctl(ip_fd, I_PUSH, ARP_MOD_NAME) == -1)
- Perror2_exit("I_PUSH", ARP_MOD_NAME);
-
- /*
* Prepare to set IFF_IPV4/IFF_IPV6 flags as part of SIOCSLIFNAME.
* (At this point in time the kernel also allows an override of the
* IFF_CANTCHANGE flags.)
@@ -3679,12 +3667,6 @@ ifplumb(const char *linkname, const char *ifname, boolean_t genppa, int af)
(void) putchar('\n');
}
- /* Check if arp is not actually needed */
- if (lifr.lifr_flags & (IFF_NOARP|IFF_IPV6)) {
- if (ioctl(ip_fd, I_POP, 0) == -1)
- Perror2_exit("I_POP", ARP_MOD_NAME);
- }
-
/*
* Open "/dev/udp" for use as a multiplexor to PLINK the
* interface stream under. We use "/dev/udp" instead of "/dev/ip"
diff --git a/usr/src/cmd/cmd-inet/usr.sbin/ping/ping.c b/usr/src/cmd/cmd-inet/usr.sbin/ping/ping.c
index 2a4ff60d57..d851dce613 100644
--- a/usr/src/cmd/cmd-inet/usr.sbin/ping/ping.c
+++ b/usr/src/cmd/cmd-inet/usr.sbin/ping/ping.c
@@ -159,6 +159,7 @@ static int moptions; /* multicast options */
int npackets; /* number of packets to send */
static ushort_t tos; /* type-of-service value */
static int hoplimit = -1; /* time-to-live value */
+static int dontfrag; /* IP*_DONTFRAG */
static int timeout = TIMEOUT; /* timeout value (sec) for probes */
static struct if_entry out_if; /* interface argument */
int ident; /* ID for this ping run */
@@ -268,7 +269,7 @@ main(int argc, char *argv[])
setbuf(stdout, (char *)0);
while ((c = getopt(argc, argv,
- "abA:c:dF:G:g:I:i:LlnN:P:p:rRSsTt:UvX:x:Y0123?")) != -1) {
+ "abA:c:dDF:G:g:I:i:LlnN:P:p:rRSsTt:UvX:x:Y0123?")) != -1) {
switch ((char)c) {
case 'A':
if (strcmp(optarg, "inet") == 0) {
@@ -301,6 +302,10 @@ main(int argc, char *argv[])
options |= SO_DEBUG;
break;
+ case 'D':
+ dontfrag = 1;
+ break;
+
case 'b':
bypass = _B_TRUE;
break;
@@ -1303,8 +1308,6 @@ setup_socket(int family, int *send_sockp, int *recv_sockp, int *if_index,
}
}
- if (nexthop != NULL && !use_udp)
- set_nexthop(family, ai_nexthop, recv_sock);
/*
* We always receive on raw icmp socket. But the sending socket can be
* raw icmp or udp, depending on the use of -U flag.
@@ -1332,9 +1335,6 @@ setup_socket(int family, int *send_sockp, int *recv_sockp, int *if_index,
}
}
- if (nexthop != NULL)
- set_nexthop(family, ai_nexthop, send_sock);
-
/*
* In order to distinguish replies to our UDP probes from
* other pings', we need to know our source port number.
@@ -1368,6 +1368,9 @@ setup_socket(int family, int *send_sockp, int *recv_sockp, int *if_index,
send_sock = recv_sock;
}
+ if (nexthop != NULL)
+ set_nexthop(family, ai_nexthop, send_sock);
+
int_op = 48 * 1024;
if (int_op < datalen)
int_op = datalen;
@@ -1431,6 +1434,7 @@ setup_socket(int family, int *send_sockp, int *recv_sockp, int *if_index,
if (moptions & MULTICAST_TTL) {
char_op = hoplimit;
+ /* Applies to unicast and multicast. */
if (family == AF_INET) {
if (setsockopt(send_sock, IPPROTO_IP, IP_MULTICAST_TTL,
(char *)&char_op, sizeof (char)) == -1) {
@@ -1454,7 +1458,10 @@ setup_socket(int family, int *send_sockp, int *recv_sockp, int *if_index,
*/
}
- /* did the user specify an interface? */
+ /*
+ * did the user specify an interface?
+ * Applies to unicast, broadcast and multicast.
+ */
if (moptions & MULTICAST_IF) {
struct ifaddrlist *al = NULL; /* interface list */
struct ifaddrlist *my_if;
@@ -1496,6 +1503,8 @@ setup_socket(int family, int *send_sockp, int *recv_sockp, int *if_index,
}
if (family == AF_INET) {
+ struct in_pktinfo pktinfo;
+
if (setsockopt(send_sock, IPPROTO_IP, IP_MULTICAST_IF,
(char *)&my_if->addr.addr,
sizeof (struct in_addr)) == -1) {
@@ -1504,6 +1513,15 @@ setup_socket(int family, int *send_sockp, int *recv_sockp, int *if_index,
strerror(errno));
exit(EXIT_FAILURE);
}
+ bzero(&pktinfo, sizeof (pktinfo));
+ pktinfo.ipi_ifindex = my_if->index;
+ if (setsockopt(send_sock, IPPROTO_IP, IP_PKTINFO,
+ (char *)&pktinfo, sizeof (pktinfo)) == -1) {
+ Fprintf(stderr, "%s: setsockopt "
+ "IP_PKTINFO %s\n", progname,
+ strerror(errno));
+ exit(EXIT_FAILURE);
+ }
} else {
/*
* the outgoing interface is set in set_ancillary_data()
@@ -1525,6 +1543,23 @@ setup_socket(int family, int *send_sockp, int *recv_sockp, int *if_index,
}
}
+ /* We enable or disable to not depend on the kernel default */
+ if (family == AF_INET) {
+ if (setsockopt(send_sock, IPPROTO_IP, IP_DONTFRAG,
+ (char *)&dontfrag, sizeof (dontfrag)) == -1) {
+ Fprintf(stderr, "%s: setsockopt IP_DONTFRAG %s\n",
+ progname, strerror(errno));
+ exit(EXIT_FAILURE);
+ }
+ } else {
+ if (setsockopt(send_sock, IPPROTO_IPV6, IPV6_DONTFRAG,
+ (char *)&dontfrag, sizeof (dontfrag)) == -1) {
+ Fprintf(stderr, "%s: setsockopt IPV6_DONTFRAG %s\n",
+ progname, strerror(errno));
+ exit(EXIT_FAILURE);
+ }
+ }
+
/* receiving IPv6 extension headers in verbose mode */
if (verbose && family == AF_INET6) {
if (setsockopt(recv_sock, IPPROTO_IPV6, IPV6_RECVHOPOPTS,
@@ -2336,7 +2371,7 @@ usage(char *cmdname)
Fprintf(stderr, "usage: %s host [timeout]\n", cmdname);
Fprintf(stderr,
/* CSTYLED */
-"usage: %s -s [-l | U] [abdLnRrv] [-A addr_family] [-c traffic_class]\n\t"
+"usage: %s -s [-l | U] [abdDLnRrv] [-A addr_family] [-c traffic_class]\n\t"
"[-g gateway [-g gateway ...]] [-N nexthop] [-F flow_label] [-I interval]\n\t"
"[-i interface] [-P tos] [-p port] [-t ttl] host [data_size] [npackets]\n",
cmdname);
diff --git a/usr/src/cmd/cmd-inet/usr.sbin/route.c b/usr/src/cmd/cmd-inet/usr.sbin/route.c
index b4b16d6755..aedef45409 100644
--- a/usr/src/cmd/cmd-inet/usr.sbin/route.c
+++ b/usr/src/cmd/cmd-inet/usr.sbin/route.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -45,8 +45,6 @@
* @(#)linkaddr.c 8.1 (Berkeley) 6/4/93
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <sys/param.h>
#include <sys/file.h>
#include <sys/socket.h>
@@ -175,6 +173,8 @@ static struct keytab {
{"show", K_SHOW},
#define K_SECATTR 43
{"secattr", K_SECATTR},
+#define K_INDIRECT 44
+ {"indirect", K_INDIRECT},
{0, 0}
};
@@ -655,7 +655,7 @@ flushroutes(int argc, char *argv[])
(char *)rp < (char *)item->valp + item->length;
/* LINTED */
rp = (mib2_ipRouteEntry_t *)
- ((char *)rp + ipRouteEntrySize)) {
+ ((char *)rp + ipRouteEntrySize)) {
delRouteEntry(rp, NULL, seqno);
seqno++;
}
@@ -670,7 +670,7 @@ flushroutes(int argc, char *argv[])
if (item->group == MIB2_IP6) {
ipv6RouteEntrySize =
((mib2_ipv6IfStatsEntry_t *)item->valp)->
- ipv6RouteEntrySize;
+ ipv6RouteEntrySize;
assert(IS_P2ALIGNED(ipv6RouteEntrySize,
sizeof (mib2_ipv6RouteEntry_t *)));
break;
@@ -692,7 +692,7 @@ flushroutes(int argc, char *argv[])
(char *)rp6 < (char *)item->valp + item->length;
/* LINTED */
rp6 = (mib2_ipv6RouteEntry_t *)
- ((char *)rp6 + ipv6RouteEntrySize)) {
+ ((char *)rp6 + ipv6RouteEntrySize)) {
delRouteEntry(NULL, rp6, seqno);
seqno++;
}
@@ -812,7 +812,7 @@ delRouteEntry(mib2_ipRouteEntry_t *rp, mib2_ipv6RouteEntry_t *rp6, int seqno)
(void) printf("%-20.20s ",
rtm->rtm_flags & RTF_HOST ? routename(sa) :
- netname(sa));
+ netname(sa));
/* LINTED */
sa = (struct sockaddr *)(salen(sa) + (char *)sa);
(void) printf("%-20.20s ", routename(sa));
@@ -861,7 +861,7 @@ routename(const struct sockaddr *sa)
cp = "default";
if (cp == NULL && !nflag) {
hp = gethostbyaddr((char *)&in, sizeof (struct in_addr),
- AF_INET);
+ AF_INET);
if (hp != NULL) {
if (((cp = strchr(hp->h_name, '.')) != NULL) &&
(strcmp(cp + 1, domain) == 0))
@@ -892,7 +892,7 @@ routename(const struct sockaddr *sa)
cp = "default";
if (cp == NULL && !nflag) {
hp = getipnodebyaddr((char *)&in6,
- sizeof (struct in6_addr), AF_INET6, &error_num);
+ sizeof (struct in6_addr), AF_INET6, &error_num);
if (hp != NULL) {
if (((cp = strchr(hp->h_name, '.')) != NULL) &&
(strcmp(cp + 1, domain) == 0))
@@ -1120,8 +1120,8 @@ print_rtcmd_short(FILE *to, rtcmd_irep_t *rcip, boolean_t gw_good,
break;
case AF_INET6:
if (inet_ntop(AF_INET6,
- &rcip->ri_gate.sin6.sin6_addr, obuf,
- INET6_ADDRSTRLEN) != NULL) {
+ &rcip->ri_gate.sin6.sin6_addr, obuf,
+ INET6_ADDRSTRLEN) != NULL) {
if (nflag) {
(void) fprintf(to, ": gateway %s",
obuf);
@@ -1405,6 +1405,9 @@ args_to_rtcmd(rtcmd_irep_t *rcip, char **argv, char *cmd_string)
return (B_FALSE);
}
break;
+ case K_INDIRECT:
+ rcip->ri_flags |= RTF_INDIRECT;
+ break;
default:
if (dash_keyword) {
syntax_bad_keyword(tok + 1);
@@ -1479,8 +1482,8 @@ args_to_rtcmd(rtcmd_irep_t *rcip, char **argv, char *cmd_string)
}
if (rcip->ri_af == AF_INET6 &&
memcmp(&rcip->ri_mask.sin6.sin6_addr,
- &in6_host_mask,
- sizeof (struct in6_addr)) == 0) {
+ &in6_host_mask,
+ sizeof (struct in6_addr)) == 0) {
rcip->ri_flags |= RTF_HOST;
}
} else {
@@ -1853,8 +1856,8 @@ newroute(char **argv)
break;
case AF_INET6:
if (inet_ntop(AF_INET6,
- (void *)&newrt->ri_dst.sin6.sin6_addr,
- obuf, INET6_ADDRSTRLEN) != NULL) {
+ (void *)&newrt->ri_dst.sin6.sin6_addr,
+ obuf, INET6_ADDRSTRLEN) != NULL) {
(void) printf(" %s", obuf);
break;
}
@@ -2236,7 +2239,7 @@ in_getaddr(char *s, struct sockaddr_in *sin, int *plenp, int which,
inet_lnaof(sin->sin_addr) == INADDR_ANY)) {
/* This looks like a network address. */
inet_makenetandmask(rcip, ntohl(val),
- sin);
+ sin);
}
}
return (B_TRUE);
@@ -2562,7 +2565,7 @@ static char metricnames[] =
static char routeflags[] =
"\1UP\2GATEWAY\3HOST\4REJECT\5DYNAMIC\6MODIFIED\7DONE\010MASK_PRESENT"
"\011CLONING\012XRESOLVE\013LLINFO\014STATIC\015BLACKHOLE"
- "\016PRIVATE\017PROTO2\020PROTO1\021MULTIRT\022SETSRC";
+ "\016PRIVATE\017PROTO2\020PROTO1\021MULTIRT\022SETSRC\023INDIRECT";
static char ifnetflags[] =
"\1UP\2BROADCAST\3DEBUG\4LOOPBACK\5PTP\6NOTRAILERS\7RUNNING\010NOARP"
"\011PPROMISC\012ALLMULTI\013INTELLIGENT\014MULTICAST"
@@ -2623,7 +2626,7 @@ print_rtmsg(struct rt_msghdr *rtm, int msglen)
break;
default:
(void) printf("pid: %ld, seq %d, errno %d, flags:",
- rtm->rtm_pid, rtm->rtm_seq, rtm->rtm_errno);
+ rtm->rtm_pid, rtm->rtm_seq, rtm->rtm_errno);
bprintf(stdout, rtm->rtm_flags, routeflags);
pmsg_common(rtm, msglen);
break;
@@ -2649,7 +2652,7 @@ print_getmsg(rtcmd_irep_t *req_rt, struct rt_msghdr *rtm, int msglen)
if (rtm->rtm_msglen > (ushort_t)msglen) {
(void) fprintf(stderr,
gettext("message length mismatch, in packet %d, "
- "returned %d\n"), rtm->rtm_msglen, msglen);
+ "returned %d\n"), rtm->rtm_msglen, msglen);
}
if (rtm->rtm_errno) {
(void) fprintf(stderr, "RTM_GET: %s (errno %d)\n",
@@ -2675,7 +2678,7 @@ print_getmsg(rtcmd_irep_t *req_rt, struct rt_msghdr *rtm, int msglen)
case RTA_IFP:
if (sa->sa_family == AF_LINK &&
((struct sockaddr_dl *)sa)->
- sdl_nlen != 0)
+ sdl_nlen != 0)
ifp = (struct sockaddr_dl *)sa;
break;
case RTA_SRC:
@@ -3122,8 +3125,8 @@ mibget(int sd)
(void) fprintf(stderr, gettext("mibget %d gives "
"T_ERROR_ACK: TLI_error = 0x%lx, UNIX_error = "
"0x%lx\n"), j, tea->TLI_error, tea->UNIX_error);
- errno = (tea->TLI_error == TSYSERR)
- ? tea->UNIX_error : EPROTO;
+ errno = (tea->TLI_error == TSYSERR) ?
+ tea->UNIX_error : EPROTO;
break;
}
diff --git a/usr/src/cmd/cmd-inet/usr.sbin/traceroute/traceroute.c b/usr/src/cmd/cmd-inet/usr.sbin/traceroute/traceroute.c
index cae75df60d..b8b56259ad 100644
--- a/usr/src/cmd/cmd-inet/usr.sbin/traceroute/traceroute.c
+++ b/usr/src/cmd/cmd-inet/usr.sbin/traceroute/traceroute.c
@@ -166,6 +166,7 @@ boolean_t useicmp = _B_FALSE; /* use icmp echo instead of udp packets */
boolean_t docksum = _B_TRUE; /* calculate checksums */
static boolean_t collect_stat = _B_FALSE; /* print statistics */
boolean_t settos = _B_FALSE; /* set type-of-service field */
+int dontfrag = 0; /* IP*_DONTFRAG */
static int max_timeout = 5; /* quit after this consecutive timeouts */
static boolean_t probe_all = _B_FALSE; /* probe all the IFs of the target */
static boolean_t pick_src = _B_FALSE; /* traceroute picks the src address */
@@ -315,6 +316,7 @@ main(int argc, char **argv)
case 'F':
off = IP_DF;
+ dontfrag = 1;
break;
case 'g':
@@ -1361,6 +1363,24 @@ setup_socket(struct pr_set *pr, int packet_len)
exit(EXIT_FAILURE);
}
}
+
+ /* We enable or disable to not depend on the kernel default */
+ if (pr->family == AF_INET) {
+ if (setsockopt(ssock, IPPROTO_IP, IP_DONTFRAG,
+ (char *)&dontfrag, sizeof (dontfrag)) == -1) {
+ Fprintf(stderr, "%s: IP_DONTFRAG %s\n", prog,
+ strerror(errno));
+ exit(EXIT_FAILURE);
+ }
+ } else {
+ if (setsockopt(ssock, IPPROTO_IPV6, IPV6_DONTFRAG,
+ (char *)&dontfrag, sizeof (dontfrag)) == -1) {
+ Fprintf(stderr, "%s: IPV6_DONTFRAG %s\n", prog,
+ strerror(errno));
+ exit(EXIT_FAILURE);
+ }
+ }
+
if (pr->family == AF_INET) {
rcvsock4 = rsock;
sndsock4 = ssock;
diff --git a/usr/src/cmd/devfsadm/misc_link.c b/usr/src/cmd/devfsadm/misc_link.c
index 222699e479..84cdb42377 100644
--- a/usr/src/cmd/devfsadm/misc_link.c
+++ b/usr/src/cmd/devfsadm/misc_link.c
@@ -104,8 +104,7 @@ static devfsadm_create_t misc_cbt[] = {
"(^ip$)|(^tcp$)|(^udp$)|(^icmp$)|(^sctp$)|"
"(^ip6$)|(^tcp6$)|(^udp6$)|(^icmp6$)|(^sctp6$)|"
"(^rts$)|(^arp$)|(^ipsecah$)|(^ipsecesp$)|(^keysock$)|(^spdsock$)|"
- "(^nca$)|(^rds$)|(^sdp$)|(^ipnet$)|(^dlpistub$)|(^iptunq)|"
- "(^bpf$)",
+ "(^nca$)|(^rds$)|(^sdp$)|(^ipnet$)|(^dlpistub$)|(^bpf$)",
TYPE_EXACT | DRV_RE, ILEVEL_1, minor_name
},
{ "pseudo", "ddi_pseudo",
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);