]> git.puffer.fish Git - mirror/frr.git/commitdiff
Zebra: Add "show ip/ipv6 fib <prefix> [json]" CLI - review comments 1
authorAmeya Dharkar <adharkar@vmware.com>
Thu, 9 May 2019 20:36:59 +0000 (13:36 -0700)
committerAmeya Dharkar <adharkar@vmware.com>
Thu, 9 May 2019 21:23:23 +0000 (14:23 -0700)
According to the review comments, added "Network not in FIB" message when we do
not have a FIB route present for given prefix.

Signed-off-by: Ameya Dharkar <adharkar@vmware.com>
zebra/zebra_vty.c

index 727fff93c6a4928164d299a741dfd1ad180a4fef..71cf8d79f8f0afd49bc1c574a86d4ade71eb2b17 100644 (file)
@@ -1227,6 +1227,8 @@ DEFPY (show_route_detail,
        struct route_table *table;
        struct prefix p;
        struct route_node *rn;
+       bool use_fib = !!fib;
+       rib_dest_t *dest;
 
        if (address_str)
                prefix_str = address_str;
@@ -1253,9 +1255,10 @@ DEFPY (show_route_detail,
                        }
 
                        if (json)
-                               vty_show_ip_route_detail_json(vty, rn, !!fib);
+                               vty_show_ip_route_detail_json(vty, rn,
+                                                               use_fib);
                        else
-                               vty_show_ip_route_detail(vty, rn, 0, !!fib);
+                               vty_show_ip_route_detail(vty, rn, 0, use_fib);
 
                        route_unlock_node(rn);
                }
@@ -1271,19 +1274,29 @@ DEFPY (show_route_detail,
 
                rn = route_node_match(table, &p);
                if (!rn) {
-                       vty_out(vty, "%% Network not in table\n");
+                       if (use_fib)
+                               vty_out(vty, "%% Network not in FIB\n");
+                       else
+                               vty_out(vty, "%% Network not in table\n");
                        return CMD_WARNING;
                }
                if (!address_str && rn->p.prefixlen != p.prefixlen) {
-                       vty_out(vty, "%% Network not in table\n");
+                       if (use_fib)
+                               vty_out(vty, "%% Network not in FIB\n");
+                       else
+                               vty_out(vty, "%% Network not in table\n");
                        route_unlock_node(rn);
                        return CMD_WARNING;
                }
 
+               dest = rib_dest_from_rnode(rn);
+               if (use_fib && !dest->selected_fib)
+                       vty_out(vty, "%% Network not in FIB\n");
+
                if (json)
-                       vty_show_ip_route_detail_json(vty, rn, !!fib);
+                       vty_show_ip_route_detail_json(vty, rn, use_fib);
                else
-                       vty_show_ip_route_detail(vty, rn, 0, !!fib);
+                       vty_show_ip_route_detail(vty, rn, 0, use_fib);
 
                route_unlock_node(rn);
        }