* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with GNU Zebra; see the file COPYING. If not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * You should have received a copy of the GNU General Public License along
+ * with this program; see the file COPYING; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <zebra.h>
extern int allow_delete;
static int do_show_ip_route(struct vty *vty, const char *vrf_name,
- safi_t safi, u_char use_json);
+ safi_t safi, bool use_fib, u_char use_json);
static void vty_show_ip_route_detail (struct vty *vty, struct route_node *rn,
int mcast);
IP_STR
"Display RPF information for multicast source\n")
{
- return do_show_ip_route(vty, VRF_DEFAULT_NAME, SAFI_MULTICAST, 0);
+ return do_show_ip_route(vty, VRF_DEFAULT_NAME, SAFI_MULTICAST, false, 0);
}
DEFUN (show_ip_rpf_addr,
/* Label information */
if (nexthop->nh_label && nexthop->nh_label->num_labels)
{
- vty_out (vty, " label %s",
+ vty_out (vty, ", label %s",
mpls_label2str (nexthop->nh_label->num_labels,
- nexthop->nh_label->label, buf, BUFSIZ));
+ nexthop->nh_label->label, buf, BUFSIZ, 1));
}
vty_out (vty, "%s", VTY_NEWLINE);
json_object *json_nexthops = NULL;
json_object *json_nexthop = NULL;
json_object *json_route = NULL;
+ json_object *json_labels = NULL;
if (json)
{
break;
}
+ if (nexthop->nh_label && nexthop->nh_label->num_labels)
+ {
+ json_labels = json_object_new_array();
+
+ for (int label_index = 0; label_index < nexthop->nh_label->num_labels; label_index++)
+ json_object_array_add(json_labels, json_object_new_int(nexthop->nh_label->label[label_index]));
+
+ json_object_object_add(json_nexthop, "labels", json_labels);
+ }
+
json_object_array_add(json_nexthops, json_nexthop);
}
/* Label information */
if (nexthop->nh_label && nexthop->nh_label->num_labels)
{
- vty_out (vty, " label %s",
+ vty_out (vty, ", label %s",
mpls_label2str (nexthop->nh_label->num_labels,
- nexthop->nh_label->label, buf, BUFSIZ));
+ nexthop->nh_label->label, buf, BUFSIZ, 1));
}
if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_BLACKHOLE))
}
}
+static bool
+use_fib (struct cmd_token *token)
+{
+ return strncmp(token->arg, "route", strlen(token->arg));
+}
+
DEFUN (show_ip_route,
show_ip_route_cmd,
- "show ip route [json]",
+ "show ip <fib|route> [json]",
SHOW_STR
IP_STR
+ "IP forwarding table\n"
"IP routing table\n"
JSON_STR)
{
- return do_show_ip_route (vty, VRF_DEFAULT_NAME, SAFI_UNICAST, use_json(argc, argv));
+ return do_show_ip_route (vty, VRF_DEFAULT_NAME, SAFI_UNICAST,
+ use_fib(argv[2]), use_json(argc, argv));
}
static int
do_show_ip_route (struct vty *vty, const char *vrf_name, safi_t safi,
- u_char use_json)
+ bool use_fib, u_char use_json)
{
struct route_table *table;
struct route_node *rn;
{
RNODE_FOREACH_RIB (rn, rib)
{
+ if (use_fib && !CHECK_FLAG(rib->status, RIB_ENTRY_SELECTED_FIB))
+ continue;
if (!json_prefix)
json_prefix = json_object_new_array();
vty_show_ip_route (vty, rn, rib, json_prefix);
{
RNODE_FOREACH_RIB (rn, rib)
{
+ if (use_fib && !CHECK_FLAG(rib->status, RIB_ENTRY_SELECTED_FIB))
+ continue;
if (first)
{
vty_out (vty, SHOW_ROUTE_V4_HEADER);
DEFUN (show_ip_route_vrf,
show_ip_route_vrf_cmd,
- "show ip route vrf NAME [json]",
+ "show ip <fib|route> vrf NAME [json]",
SHOW_STR
IP_STR
+ "IP forwarding table\n"
"IP routing table\n"
VRF_CMD_HELP_STR
JSON_STR)
{
int idx_vrf = 4;
+ bool uf = use_fib(argv[2]);
u_char uj = use_json(argc, argv);
- return do_show_ip_route (vty, argv[idx_vrf]->arg, SAFI_UNICAST, uj);
+ return do_show_ip_route (vty, argv[idx_vrf]->arg, SAFI_UNICAST, uf, uj);
}
DEFUN (show_ip_nht,
DEFUN (show_ip_route_tag,
show_ip_route_tag_cmd,
- "show ip route [vrf NAME] tag (1-4294967295)",
+ "show ip <fib|route> [vrf NAME] tag (1-4294967295)",
SHOW_STR
IP_STR
+ "IP forwarding table\n"
"IP routing table\n"
VRF_CMD_HELP_STR
"Show only routes with tag\n"
"Tag value\n")
{
+ bool uf = use_fib(argv[2]);
int idx_vrf = 3;
int idx_name = 4;
int idx_tag = 6;
for (rn = route_top (table); rn; rn = route_next (rn))
RNODE_FOREACH_RIB (rn, rib)
{
+ if (uf && !CHECK_FLAG(rib->status, RIB_ENTRY_SELECTED_FIB))
+ continue;
if (rib->tag != tag)
continue;
DEFUN (show_ip_route_prefix_longer,
show_ip_route_prefix_longer_cmd,
- "show ip route [vrf NAME] A.B.C.D/M longer-prefixes",
+ "show ip <fib|route> [vrf NAME] A.B.C.D/M longer-prefixes",
SHOW_STR
IP_STR
+ "IP forwarding table\n"
"IP routing table\n"
VRF_CMD_HELP_STR
"IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
struct prefix p;
int ret;
int first = 1;
+ bool uf = use_fib(argv[2]);
vrf_id_t vrf_id = VRF_DEFAULT;
if (strmatch(argv[3]->text, "vrf"))
RNODE_FOREACH_RIB (rn, rib)
if (prefix_match (&p, &rn->p))
{
+ if (uf && !CHECK_FLAG(rib->status, RIB_ENTRY_SELECTED_FIB))
+ continue;
if (first)
{
vty_out (vty, SHOW_ROUTE_V4_HEADER);
DEFUN (show_ip_route_supernets,
show_ip_route_supernets_cmd,
- "show ip route [vrf NAME] supernets-only",
+ "show ip <fib|route> [vrf NAME] supernets-only",
SHOW_STR
IP_STR
+ "IP forwarding table\n"
"IP routing table\n"
VRF_CMD_HELP_STR
"Show supernet entries only\n")
u_int32_t addr;
int first = 1;
vrf_id_t vrf_id = VRF_DEFAULT;
+ bool uf = use_fib(argv[2]);
if (strmatch(argv[3]->text, "vrf"))
VRF_GET_ID (vrf_id, argv[4]->arg);
for (rn = route_top (table); rn; rn = route_next (rn))
RNODE_FOREACH_RIB (rn, rib)
{
+ if (uf && !CHECK_FLAG(rib->status, RIB_ENTRY_SELECTED_FIB))
+ continue;
addr = ntohl (rn->p.u.prefix4.s_addr);
if ((IN_CLASSC (addr) && rn->p.prefixlen < 24)
DEFUN (show_ip_route_protocol,
show_ip_route_protocol_cmd,
- "show ip route [vrf NAME] " FRR_IP_REDIST_STR_ZEBRA,
+ "show ip <fib|route> [vrf NAME] " FRR_IP_REDIST_STR_ZEBRA,
SHOW_STR
IP_STR
+ "IP forwarding table\n"
"IP routing table\n"
VRF_CMD_HELP_STR
FRR_IP_REDIST_HELP_STR_ZEBRA)
struct rib *rib;
int first = 1;
vrf_id_t vrf_id = VRF_DEFAULT;
+ bool uf = use_fib(argv[2]);
int idx = 0;
if (argv_find (argv, argc, "NAME", &idx))
RNODE_FOREACH_RIB (rn, rib)
if (rib->type == type)
{
+ if (uf && !CHECK_FLAG(rib->status, RIB_ENTRY_SELECTED_FIB))
+ continue;
if (first)
{
vty_out (vty, SHOW_ROUTE_V4_HEADER);
DEFUN (show_ip_route_ospf_instance,
show_ip_route_ospf_instance_cmd,
- "show ip route ospf (1-65535)",
+ "show ip <fib|route> ospf (1-65535)",
SHOW_STR
IP_STR
+ "IP forwarding table\n"
"IP routing table\n"
"Open Shortest Path First (OSPFv2)\n"
"Instance ID\n")
struct rib *rib;
int first = 1;
u_short instance = 0;
+ bool uf = use_fib(argv[2]);
VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg);
RNODE_FOREACH_RIB (rn, rib)
if (rib->type == ZEBRA_ROUTE_OSPF && rib->instance == instance)
{
+ if (uf && !CHECK_FLAG(rib->status, RIB_ENTRY_SELECTED_FIB))
+ continue;
if (first)
{
vty_out (vty, SHOW_ROUTE_V4_HEADER);
DEFUN (show_ip_route_vrf_all,
show_ip_route_vrf_all_cmd,
- "show ip route vrf all",
+ "show ip <fib|route> vrf all",
SHOW_STR
IP_STR
+ "IP forwarding table\n"
"IP routing table\n"
VRF_ALL_CMD_HELP_STR)
{
struct zebra_vrf *zvrf;
int first = 1;
int vrf_header = 1;
+ bool uf = use_fib(argv[2]);
RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name)
{
for (rn = route_top (table); rn; rn = route_next (rn))
RNODE_FOREACH_RIB (rn, rib)
{
+ if (uf && !CHECK_FLAG(rib->status, RIB_ENTRY_SELECTED_FIB))
+ continue;
if (first)
{
vty_out (vty, SHOW_ROUTE_V4_HEADER);
DEFUN (show_ip_route_vrf_all_tag,
show_ip_route_vrf_all_tag_cmd,
- "show ip route vrf all tag (1-4294967295)",
+ "show ip <fib|route> vrf all tag (1-4294967295)",
SHOW_STR
IP_STR
+ "IP forwarding table\n"
"IP routing table\n"
VRF_ALL_CMD_HELP_STR
"Show only routes with tag\n"
int first = 1;
int vrf_header = 1;
route_tag_t tag = 0;
+ bool uf = use_fib(argv[2]);
if (argv[idx_number]->arg)
VTY_GET_INTEGER_RANGE("tag", tag, argv[idx_number]->arg, 0, 4294967295);
for (rn = route_top (table); rn; rn = route_next (rn))
RNODE_FOREACH_RIB (rn, rib)
{
+ if (uf && !CHECK_FLAG(rib->status, RIB_ENTRY_SELECTED_FIB))
+ continue;
if (rib->tag != tag)
continue;
DEFUN (show_ip_route_vrf_all_prefix_longer,
show_ip_route_vrf_all_prefix_longer_cmd,
- "show ip route vrf all A.B.C.D/M longer-prefixes",
+ "show ip <fib|route> vrf all A.B.C.D/M longer-prefixes",
SHOW_STR
IP_STR
+ "IP forwarding table\n"
"IP routing table\n"
VRF_ALL_CMD_HELP_STR
"IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
int ret;
int first = 1;
int vrf_header = 1;
+ bool uf = use_fib(argv[2]);
ret = str2prefix (argv[idx_ipv4_prefixlen]->arg, &p);
if (! ret)
RNODE_FOREACH_RIB (rn, rib)
if (prefix_match (&p, &rn->p))
{
+ if (uf && !CHECK_FLAG(rib->status, RIB_ENTRY_SELECTED_FIB))
+ continue;
if (first)
{
vty_out (vty, SHOW_ROUTE_V4_HEADER);
DEFUN (show_ip_route_vrf_all_supernets,
show_ip_route_vrf_all_supernets_cmd,
- "show ip route vrf all supernets-only",
+ "show ip <fib|route> vrf all supernets-only",
SHOW_STR
IP_STR
+ "IP forwarding table\n"
"IP routing table\n"
VRF_ALL_CMD_HELP_STR
"Show supernet entries only\n")
u_int32_t addr;
int first = 1;
int vrf_header = 1;
+ bool uf = use_fib(argv[2]);
RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name)
{
for (rn = route_top (table); rn; rn = route_next (rn))
RNODE_FOREACH_RIB (rn, rib)
{
+ if (uf && !CHECK_FLAG(rib->status, RIB_ENTRY_SELECTED_FIB))
+ continue;
+
addr = ntohl (rn->p.u.prefix4.s_addr);
if ((IN_CLASSC (addr) && rn->p.prefixlen < 24)
DEFUN (show_ip_route_vrf_all_protocol,
show_ip_route_vrf_all_protocol_cmd,
- "show ip route vrf all " FRR_IP_REDIST_STR_ZEBRA,
+ "show ip <fib|route> vrf all " FRR_IP_REDIST_STR_ZEBRA,
SHOW_STR
IP_STR
+ "IP forwarding table\n"
"IP routing table\n"
VRF_ALL_CMD_HELP_STR
FRR_IP_REDIST_HELP_STR_ZEBRA"\n")
struct zebra_vrf *zvrf;
int first = 1;
int vrf_header = 1;
+ bool uf = use_fib(argv[2]);
char *proto = argv[argc - 1]->text;
type = proto_redistnum (AFI_IP, proto);
RNODE_FOREACH_RIB (rn, rib)
if (rib->type == type)
{
+ if (uf && !CHECK_FLAG(rib->status, RIB_ENTRY_SELECTED_FIB))
+ continue;
if (first)
{
vty_out (vty, SHOW_ROUTE_V4_HEADER);
return CMD_SUCCESS;
}
-/* Write IPv4 static route configuration. */
+/* Write static route configuration. */
static int
-static_config_ipv4 (struct vty *vty, safi_t safi, const char *cmd)
+static_config (struct vty *vty, afi_t afi, safi_t safi, const char *cmd)
{
struct route_node *rn;
struct static_route *si;
struct route_table *stable;
struct vrf *vrf;
struct zebra_vrf *zvrf;
- char buf[BUFSIZ];
+ char buf[SRCDEST2STR_BUFFER];
int write =0;
RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name)
{
if (!(zvrf = vrf->info))
continue;
- if ((stable = zvrf->stable[AFI_IP][safi]) == NULL)
+ if ((stable = zvrf->stable[afi][safi]) == NULL)
continue;
- for (rn = route_top (stable); rn; rn = route_next (rn))
+ for (rn = route_top (stable); rn; rn = srcdest_route_next (rn))
for (si = rn->info; si; si = si->next)
{
- vty_out (vty, "%s %s", cmd, prefix2str (&rn->p, buf, sizeof buf));
+ vty_out (vty, "%s %s", cmd, srcdest_rnode2str (rn, buf, sizeof buf));
switch (si->type)
{
case STATIC_IPV4_GATEWAY:
vty_out (vty, " %s", inet_ntoa (si->addr.ipv4));
break;
+ case STATIC_IPV6_GATEWAY:
+ vty_out (vty, " %s", inet_ntop (AF_INET6, &si->addr.ipv6, buf, BUFSIZ));
+ break;
case STATIC_IFINDEX:
vty_out (vty, " %s", si->ifname);
break;
case STATIC_BLACKHOLE:
vty_out (vty, " Null0");
break;
- case STATIC_IPV6_GATEWAY:
- vty_out (vty, " %s", inet_ntop (AF_INET6, &si->addr.ipv6, buf, BUFSIZ));
- break;
- case STATIC_IPV6_GATEWAY_IFINDEX:
- vty_out (vty, " %s %s",
- inet_ntop (AF_INET6, &si->addr.ipv6, buf, BUFSIZ),
- ifindex2ifname (si->ifindex, si->vrf_id));
- break;
+ case STATIC_IPV6_GATEWAY_IFINDEX:
+ vty_out (vty, " %s %s",
+ inet_ntop (AF_INET6, &si->addr.ipv6, buf, BUFSIZ),
+ ifindex2ifname (si->ifindex, si->vrf_id));
+ break;
}
/* flags are incompatible with STATIC_BLACKHOLE */
vty_out (vty, " %d", si->distance);
if (si->vrf_id != VRF_DEFAULT)
- vty_out (vty, " vrf %s", zvrf ? zvrf_name (zvrf) : "");
+ vty_out (vty, " vrf %s", zvrf_name (zvrf));
/* Label information */
if (si->snh_label.num_labels)
vty_out (vty, " label %s",
mpls_label2str (si->snh_label.num_labels,
- si->snh_label.label, buf, sizeof buf));
+ si->snh_label.label, buf, sizeof buf, 0));
vty_out (vty, "%s", VTY_NEWLINE);
DEFUN (show_ipv6_route,
show_ipv6_route_cmd,
- "show ipv6 route [vrf NAME] [json]",
+ "show ipv6 <fib|route> [vrf NAME] [json]",
SHOW_STR
IP_STR
+ "IPv6 forwarding table\n"
"IPv6 routing table\n"
VRF_CMD_HELP_STR
"Output JSON\n")
char buf[SRCDEST2STR_BUFFER];
json_object *json = NULL;
json_object *json_prefix = NULL;
+ bool uf = use_fib(argv[2]);
int vrf = (argc > 3 && strmatch (argv[3]->text, "vrf"));
int uj = vrf ? argc == 6 : argc == 4;
{
RNODE_FOREACH_RIB (rn, rib)
{
+ if (uf && !CHECK_FLAG(rib->status, RIB_ENTRY_SELECTED_FIB))
+ continue;
if (!json_prefix)
json_prefix = json_object_new_array();
vty_show_ip_route (vty, rn, rib, json_prefix);
{
RNODE_FOREACH_RIB (rn, rib)
{
+ if (uf && !CHECK_FLAG(rib->status, RIB_ENTRY_SELECTED_FIB))
+ continue;
if (first)
{
vty_out (vty, SHOW_ROUTE_V6_HEADER);
DEFUN (show_ipv6_route_tag,
show_ipv6_route_tag_cmd,
- "show ipv6 route [vrf NAME] tag (1-4294967295)",
+ "show ipv6 <fib|route> [vrf NAME] tag (1-4294967295)",
SHOW_STR
IP_STR
+ "IPv6 forwarding table\n"
"IPv6 routing table\n"
VRF_CMD_HELP_STR
"Show only routes with tag\n"
int first = 1;
route_tag_t tag = 0;
vrf_id_t vrf_id = VRF_DEFAULT;
+ bool uf = use_fib(argv[2]);
if (strmatch(argv[idx_vrf]->text, "vrf"))
{
for (rn = route_top (table); rn; rn = srcdest_route_next (rn))
RNODE_FOREACH_RIB (rn, rib)
{
+ if (uf && !CHECK_FLAG(rib->status, RIB_ENTRY_SELECTED_FIB))
+ continue;
if (rib->tag != tag)
continue;
DEFUN (show_ipv6_route_prefix_longer,
show_ipv6_route_prefix_longer_cmd,
- "show ipv6 route [vrf NAME] X:X::X:X/M longer-prefixes",
+ "show ipv6 <fib|route> [vrf NAME] X:X::X:X/M longer-prefixes",
SHOW_STR
IP_STR
+ "IPv6 forwarding table\n"
"IPv6 routing table\n"
VRF_CMD_HELP_STR
"IPv6 prefix\n"
int ret;
int first = 1;
vrf_id_t vrf_id = VRF_DEFAULT;
+ bool uf = use_fib(argv[2]);
if (strmatch(argv[3]->text, "vrf"))
{
struct prefix *p, *src_p;
srcdest_rnode_prefixes(rn, &p, &src_p);
+ if (uf && !CHECK_FLAG(rib->status, RIB_ENTRY_SELECTED_FIB))
+ continue;
if (prefix_match (p, &rn->p))
{
if (first)
DEFUN (show_ipv6_route_protocol,
show_ipv6_route_protocol_cmd,
- "show ipv6 route [vrf NAME] " FRR_IP6_REDIST_STR_ZEBRA,
+ "show ipv6 <fib|route> [vrf NAME] " FRR_IP6_REDIST_STR_ZEBRA,
SHOW_STR
IP_STR
- "IP routing table\n"
+ "IPv6 forwarding table\n"
+ "IPv6 routing table\n"
VRF_CMD_HELP_STR
FRR_IP6_REDIST_HELP_STR_ZEBRA)
{
struct rib *rib;
int first = 1;
vrf_id_t vrf_id = VRF_DEFAULT;
+ bool uf = use_fib(argv[2]);
int idx = 0;
if (argv_find (argv, argc, "NAME", &idx))
RNODE_FOREACH_RIB (rn, rib)
if (rib->type == type)
{
+ if (uf && !CHECK_FLAG(rib->status, RIB_ENTRY_SELECTED_FIB))
+ continue;
if (first)
{
vty_out (vty, SHOW_ROUTE_V6_HEADER);
DEFUN (show_ipv6_route_vrf_all,
show_ipv6_route_vrf_all_cmd,
- "show ipv6 route vrf all",
+ "show ipv6 <fib|route> vrf all",
SHOW_STR
IP_STR
+ "IPv6 forwarding table\n"
"IPv6 routing table\n"
VRF_ALL_CMD_HELP_STR)
{
struct zebra_vrf *zvrf;
int first = 1;
int vrf_header = 1;
+ bool uf = use_fib(argv[2]);
RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name)
{
for (rn = route_top (table); rn; rn = srcdest_route_next (rn))
RNODE_FOREACH_RIB (rn, rib)
{
+ if (uf && !CHECK_FLAG(rib->status, RIB_ENTRY_SELECTED_FIB))
+ continue;
if (first)
{
vty_out (vty, SHOW_ROUTE_V6_HEADER);
DEFUN (show_ipv6_route_vrf_all_tag,
show_ipv6_route_vrf_all_tag_cmd,
- "show ipv6 route vrf all tag (1-4294967295)",
+ "show ipv6 <fib|route> vrf all tag (1-4294967295)",
SHOW_STR
IP_STR
+ "IPv6 forwarding table\n"
"IPv6 routing table\n"
VRF_ALL_CMD_HELP_STR
"Show only routes with tag\n"
int first = 1;
int vrf_header = 1;
route_tag_t tag = 0;
+ bool uf = use_fib(argv[2]);
if (argv[idx_number]->arg)
VTY_GET_INTEGER_RANGE("tag", tag, argv[idx_number]->arg, 0, 4294967295);
for (rn = route_top (table); rn; rn = srcdest_route_next (rn))
RNODE_FOREACH_RIB (rn, rib)
{
+ if (uf && !CHECK_FLAG(rib->status, RIB_ENTRY_SELECTED_FIB))
+ continue;
if (rib->tag != tag)
continue;
DEFUN (show_ipv6_route_vrf_all_prefix_longer,
show_ipv6_route_vrf_all_prefix_longer_cmd,
- "show ipv6 route vrf all X:X::X:X/M longer-prefixes",
+ "show ipv6 <fib|route> vrf all X:X::X:X/M longer-prefixes",
SHOW_STR
IP_STR
+ "IPv6 forwarding table\n"
"IPv6 routing table\n"
VRF_ALL_CMD_HELP_STR
"IPv6 prefix\n"
int ret;
int first = 1;
int vrf_header = 1;
+ bool uf = use_fib(argv[2]);
ret = str2prefix (argv[idx_ipv6_prefixlen]->arg, &p);
if (! ret)
{
struct prefix *p, *src_p;
srcdest_rnode_prefixes(rn, &p, &src_p);
+ if (uf && !CHECK_FLAG(rib->status, RIB_ENTRY_SELECTED_FIB))
+ continue;
if (prefix_match (p, &rn->p))
{
if (first)
DEFUN (show_ipv6_route_vrf_all_protocol,
show_ipv6_route_vrf_all_protocol_cmd,
- "show ipv6 route vrf all " FRR_IP6_REDIST_STR_ZEBRA,
+ "show ipv6 <fib|route> vrf all " FRR_IP6_REDIST_STR_ZEBRA,
SHOW_STR
IP_STR
- "IP routing table\n"
+ "IPv6 forwarding table\n"
+ "IPv6 routing table\n"
VRF_ALL_CMD_HELP_STR
FRR_IP6_REDIST_HELP_STR_ZEBRA)
{
struct zebra_vrf *zvrf;
int first = 1;
int vrf_header = 1;
+ bool uf = use_fib(argv[2]);
char *proto = argv[argc - 1]->text;
type = proto_redistnum (AFI_IP6, proto);
RNODE_FOREACH_RIB (rn, rib)
if (rib->type == type)
{
+ if (uf && !CHECK_FLAG(rib->status, RIB_ENTRY_SELECTED_FIB))
+ continue;
if (first)
{
vty_out (vty, SHOW_ROUTE_V6_HEADER);
return CMD_SUCCESS;
}
-/* Write IPv6 static route configuration. */
-static int
-static_config_ipv6 (struct vty *vty)
-{
- struct route_node *rn;
- struct static_route *si;
- int write = 0;
- char buf[SRCDEST2STR_BUFFER];
- struct route_table *stable;
- struct vrf *vrf;
- struct zebra_vrf *zvrf;
-
- RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name)
- {
- if (!(zvrf = vrf->info))
- continue;
- if ((stable = zvrf->stable[AFI_IP6][SAFI_UNICAST]) == NULL)
- continue;
-
- for (rn = route_top (stable); rn; rn = srcdest_route_next (rn))
- for (si = rn->info; si; si = si->next)
- {
- vty_out (vty, "ipv6 route %s", srcdest_rnode2str (rn, buf, sizeof buf));
-
- switch (si->type)
- {
- case STATIC_IPV4_GATEWAY:
- vty_out (vty, " %s", inet_ntoa (si->addr.ipv4));
- break;
- case STATIC_IPV6_GATEWAY:
- vty_out (vty, " %s", inet_ntop (AF_INET6, &si->addr.ipv6, buf, BUFSIZ));
- break;
- case STATIC_IFINDEX:
- vty_out (vty, " %s", si->ifname);
- break;
- case STATIC_BLACKHOLE:
- vty_out (vty, " Null0" );
- break;
- case STATIC_IPV6_GATEWAY_IFINDEX:
- vty_out (vty, " %s %s",
- inet_ntop (AF_INET6, &si->addr.ipv6, buf, BUFSIZ),
- ifindex2ifname (si->ifindex, si->vrf_id));
- break;
- }
-
- /* flags are incompatible with STATIC_BLACKHOLE */
- if (si->type != STATIC_BLACKHOLE)
- {
- if (CHECK_FLAG(si->flags, ZEBRA_FLAG_REJECT))
- vty_out (vty, " %s", "reject");
- if (CHECK_FLAG(si->flags, ZEBRA_FLAG_BLACKHOLE))
- vty_out (vty, " %s", "blackhole");
- }
-
- if (si->tag)
- vty_out (vty, " tag %"ROUTE_TAG_PRI, si->tag);
-
- if (si->distance != ZEBRA_STATIC_DISTANCE_DEFAULT)
- vty_out (vty, " %d", si->distance);
-
- if (si->vrf_id != VRF_DEFAULT)
- {
- vty_out (vty, " vrf %s", zvrf_name (zvrf));
- }
-
- /* Label information */
- if (si->snh_label.num_labels)
- vty_out (vty, " label %s",
- mpls_label2str (si->snh_label.num_labels,
- si->snh_label.label, buf, sizeof buf));
-
- vty_out (vty, "%s", VTY_NEWLINE);
-
- write = 1;
- }
- }
- return write;
-}
-
DEFUN (allow_external_route_update,
allow_external_route_update_cmd,
"allow-external-route-update",
{
int write = 0;
- write += static_config_ipv4 (vty, SAFI_UNICAST, "ip route");
- write += static_config_ipv4 (vty, SAFI_MULTICAST, "ip mroute");
- write += static_config_ipv6 (vty);
+ write += static_config (vty, AFI_IP, SAFI_UNICAST, "ip route");
+ write += static_config (vty, AFI_IP, SAFI_MULTICAST, "ip mroute");
+ write += static_config (vty, AFI_IP6, SAFI_UNICAST, "ipv6 route");
write += zebra_import_table_config (vty);
return write;