]> git.proxmox.com Git - mirror_frr.git/blobdiff - zebra/zebra_vty.c
*: nuke ^L (page feed)
[mirror_frr.git] / zebra / zebra_vty.c
index d07b09c8e04831e0fe5368099d1e0c6f4aecae32..baa60db9a71f083dd276aa216266bb23b8e2998a 100644 (file)
@@ -280,9 +280,9 @@ DEFUN (ip_route_mask_flags_distance,
        "IP destination prefix mask\n"
        "IP gateway address\n"
        "IP gateway interface name\n"
-       "Distance value for this route\n"
        "Emit an ICMP unreachable when matched\n"
-       "Silently discard pkts when matched\n")
+       "Silently discard pkts when matched\n"
+       "Distance value for this route\n")
 {
   return zebra_static_ipv4 (vty, 1, argv[0], argv[1], argv[2], argv[3], argv[4]);
 }
@@ -294,9 +294,9 @@ DEFUN (ip_route_mask_flags_distance2,
        "Establish static routes\n"
        "IP destination prefix\n"
        "IP destination prefix mask\n"
-       "Distance value for this route\n"
        "Emit an ICMP unreachable when matched\n"
-       "Silently discard pkts when matched\n")
+       "Silently discard pkts when matched\n"
+       "Distance value for this route\n")
 {
   return zebra_static_ipv4 (vty, 1, argv[0], argv[1], NULL, argv[2], argv[3]);
 }
@@ -533,7 +533,8 @@ static void
 vty_show_ip_route_detail (struct vty *vty, struct route_node *rn)
 {
   struct rib *rib;
-  struct nexthop *nexthop;
+  struct nexthop *nexthop, *tnexthop;
+  int recursing;
 
   RNODE_FOREACH_RIB (rn, rib)
     {
@@ -582,12 +583,13 @@ vty_show_ip_route_detail (struct vty *vty, struct route_node *rn)
          vty_out (vty, " ago%s", VTY_NEWLINE);
        }
 
-      for (nexthop = rib->nexthop; nexthop; nexthop = nexthop->next)
+      for (ALL_NEXTHOPS_RO(rib->nexthop, nexthop, tnexthop, recursing))
        {
           char addrstr[32];
 
-         vty_out (vty, "  %c",
-                  CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB) ? '*' : ' ');
+         vty_out (vty, "  %c%s",
+                  CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB) ? '*' : ' ',
+                  recursing ? "  " : "");
 
          switch (nexthop->type)
            {
@@ -613,25 +615,12 @@ vty_show_ip_route_detail (struct vty *vty, struct route_node *rn)
          if (! CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_ACTIVE))
            vty_out (vty, " inactive");
 
+         if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_ONLINK))
+           vty_out (vty, " onlink");
+
          if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_RECURSIVE))
-           {
-             vty_out (vty, " (recursive");
-               
-             switch (nexthop->rtype)
-               {
-               case NEXTHOP_TYPE_IPV4:
-               case NEXTHOP_TYPE_IPV4_IFINDEX:
-                 vty_out (vty, " via %s)", inet_ntoa (nexthop->rgate.ipv4));
-                 break;
-               case NEXTHOP_TYPE_IFINDEX:
-               case NEXTHOP_TYPE_IFNAME:
-                 vty_out (vty, " is directly connected, %s)",
-                          ifindex2ifname (nexthop->rifindex));
-                 break;
-               default:
-                 break;
-               }
-           }
+           vty_out (vty, " (recursive)");
+
          switch (nexthop->type)
             {
             case NEXTHOP_TYPE_IPV4:
@@ -668,12 +657,13 @@ vty_show_ip_route_detail (struct vty *vty, struct route_node *rn)
 static void
 vty_show_ip_route (struct vty *vty, struct route_node *rn, struct rib *rib)
 {
-  struct nexthop *nexthop;
+  struct nexthop *nexthop, *tnexthop;
+  int recursing;
   int len = 0;
   char buf[BUFSIZ];
 
   /* Nexthop information. */
-  for (nexthop = rib->nexthop; nexthop; nexthop = nexthop->next)
+  for (ALL_NEXTHOPS_RO(rib->nexthop, nexthop, tnexthop, recursing))
     {
       if (nexthop == rib->nexthop)
        {
@@ -697,7 +687,7 @@ vty_show_ip_route (struct vty *vty, struct route_node *rn, struct rib *rib)
        vty_out (vty, "  %c%*c",
                 CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB)
                 ? '*' : ' ',
-                len - 3, ' ');
+                len - 3 + (2 * recursing), ' ');
 
       switch (nexthop->type)
        {
@@ -723,25 +713,12 @@ vty_show_ip_route (struct vty *vty, struct route_node *rn, struct rib *rib)
       if (! CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_ACTIVE))
        vty_out (vty, " inactive");
 
+      if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_ONLINK))
+       vty_out (vty, " onlink");
+
       if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_RECURSIVE))
-       {
-         vty_out (vty, " (recursive");
-               
-         switch (nexthop->rtype)
-           {
-           case NEXTHOP_TYPE_IPV4:
-           case NEXTHOP_TYPE_IPV4_IFINDEX:
-             vty_out (vty, " via %s)", inet_ntoa (nexthop->rgate.ipv4));
-             break;
-           case NEXTHOP_TYPE_IFINDEX:
-           case NEXTHOP_TYPE_IFNAME:
-             vty_out (vty, " is directly connected, %s)",
-                      ifindex2ifname (nexthop->rifindex));
-             break;
-           default:
-             break;
-           }
-       }
+       vty_out (vty, " (recursive)");
+
       switch (nexthop->type)
         {
           case NEXTHOP_TYPE_IPV4:
@@ -1051,7 +1028,8 @@ vty_show_ip_route_summary (struct vty *vty, struct route_table *table)
         {
          rib_cnt[ZEBRA_ROUTE_TOTAL]++;
          rib_cnt[rib->type]++;
-         if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB)) 
+         if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB)
+             || nexthop_has_fib_child(nexthop))
            {
              fib_cnt[ZEBRA_ROUTE_TOTAL]++;
              fib_cnt[rib->type]++;
@@ -1060,7 +1038,8 @@ vty_show_ip_route_summary (struct vty *vty, struct route_table *table)
              CHECK_FLAG (rib->flags, ZEBRA_FLAG_IBGP)) 
            {
              rib_cnt[ZEBRA_ROUTE_IBGP]++;
-             if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB)) 
+             if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB)
+                 || nexthop_has_fib_child(nexthop))
                fib_cnt[ZEBRA_ROUTE_IBGP]++;
            }
        }
@@ -1231,7 +1210,7 @@ DEFUN (show_ip_mroute,
   return CMD_SUCCESS;
 }
 
-\f
+
 #ifdef HAVE_IPV6
 /* General fucntion for IPv6 static route. */
 static int
@@ -1543,7 +1522,8 @@ static void
 vty_show_ipv6_route_detail (struct vty *vty, struct route_node *rn)
 {
   struct rib *rib;
-  struct nexthop *nexthop;
+  struct nexthop *nexthop, *tnexthop;
+  int recursing;
   char buf[BUFSIZ];
 
   RNODE_FOREACH_RIB (rn, rib)
@@ -1594,10 +1574,11 @@ vty_show_ipv6_route_detail (struct vty *vty, struct route_node *rn)
          vty_out (vty, " ago%s", VTY_NEWLINE);
        }
 
-      for (nexthop = rib->nexthop; nexthop; nexthop = nexthop->next)
+      for (ALL_NEXTHOPS_RO(rib->nexthop, nexthop, tnexthop, recursing))
        {
-         vty_out (vty, "  %c",
-                  CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB) ? '*' : ' ');
+         vty_out (vty, "  %c%s",
+                  CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB) ? '*' : ' ',
+                  recursing ? "  " : "");
 
          switch (nexthop->type)
            {
@@ -1625,30 +1606,12 @@ vty_show_ipv6_route_detail (struct vty *vty, struct route_node *rn)
          if (! CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_ACTIVE))
            vty_out (vty, " inactive");
 
+         if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_ONLINK))
+           vty_out (vty, " onlink");
+
          if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_RECURSIVE))
-           {
-             vty_out (vty, " (recursive");
-               
-             switch (nexthop->rtype)
-               {
-               case NEXTHOP_TYPE_IPV6:
-               case NEXTHOP_TYPE_IPV6_IFINDEX:
-               case NEXTHOP_TYPE_IPV6_IFNAME:
-                 vty_out (vty, " via %s)",
-                          inet_ntop (AF_INET6, &nexthop->rgate.ipv6,
-                                     buf, BUFSIZ));
-                 if (nexthop->rifindex)
-                   vty_out (vty, ", %s", ifindex2ifname (nexthop->rifindex));
-                 break;
-               case NEXTHOP_TYPE_IFINDEX:
-               case NEXTHOP_TYPE_IFNAME:
-                 vty_out (vty, " is directly connected, %s)",
-                          ifindex2ifname (nexthop->rifindex));
-                 break;
-               default:
-                 break;
-               }
-           }
+           vty_out (vty, " (recursive)");
+
          vty_out (vty, "%s", VTY_NEWLINE);
        }
       vty_out (vty, "%s", VTY_NEWLINE);
@@ -1659,12 +1622,13 @@ static void
 vty_show_ipv6_route (struct vty *vty, struct route_node *rn,
                     struct rib *rib)
 {
-  struct nexthop *nexthop;
+  struct nexthop *nexthop, *tnexthop;
+  int recursing;
   int len = 0;
   char buf[BUFSIZ];
 
   /* Nexthop information. */
-  for (nexthop = rib->nexthop; nexthop; nexthop = nexthop->next)
+  for (ALL_NEXTHOPS_RO(rib->nexthop, nexthop, tnexthop, recursing))
     {
       if (nexthop == rib->nexthop)
        {
@@ -1688,7 +1652,7 @@ vty_show_ipv6_route (struct vty *vty, struct route_node *rn,
        vty_out (vty, "  %c%*c",
                 CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB)
                 ? '*' : ' ',
-                len - 3, ' ');
+                len - 3 + (2 * recursing), ' ');
 
       switch (nexthop->type)
        {
@@ -1717,29 +1681,7 @@ vty_show_ipv6_route (struct vty *vty, struct route_node *rn,
        vty_out (vty, " inactive");
 
       if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_RECURSIVE))
-       {
-         vty_out (vty, " (recursive");
-               
-         switch (nexthop->rtype)
-           {
-           case NEXTHOP_TYPE_IPV6:
-           case NEXTHOP_TYPE_IPV6_IFINDEX:
-           case NEXTHOP_TYPE_IPV6_IFNAME:
-             vty_out (vty, " via %s)",
-                      inet_ntop (AF_INET6, &nexthop->rgate.ipv6,
-                                 buf, BUFSIZ));
-             if (nexthop->rifindex)
-               vty_out (vty, ", %s", ifindex2ifname (nexthop->rifindex));
-             break;
-           case NEXTHOP_TYPE_IFINDEX:
-           case NEXTHOP_TYPE_IFNAME:
-             vty_out (vty, " is directly connected, %s)",
-                      ifindex2ifname (nexthop->rifindex));
-             break;
-           default:
-             break;
-           }
-       }
+       vty_out (vty, " (recursive)");
 
       if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_BLACKHOLE))
        vty_out (vty, ", bh");