Print this page
%B


 324                 mdb_warn("failed to walk zone");
 325                 return (NULL);
 326         }
 327 
 328         if (zi_cb.shared_ip_zone) {
 329                 mdb_warn("%s is a Shared-IP zone, try '-s global' instead\n",
 330                     zone_name);
 331                 return (NULL);
 332         }
 333 
 334         if (zi_cb.ipst == NULL) {
 335                 mdb_warn("failed to find zone %s\n", zone_name);
 336                 return (NULL);
 337         }
 338 
 339         return (zi_cb.ipst);
 340 }
 341 
 342 /*
 343  * Generic network stack walker initialization function.  It is used by all
 344  * other netwrok stack walkers.
 345  */
 346 int
 347 ns_walk_init(mdb_walk_state_t *wsp)
 348 {
 349         if (mdb_layered_walk("netstack", wsp) == -1) {
 350                 mdb_warn("can't walk 'netstack'");
 351                 return (WALK_ERR);
 352         }
 353         return (WALK_NEXT);
 354 }
 355 
 356 /*
 357  * Generic network stack walker stepping function.  It is used by all other
 358  * network stack walkers.  The which parameter differentiates the different
 359  * walkers.
 360  */
 361 int
 362 ns_walk_step(mdb_walk_state_t *wsp, int which)
 363 {
 364         uintptr_t kaddr;
 365         netstack_t nss;
 366 
 367         if (mdb_vread(&nss, sizeof (nss), wsp->walk_addr) == -1) {
 368                 mdb_warn("can't read netstack at %p", wsp->walk_addr);
 369                 return (WALK_ERR);
 370         }
 371         kaddr = (uintptr_t)nss.netstack_modules[which];
 372 
 373         return (wsp->walk_callback(kaddr, wsp->walk_layer, wsp->walk_cbdata));
 374 }
 375 
 376 /*









 377  * IP network stack walker stepping function.
 378  */
 379 int
 380 ip_stacks_walk_step(mdb_walk_state_t *wsp)
 381 {
 382         return (ns_walk_step(wsp, NS_IP));
 383 }
 384 
 385 /*
 386  * TCP network stack walker stepping function.
 387  */
 388 int
 389 tcp_stacks_walk_step(mdb_walk_state_t *wsp)
 390 {
 391         return (ns_walk_step(wsp, NS_TCP));
 392 }
 393 
 394 /*
 395  * SCTP network stack walker stepping function.
 396  */


1936                 ill_walk_init, ill_walk_step, NULL },
1937         { "ipif", "walk list of ipif structures for all stacks",
1938                 ipif_walk_init, ipif_walk_step, NULL },
1939         { "ipif_list", "walk the linked list of ipif structures "
1940                 "for a given ill",
1941                 ip_list_walk_init, ip_list_walk_step,
1942                 ip_list_walk_fini, &ipif_walk_arg },
1943         { "srcid", "walk list of srcid_map structures for all stacks",
1944                 ip_stacks_common_walk_init, srcid_walk_step, NULL },
1945         { "srcid_list", "walk list of srcid_map structures for a stack",
1946                 ip_list_walk_init, ip_list_walk_step, ip_list_walk_fini,
1947                 &srcid_walk_arg },
1948         { "ire", "walk active ire_t structures",
1949                 ire_walk_init, ire_walk_step, NULL },
1950         { "ire_next", "walk ire_t structures in the ctable",
1951                 ire_next_walk_init, ire_next_walk_step, NULL },
1952         { "nce", "walk active nce_t structures",
1953                 nce_walk_init, nce_walk_step, NULL },
1954         { "dce", "walk active dce_t structures",
1955                 dce_walk_init, dce_walk_step, NULL },


1956         { "ip_stacks", "walk all the ip_stack_t",
1957                 ns_walk_init, ip_stacks_walk_step, NULL },
1958         { "tcp_stacks", "walk all the tcp_stack_t",
1959                 ns_walk_init, tcp_stacks_walk_step, NULL },
1960         { "sctp_stacks", "walk all the sctp_stack_t",
1961                 ns_walk_init, sctp_stacks_walk_step, NULL },
1962         { "udp_stacks", "walk all the udp_stack_t",
1963                 ns_walk_init, udp_stacks_walk_step, NULL },
1964         { "th_hash", "walk all the th_hash_t entries",
1965                 th_hash_walk_init, th_hash_walk_step, NULL },
1966         { "ncec", "walk list of ncec structures for all stacks",
1967                 ip_stacks_common_walk_init, ncec_walk_step, NULL },
1968         { "ncec_stack", "walk list of ncec structures",
1969                 ncec_stack_walk_init, ncec_stack_walk_step,
1970                 ncec_stack_walk_fini},
1971         { "udp_hash", "walk list of conn_t structures in ips_ipcl_udp_fanout",
1972                 ipcl_hash_walk_init, ipcl_hash_walk_step,
1973                 ipcl_hash_walk_fini, &udp_hash_arg},
1974         { "conn_hash", "walk list of conn_t structures in ips_ipcl_conn_fanout",
1975                 ipcl_hash_walk_init, ipcl_hash_walk_step,




 324                 mdb_warn("failed to walk zone");
 325                 return (NULL);
 326         }
 327 
 328         if (zi_cb.shared_ip_zone) {
 329                 mdb_warn("%s is a Shared-IP zone, try '-s global' instead\n",
 330                     zone_name);
 331                 return (NULL);
 332         }
 333 
 334         if (zi_cb.ipst == NULL) {
 335                 mdb_warn("failed to find zone %s\n", zone_name);
 336                 return (NULL);
 337         }
 338 
 339         return (zi_cb.ipst);
 340 }
 341 
 342 /*
 343  * Generic network stack walker initialization function.  It is used by all
 344  * other network stack walkers.
 345  */
 346 int
 347 ns_walk_init(mdb_walk_state_t *wsp)
 348 {
 349         if (mdb_layered_walk("netstack", wsp) == -1) {
 350                 mdb_warn("can't walk 'netstack'");
 351                 return (WALK_ERR);
 352         }
 353         return (WALK_NEXT);
 354 }
 355 
 356 /*
 357  * Generic network stack walker stepping function.  It is used by all other
 358  * network stack walkers.  The which parameter differentiates the different
 359  * walkers.
 360  */
 361 int
 362 ns_walk_step(mdb_walk_state_t *wsp, int which)
 363 {
 364         uintptr_t kaddr;
 365         netstack_t nss;
 366 
 367         if (mdb_vread(&nss, sizeof (nss), wsp->walk_addr) == -1) {
 368                 mdb_warn("can't read netstack at %p", wsp->walk_addr);
 369                 return (WALK_ERR);
 370         }
 371         kaddr = (uintptr_t)nss.netstack_modules[which];
 372 
 373         return (wsp->walk_callback(kaddr, wsp->walk_layer, wsp->walk_cbdata));
 374 }
 375 
 376 /*
 377  * DCCP network stack walker stepping function.
 378  */
 379 int
 380 dccp_stacks_walk_step(mdb_walk_state_t *wsp)
 381 {
 382         return (ns_walk_step(wsp, NS_DCCP));
 383 }
 384 
 385 /*
 386  * IP network stack walker stepping function.
 387  */
 388 int
 389 ip_stacks_walk_step(mdb_walk_state_t *wsp)
 390 {
 391         return (ns_walk_step(wsp, NS_IP));
 392 }
 393 
 394 /*
 395  * TCP network stack walker stepping function.
 396  */
 397 int
 398 tcp_stacks_walk_step(mdb_walk_state_t *wsp)
 399 {
 400         return (ns_walk_step(wsp, NS_TCP));
 401 }
 402 
 403 /*
 404  * SCTP network stack walker stepping function.
 405  */


1945                 ill_walk_init, ill_walk_step, NULL },
1946         { "ipif", "walk list of ipif structures for all stacks",
1947                 ipif_walk_init, ipif_walk_step, NULL },
1948         { "ipif_list", "walk the linked list of ipif structures "
1949                 "for a given ill",
1950                 ip_list_walk_init, ip_list_walk_step,
1951                 ip_list_walk_fini, &ipif_walk_arg },
1952         { "srcid", "walk list of srcid_map structures for all stacks",
1953                 ip_stacks_common_walk_init, srcid_walk_step, NULL },
1954         { "srcid_list", "walk list of srcid_map structures for a stack",
1955                 ip_list_walk_init, ip_list_walk_step, ip_list_walk_fini,
1956                 &srcid_walk_arg },
1957         { "ire", "walk active ire_t structures",
1958                 ire_walk_init, ire_walk_step, NULL },
1959         { "ire_next", "walk ire_t structures in the ctable",
1960                 ire_next_walk_init, ire_next_walk_step, NULL },
1961         { "nce", "walk active nce_t structures",
1962                 nce_walk_init, nce_walk_step, NULL },
1963         { "dce", "walk active dce_t structures",
1964                 dce_walk_init, dce_walk_step, NULL },
1965         { "dccp_stacks", "walk all the dccp_stack_t",
1966                 ns_walk_init, dccp_stacks_walk_step, NULL },
1967         { "ip_stacks", "walk all the ip_stack_t",
1968                 ns_walk_init, ip_stacks_walk_step, NULL },
1969         { "tcp_stacks", "walk all the tcp_stack_t",
1970                 ns_walk_init, tcp_stacks_walk_step, NULL },
1971         { "sctp_stacks", "walk all the sctp_stack_t",
1972                 ns_walk_init, sctp_stacks_walk_step, NULL },
1973         { "udp_stacks", "walk all the udp_stack_t",
1974                 ns_walk_init, udp_stacks_walk_step, NULL },
1975         { "th_hash", "walk all the th_hash_t entries",
1976                 th_hash_walk_init, th_hash_walk_step, NULL },
1977         { "ncec", "walk list of ncec structures for all stacks",
1978                 ip_stacks_common_walk_init, ncec_walk_step, NULL },
1979         { "ncec_stack", "walk list of ncec structures",
1980                 ncec_stack_walk_init, ncec_stack_walk_step,
1981                 ncec_stack_walk_fini},
1982         { "udp_hash", "walk list of conn_t structures in ips_ipcl_udp_fanout",
1983                 ipcl_hash_walk_init, ipcl_hash_walk_step,
1984                 ipcl_hash_walk_fini, &udp_hash_arg},
1985         { "conn_hash", "walk list of conn_t structures in ips_ipcl_conn_fanout",
1986                 ipcl_hash_walk_init, ipcl_hash_walk_step,