--- embedaddon/quagga/zebra/zebra_vty.c 2012/10/09 09:22:29 1.1.1.2 +++ embedaddon/quagga/zebra/zebra_vty.c 2013/07/21 23:54:41 1.1.1.3 @@ -535,13 +535,13 @@ vty_show_ip_route_detail (struct vty *vty, struct rout struct rib *rib; struct nexthop *nexthop; - for (rib = rn->info; rib; rib = rib->next) + RNODE_FOREACH_RIB (rn, rib) { vty_out (vty, "Routing entry for %s/%d%s", inet_ntoa (rn->p.u.prefix4), rn->p.prefixlen, VTY_NEWLINE); vty_out (vty, " Known via \"%s\"", zebra_route_string (rib->type)); - vty_out (vty, ", distance %d, metric %d", rib->distance, rib->metric); + vty_out (vty, ", distance %u, metric %u", rib->distance, rib->metric); if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_SELECTED)) vty_out (vty, ", best"); if (rib->refcnt) @@ -822,7 +822,7 @@ DEFUN (show_ip_route, /* Show all IPv4 routes. */ for (rn = route_top (table); rn; rn = route_next (rn)) - for (rib = rn->info; rib; rib = rib->next) + RNODE_FOREACH_RIB (rn, rib) { if (first) { @@ -863,7 +863,7 @@ DEFUN (show_ip_route_prefix_longer, /* Show matched type IPv4 routes. */ for (rn = route_top (table); rn; rn = route_next (rn)) - for (rib = rn->info; rib; rib = rib->next) + RNODE_FOREACH_RIB (rn, rib) if (prefix_match (&p, &rn->p)) { if (first) @@ -896,7 +896,7 @@ DEFUN (show_ip_route_supernets, /* Show matched type IPv4 routes. */ for (rn = route_top (table); rn; rn = route_next (rn)) - for (rib = rn->info; rib; rib = rib->next) + RNODE_FOREACH_RIB (rn, rib) { addr = ntohl (rn->p.u.prefix4.s_addr); @@ -942,7 +942,7 @@ DEFUN (show_ip_route_protocol, /* Show matched type IPv4 routes. */ for (rn = route_top (table); rn; rn = route_next (rn)) - for (rib = rn->info; rib; rib = rib->next) + RNODE_FOREACH_RIB (rn, rib) if (rib->type == type) { if (first) @@ -1046,7 +1046,7 @@ vty_show_ip_route_summary (struct vty *vty, struct rou memset (&rib_cnt, 0, sizeof(rib_cnt)); memset (&fib_cnt, 0, sizeof(fib_cnt)); for (rn = route_top (table); rn; rn = route_next (rn)) - for (rib = rn->info; rib; rib = rib->next) + RNODE_FOREACH_RIB (rn, rib) for (nexthop = rib->nexthop; nexthop; nexthop = nexthop->next) { rib_cnt[ZEBRA_ROUTE_TOTAL]++; @@ -1197,6 +1197,40 @@ DEFUN (show_ip_protocol, return CMD_SUCCESS; } +/* + * Show IP mroute command to dump the BGP Multicast + * routing table + */ +DEFUN (show_ip_mroute, + show_ip_mroute_cmd, + "show ip mroute", + SHOW_STR + IP_STR + "IP Multicast routing table\n") +{ + struct route_table *table; + struct route_node *rn; + struct rib *rib; + int first = 1; + + table = vrf_table (AFI_IP, SAFI_MULTICAST, 0); + if (! table) + return CMD_SUCCESS; + + /* Show all IPv4 routes. */ + for (rn = route_top (table); rn; rn = route_next (rn)) + RNODE_FOREACH_RIB (rn, rib) + { + if (first) + { + vty_out (vty, SHOW_ROUTE_V4_HEADER); + first = 0; + } + vty_show_ip_route (vty, rn, rib); + } + return CMD_SUCCESS; +} + #ifdef HAVE_IPV6 /* General fucntion for IPv6 static route. */ @@ -1512,14 +1546,14 @@ vty_show_ipv6_route_detail (struct vty *vty, struct ro struct nexthop *nexthop; char buf[BUFSIZ]; - for (rib = rn->info; rib; rib = rib->next) + RNODE_FOREACH_RIB (rn, rib) { vty_out (vty, "Routing entry for %s/%d%s", inet_ntop (AF_INET6, &rn->p.u.prefix6, buf, BUFSIZ), rn->p.prefixlen, VTY_NEWLINE); vty_out (vty, " Known via \"%s\"", zebra_route_string (rib->type)); - vty_out (vty, ", distance %d, metric %d", rib->distance, rib->metric); + vty_out (vty, ", distance %u, metric %u", rib->distance, rib->metric); if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_SELECTED)) vty_out (vty, ", best"); if (rib->refcnt) @@ -1761,7 +1795,7 @@ DEFUN (show_ipv6_route, /* Show all IPv6 route. */ for (rn = route_top (table); rn; rn = route_next (rn)) - for (rib = rn->info; rib; rib = rib->next) + RNODE_FOREACH_RIB (rn, rib) { if (first) { @@ -1802,7 +1836,7 @@ DEFUN (show_ipv6_route_prefix_longer, /* Show matched type IPv6 routes. */ for (rn = route_top (table); rn; rn = route_next (rn)) - for (rib = rn->info; rib; rib = rib->next) + RNODE_FOREACH_RIB (rn, rib) if (prefix_match (&p, &rn->p)) { if (first) @@ -1842,7 +1876,7 @@ DEFUN (show_ipv6_route_protocol, /* Show matched type IPv6 routes. */ for (rn = route_top (table); rn; rn = route_next (rn)) - for (rib = rn->info; rib; rib = rib->next) + RNODE_FOREACH_RIB (rn, rib) if (rib->type == type) { if (first) @@ -1952,40 +1986,6 @@ DEFUN (show_ipv6_route_summary, } /* - * Show IP mroute command to dump the BGP Multicast - * routing table - */ -DEFUN (show_ip_mroute, - show_ip_mroute_cmd, - "show ip mroute", - SHOW_STR - IP_STR - "IP Multicast routing table\n") -{ - struct route_table *table; - struct route_node *rn; - struct rib *rib; - int first = 1; - - table = vrf_table (AFI_IP, SAFI_MULTICAST, 0); - if (! table) - return CMD_SUCCESS; - - /* Show all IPv4 routes. */ - for (rn = route_top (table); rn; rn = route_next (rn)) - for (rib = rn->info; rib; rib = rib->next) - { - if (first) - { - vty_out (vty, SHOW_ROUTE_V4_HEADER); - first = 0; - } - vty_show_ip_route (vty, rn, rib); - } - return CMD_SUCCESS; -} - -/* * Show IPv6 mroute command.Used to dump * the Multicast routing table. */ @@ -2008,7 +2008,7 @@ DEFUN (show_ipv6_mroute, /* Show all IPv6 route. */ for (rn = route_top (table); rn; rn = route_next (rn)) - for (rib = rn->info; rib; rib = rib->next) + RNODE_FOREACH_RIB (rn, rib) { if (first) { @@ -2019,11 +2019,6 @@ DEFUN (show_ipv6_mroute, } return CMD_SUCCESS; } - - - - - /* Write IPv6 static route configuration. */ static int