| 398 | } |
| 399 | |
| 400 | static void |
| 401 | print_nhops_sysctl(int fibnum, int af) |
| 402 | { |
| 403 | struct nhops_dump nd; |
| 404 | struct nhop_external *nh; |
| 405 | int fam; |
| 406 | struct rt_msghdr *rtm; |
| 407 | |
| 408 | dump_nhops_sysctl(fibnum, af, &nd); |
| 409 | |
| 410 | xo_open_container("nhop-table"); |
| 411 | xo_open_list("rt-family"); |
| 412 | if (nd.nh_count > 0) { |
| 413 | nh = (struct nhop_external *)(nd.nh_map[0].rtm + 1); |
| 414 | fam = nh->nh_family; |
| 415 | |
| 416 | wid_dst = WID_GW_DEFAULT(fam); |
| 417 | wid_gw = WID_GW_DEFAULT(fam); |
| 418 | wid_nhidx = 5; |
| 419 | wid_nhtype = 12; |
| 420 | wid_refcnt = 6; |
| 421 | wid_flags = 6; |
| 422 | wid_pksent = 8; |
| 423 | wid_mtu = 6; |
| 424 | wid_if = WID_IF_DEFAULT(fam); |
| 425 | xo_open_instance("rt-family"); |
| 426 | pr_family(fam); |
| 427 | xo_open_list("nh-entry"); |
| 428 | |
| 429 | print_nhop_header(fam); |
| 430 | |
| 431 | for (size_t i = 0; i < nd.nh_count; i++) { |
| 432 | rtm = nd.nh_map[i].rtm; |
| 433 | nh = (struct nhop_external *)(rtm + 1); |
| 434 | print_nhop_entry_sysctl("nh-entry", rtm, nh); |
| 435 | } |
| 436 | |
| 437 | xo_close_list("nh-entry"); |
| 438 | xo_close_instance("rt-family"); |
| 439 | } |
| 440 | xo_close_list("rt-family"); |
| 441 | xo_close_container("nhop-table"); |
| 442 | free(nd.nh_buf); |
| 443 | } |
| 444 | |
| 445 | #ifndef FSTACK |
| 446 | static void |
no test coverage detected