Diff for /embedaddon/quagga/zebra/zebra_vty.c between versions 1.1.1.3 and 1.1.1.4

version 1.1.1.3, 2013/07/21 23:54:41 version 1.1.1.4, 2016/11/02 10:09:10
Line 27 Line 27
 #include "command.h"  #include "command.h"
 #include "table.h"  #include "table.h"
 #include "rib.h"  #include "rib.h"
   #include "vrf.h"
   
 #include "zebra/zserv.h"  #include "zebra/zserv.h"
   
/* General fucntion for static route. */static int do_show_ip_route(struct vty *vty, safi_t safi, vrf_id_t vrf_id);
 static void vty_show_ip_route_detail (struct vty *vty, struct route_node *rn,
                                       int mcast);
 static void vty_show_ip_route (struct vty *vty, struct route_node *rn,
                                struct rib *rib);
 
 /* General function for static route. */
 static int  static int
zebra_static_ipv4 (struct vty *vty, int add_cmd, const char *dest_str,zebra_static_ipv4_safi (struct vty *vty, safi_t safi, int add_cmd,
                   const char *mask_str, const char *gate_str,                        const char *dest_str, const char *mask_str,
                   const char *flag_str, const char *distance_str)                        const char *gate_str, const char *flag_str,
                         const char *distance_str, const char *vrf_id_str)
 {  {
   int ret;    int ret;
   u_char distance;    u_char distance;
Line 43  zebra_static_ipv4 (struct vty *vty, int add_cmd, const Line 51  zebra_static_ipv4 (struct vty *vty, int add_cmd, const
   struct in_addr mask;    struct in_addr mask;
   const char *ifname;    const char *ifname;
   u_char flag = 0;    u_char flag = 0;
     vrf_id_t vrf_id = VRF_DEFAULT;
       
   ret = str2prefix (dest_str, &p);    ret = str2prefix (dest_str, &p);
   if (ret <= 0)    if (ret <= 0)
Line 72  zebra_static_ipv4 (struct vty *vty, int add_cmd, const Line 81  zebra_static_ipv4 (struct vty *vty, int add_cmd, const
   else    else
     distance = ZEBRA_STATIC_DISTANCE_DEFAULT;      distance = ZEBRA_STATIC_DISTANCE_DEFAULT;
   
     /* VRF id */
     if (vrf_id_str)
       VTY_GET_INTEGER ("VRF ID", vrf_id, vrf_id_str);
   
   /* Null0 static route.  */    /* Null0 static route.  */
   if ((gate_str != NULL) && (strncasecmp (gate_str, "Null0", strlen (gate_str)) == 0))    if ((gate_str != NULL) && (strncasecmp (gate_str, "Null0", strlen (gate_str)) == 0))
     {      {
Line 81  zebra_static_ipv4 (struct vty *vty, int add_cmd, const Line 94  zebra_static_ipv4 (struct vty *vty, int add_cmd, const
           return CMD_WARNING;            return CMD_WARNING;
         }          }
       if (add_cmd)        if (add_cmd)
        static_add_ipv4 (&p, NULL, NULL, ZEBRA_FLAG_BLACKHOLE, distance, 0);        static_add_ipv4_safi (safi, &p, NULL, NULL, ZEBRA_FLAG_BLACKHOLE, distance, vrf_id);
       else        else
        static_delete_ipv4 (&p, NULL, NULL, distance, 0);        static_delete_ipv4_safi (safi, &p, NULL, NULL, distance, vrf_id);
       return CMD_SUCCESS;        return CMD_SUCCESS;
     }      }
   
Line 107  zebra_static_ipv4 (struct vty *vty, int add_cmd, const Line 120  zebra_static_ipv4 (struct vty *vty, int add_cmd, const
   if (gate_str == NULL)    if (gate_str == NULL)
   {    {
     if (add_cmd)      if (add_cmd)
      static_add_ipv4 (&p, NULL, NULL, flag, distance, 0);      static_add_ipv4_safi (safi, &p, NULL, NULL, flag, distance, vrf_id);
     else      else
      static_delete_ipv4 (&p, NULL, NULL, distance, 0);      static_delete_ipv4_safi (safi, &p, NULL, NULL, distance, vrf_id);
   
     return CMD_SUCCESS;      return CMD_SUCCESS;
   }    }
Line 123  zebra_static_ipv4 (struct vty *vty, int add_cmd, const Line 136  zebra_static_ipv4 (struct vty *vty, int add_cmd, const
     ifname = gate_str;      ifname = gate_str;
   
   if (add_cmd)    if (add_cmd)
    static_add_ipv4 (&p, ifname ? NULL : &gate, ifname, flag, distance, 0);    static_add_ipv4_safi (safi, &p, ifname ? NULL : &gate, ifname, flag, distance, vrf_id);
   else    else
    static_delete_ipv4 (&p, ifname ? NULL : &gate, ifname, distance, 0);    static_delete_ipv4_safi (safi, &p, ifname ? NULL : &gate, ifname, distance, vrf_id);
   
   return CMD_SUCCESS;    return CMD_SUCCESS;
 }  }
   
   static int
   zebra_static_ipv4 (struct vty *vty, int add_cmd, const char *dest_str,
                      const char *mask_str, const char *gate_str,
                      const char *flag_str, const char *distance_str,
                      const char *vrf_id_str)
   {
     return zebra_static_ipv4_safi (vty, SAFI_UNICAST, add_cmd, dest_str, mask_str,
                                    gate_str, flag_str, distance_str, vrf_id_str);
   }
   
   /* Static unicast routes for multicast RPF lookup. */
   DEFUN (ip_mroute_dist,
          ip_mroute_dist_cmd,
          "ip mroute A.B.C.D/M (A.B.C.D|INTERFACE) <1-255>",
          IP_STR
          "Configure static unicast route into MRIB for multicast RPF lookup\n"
          "IP destination prefix (e.g. 10.0.0.0/8)\n"
          "Nexthop address\n"
          "Nexthop interface name\n"
          "Distance\n")
   {
     VTY_WARN_EXPERIMENTAL();
     return zebra_static_ipv4_safi(vty, SAFI_MULTICAST, 1, argv[0], NULL, argv[1],
                                   NULL, argc > 2 ? argv[2] : NULL, NULL);
   }
   
   ALIAS (ip_mroute_dist,
          ip_mroute_cmd,
          "ip mroute A.B.C.D/M (A.B.C.D|INTERFACE)",
          IP_STR
          "Configure static unicast route into MRIB for multicast RPF lookup\n"
          "IP destination prefix (e.g. 10.0.0.0/8)\n"
          "Nexthop address\n"
          "Nexthop interface name\n")
   
   DEFUN (ip_mroute_dist_vrf,
          ip_mroute_dist_vrf_cmd,
          "ip mroute A.B.C.D/M (A.B.C.D|INTERFACE) <1-255> " VRF_CMD_STR,
          IP_STR
          "Configure static unicast route into MRIB for multicast RPF lookup\n"
          "IP destination prefix (e.g. 10.0.0.0/8)\n"
          "Nexthop address\n"
          "Nexthop interface name\n"
          "Distance\n"
          VRF_CMD_HELP_STR)
   {
     VTY_WARN_EXPERIMENTAL();
     return zebra_static_ipv4_safi(vty, SAFI_MULTICAST, 1, argv[0], NULL, argv[1],
                                   NULL, argc > 3 ? argv[2] : NULL,
                                   argc > 3 ? argv[3] : argv[2]);
   }
   
   ALIAS (ip_mroute_dist_vrf,
          ip_mroute_vrf_cmd,
          "ip mroute A.B.C.D/M (A.B.C.D|INTERFACE) "VRF_CMD_STR,
          IP_STR
          "Configure static unicast route into MRIB for multicast RPF lookup\n"
          "IP destination prefix (e.g. 10.0.0.0/8)\n"
          "Nexthop address\n"
          "Nexthop interface name\n"
          VRF_CMD_HELP_STR)
   
   DEFUN (no_ip_mroute_dist,
          no_ip_mroute_dist_cmd,
          "no ip mroute A.B.C.D/M (A.B.C.D|INTERFACE) <1-255>",
          IP_STR
          "Configure static unicast route into MRIB for multicast RPF lookup\n"
          "IP destination prefix (e.g. 10.0.0.0/8)\n"
          "Nexthop address\n"
          "Nexthop interface name\n"
          "Distance\n")
   {
     VTY_WARN_EXPERIMENTAL();
     return zebra_static_ipv4_safi(vty, SAFI_MULTICAST, 0, argv[0], NULL, argv[1],
                                   NULL, argc > 2 ? argv[2] : NULL, NULL);
   }
   
   ALIAS (no_ip_mroute_dist,
          no_ip_mroute_cmd,
          "no ip mroute A.B.C.D/M (A.B.C.D|INTERFACE)",
          NO_STR
          IP_STR
          "Configure static unicast route into MRIB for multicast RPF lookup\n"
          "IP destination prefix (e.g. 10.0.0.0/8)\n"
          "Nexthop address\n"
          "Nexthop interface name\n")
   
   DEFUN (no_ip_mroute_dist_vrf,
          no_ip_mroute_dist_vrf_cmd,
          "no ip mroute A.B.C.D/M (A.B.C.D|INTERFACE) <1-255> " VRF_CMD_STR,
          IP_STR
          "Configure static unicast route into MRIB for multicast RPF lookup\n"
          "IP destination prefix (e.g. 10.0.0.0/8)\n"
          "Nexthop address\n"
          "Nexthop interface name\n"
          "Distance\n"
          VRF_CMD_HELP_STR)
   {
     VTY_WARN_EXPERIMENTAL();
     return zebra_static_ipv4_safi(vty, SAFI_MULTICAST, 0, argv[0], NULL, argv[1],
                                   NULL, argc > 3 ? argv[2] : NULL,
                                   argc > 3 ? argv[3] : argv[2]);
   }
   
   ALIAS (no_ip_mroute_dist_vrf,
          no_ip_mroute_vrf_cmd,
          "no ip mroute A.B.C.D/M (A.B.C.D|INTERFACE) " VRF_CMD_STR,
          NO_STR
          IP_STR
          "Configure static unicast route into MRIB for multicast RPF lookup\n"
          "IP destination prefix (e.g. 10.0.0.0/8)\n"
          "Nexthop address\n"
          "Nexthop interface name\n"
          VRF_CMD_HELP_STR)
   
   DEFUN (ip_multicast_mode,
          ip_multicast_mode_cmd,
          "ip multicast rpf-lookup-mode (urib-only|mrib-only|mrib-then-urib|lower-distance|longer-prefix)",
          IP_STR
          "Multicast options\n"
          "RPF lookup behavior\n"
          "Lookup in unicast RIB only\n"
          "Lookup in multicast RIB only\n"
          "Try multicast RIB first, fall back to unicast RIB\n"
          "Lookup both, use entry with lower distance\n"
          "Lookup both, use entry with longer prefix\n")
   {
     VTY_WARN_EXPERIMENTAL();
   
     if (!strncmp (argv[0], "u", 1))
       multicast_mode_ipv4_set (MCAST_URIB_ONLY);
     else if (!strncmp (argv[0], "mrib-o", 6))
       multicast_mode_ipv4_set (MCAST_MRIB_ONLY);
     else if (!strncmp (argv[0], "mrib-t", 6))
       multicast_mode_ipv4_set (MCAST_MIX_MRIB_FIRST);
     else if (!strncmp (argv[0], "low", 3))
       multicast_mode_ipv4_set (MCAST_MIX_DISTANCE);
     else if (!strncmp (argv[0], "lon", 3))
       multicast_mode_ipv4_set (MCAST_MIX_PFXLEN);
     else
       {
         vty_out (vty, "Invalid mode specified%s", VTY_NEWLINE);
         return CMD_WARNING;
       }
   
     return CMD_SUCCESS;
   }
   
   DEFUN (no_ip_multicast_mode,
          no_ip_multicast_mode_cmd,
          "no ip multicast rpf-lookup-mode (urib-only|mrib-only|mrib-then-urib|lower-distance|longer-prefix)",
          NO_STR
          IP_STR
          "Multicast options\n"
          "RPF lookup behavior\n"
          "Lookup in unicast RIB only\n"
          "Lookup in multicast RIB only\n"
          "Try multicast RIB first, fall back to unicast RIB\n"
          "Lookup both, use entry with lower distance\n"
          "Lookup both, use entry with longer prefix\n")
   {
     multicast_mode_ipv4_set (MCAST_NO_CONFIG);
     return CMD_SUCCESS;
   }
   
   ALIAS (no_ip_multicast_mode,
          no_ip_multicast_mode_noarg_cmd,
          "no ip multicast rpf-lookup-mode",
          NO_STR
          IP_STR
          "Multicast options\n"
          "RPF lookup behavior\n")
   
   DEFUN (show_ip_rpf,
          show_ip_rpf_cmd,
          "show ip rpf",
          SHOW_STR
          IP_STR
          "Display RPF information for multicast source\n")
   {
     vrf_id_t vrf_id = VRF_DEFAULT;
   
     if (argc > 0)
       VTY_GET_INTEGER ("VRF ID", vrf_id, argv[0]);
   
     VTY_WARN_EXPERIMENTAL();
     return do_show_ip_route(vty, SAFI_MULTICAST, vrf_id);
   }
   
   ALIAS (show_ip_rpf,
          show_ip_rpf_vrf_cmd,
          "show ip rpf " VRF_CMD_STR,
          SHOW_STR
          IP_STR
          "Display RPF information for multicast source\n"
          VRF_CMD_HELP_STR)
   
   DEFUN (show_ip_rpf_addr,
          show_ip_rpf_addr_cmd,
          "show ip rpf A.B.C.D",
          SHOW_STR
          IP_STR
          "Display RPF information for multicast source\n"
          "IP multicast source address (e.g. 10.0.0.0)\n")
   {
     struct in_addr addr;
     struct route_node *rn;
     struct rib *rib;
     vrf_id_t vrf_id = VRF_DEFAULT;
     int ret;
   
     if (argc > 1)
       VTY_GET_INTEGER ("VRF ID", vrf_id, argv[1]);
   
     VTY_WARN_EXPERIMENTAL();
   
     ret = inet_aton (argv[0], &addr);
     if (ret == 0)
       {
         vty_out (vty, "%% Malformed address%s", VTY_NEWLINE);
         return CMD_WARNING;
       }
   
     rib = rib_match_ipv4_multicast (addr, &rn, vrf_id);
   
     if (rib)
       vty_show_ip_route_detail (vty, rn, 1);
     else
       vty_out (vty, "%% No match for RPF lookup%s", VTY_NEWLINE);
   
     return CMD_SUCCESS;
   }
   
   ALIAS (show_ip_rpf_addr,
          show_ip_rpf_addr_vrf_cmd,
          "show ip rpf A.B.C.D " VRF_CMD_STR,
          SHOW_STR
          IP_STR
          "Display RPF information for multicast source\n"
          "IP multicast source address (e.g. 10.0.0.0)\n"
          VRF_CMD_HELP_STR)
   
   DEFUN (show_ip_rpf_vrf_all,
          show_ip_rpf_vrf_all_cmd,
          "show ip rpf " VRF_ALL_CMD_STR,
          SHOW_STR
          IP_STR
          "Display RPF information for multicast source\n"
          VRF_ALL_CMD_HELP_STR)
   {
     struct zebra_vrf *zvrf;
     struct route_table *table;
     struct route_node *rn;
     struct rib *rib;
     vrf_iter_t iter;
     int first = 1;
   
     VTY_WARN_EXPERIMENTAL();
   
     for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter))
       {
         if ((zvrf = vrf_iter2info (iter)) == NULL ||
             (table = zvrf->table[AFI_IP][SAFI_MULTICAST]) == NULL)
           continue;
   
         /* 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;
   }
   
   DEFUN (show_ip_rpf_addr_vrf_all,
          show_ip_rpf_addr_vrf_all_cmd,
          "show ip rpf A.B.C.D " VRF_ALL_CMD_STR,
          SHOW_STR
          IP_STR
          "Display RPF information for multicast source\n"
          "IP multicast source address (e.g. 10.0.0.0)\n"
          VRF_ALL_CMD_HELP_STR)
   {
     struct in_addr addr;
     struct route_node *rn;
     vrf_iter_t iter;
     int ret;
   
     VTY_WARN_EXPERIMENTAL();
   
     ret = inet_aton (argv[0], &addr);
     if (ret == 0)
       {
         vty_out (vty, "%% Malformed address%s", VTY_NEWLINE);
         return CMD_WARNING;
       }
   
     for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter))
       {
         if (rib_match_ipv4_multicast (addr, &rn, vrf_iter2id (iter)))
           vty_show_ip_route_detail (vty, rn, 1);
       }
   
     return CMD_SUCCESS;
   }
   
 /* Static route configuration.  */  /* Static route configuration.  */
 DEFUN (ip_route,   DEFUN (ip_route, 
        ip_route_cmd,         ip_route_cmd,
Line 141  DEFUN (ip_route,  Line 467  DEFUN (ip_route, 
        "IP gateway interface name\n"         "IP gateway interface name\n"
        "Null interface\n")         "Null interface\n")
 {  {
  return zebra_static_ipv4 (vty, 1, argv[0], NULL, argv[1], NULL, NULL);  return zebra_static_ipv4 (vty, 1, argv[0], NULL, argv[1], NULL, NULL,
                             NULL);
 }  }
   
 DEFUN (ip_route_flags,  DEFUN (ip_route_flags,
Line 155  DEFUN (ip_route_flags, Line 482  DEFUN (ip_route_flags,
        "Emit an ICMP unreachable when matched\n"         "Emit an ICMP unreachable when matched\n"
        "Silently discard pkts when matched\n")         "Silently discard pkts when matched\n")
 {  {
  return zebra_static_ipv4 (vty, 1, argv[0], NULL, argv[1], argv[2], NULL);  return zebra_static_ipv4 (vty, 1, argv[0], NULL, argv[1], argv[2], NULL,
                             NULL);
 }  }
   
 DEFUN (ip_route_flags2,  DEFUN (ip_route_flags2,
Line 167  DEFUN (ip_route_flags2, Line 495  DEFUN (ip_route_flags2,
        "Emit an ICMP unreachable when matched\n"         "Emit an ICMP unreachable when matched\n"
        "Silently discard pkts when matched\n")         "Silently discard pkts when matched\n")
 {  {
  return zebra_static_ipv4 (vty, 1, argv[0], NULL, NULL, argv[1], NULL);  return zebra_static_ipv4 (vty, 1, argv[0], NULL, NULL, argv[1], NULL,
                             NULL);
 }  }
   
 /* Mask as A.B.C.D format.  */  /* Mask as A.B.C.D format.  */
Line 182  DEFUN (ip_route_mask, Line 511  DEFUN (ip_route_mask,
        "IP gateway interface name\n"         "IP gateway interface name\n"
        "Null interface\n")         "Null interface\n")
 {  {
  return zebra_static_ipv4 (vty, 1, argv[0], argv[1], argv[2], NULL, NULL);  return zebra_static_ipv4 (vty, 1, argv[0], argv[1], argv[2], NULL, NULL,
                             NULL);
 }  }
   
 DEFUN (ip_route_mask_flags,  DEFUN (ip_route_mask_flags,
Line 197  DEFUN (ip_route_mask_flags, Line 527  DEFUN (ip_route_mask_flags,
        "Emit an ICMP unreachable when matched\n"         "Emit an ICMP unreachable when matched\n"
        "Silently discard pkts when matched\n")         "Silently discard pkts when matched\n")
 {  {
  return zebra_static_ipv4 (vty, 1, argv[0], argv[1], argv[2], argv[3], NULL);  return zebra_static_ipv4 (vty, 1, argv[0], argv[1], argv[2], argv[3], NULL,
                             NULL);
 }  }
   
 DEFUN (ip_route_mask_flags2,  DEFUN (ip_route_mask_flags2,
Line 210  DEFUN (ip_route_mask_flags2, Line 541  DEFUN (ip_route_mask_flags2,
        "Emit an ICMP unreachable when matched\n"         "Emit an ICMP unreachable when matched\n"
        "Silently discard pkts when matched\n")         "Silently discard pkts when matched\n")
 {  {
  return zebra_static_ipv4 (vty, 1, argv[0], argv[1], NULL, argv[2], NULL);  return zebra_static_ipv4 (vty, 1, argv[0], argv[1], NULL, argv[2], NULL,
                             NULL);
 }  }
   
 /* Distance option value.  */  /* Distance option value.  */
Line 225  DEFUN (ip_route_distance, Line 557  DEFUN (ip_route_distance,
        "Null interface\n"         "Null interface\n"
        "Distance value for this route\n")         "Distance value for this route\n")
 {  {
  return zebra_static_ipv4 (vty, 1, argv[0], NULL, argv[1], NULL, argv[2]);  return zebra_static_ipv4 (vty, 1, argv[0], NULL, argv[1], NULL, argv[2],
                             NULL);
 }  }
   
 DEFUN (ip_route_flags_distance,  DEFUN (ip_route_flags_distance,
Line 240  DEFUN (ip_route_flags_distance, Line 573  DEFUN (ip_route_flags_distance,
        "Silently discard pkts when matched\n"         "Silently discard pkts when matched\n"
        "Distance value for this route\n")         "Distance value for this route\n")
 {  {
  return zebra_static_ipv4 (vty, 1, argv[0], NULL, argv[1], argv[2], argv[3]);  return zebra_static_ipv4 (vty, 1, argv[0], NULL, argv[1], argv[2], argv[3],
                             NULL);
 }  }
   
 DEFUN (ip_route_flags_distance2,  DEFUN (ip_route_flags_distance2,
Line 253  DEFUN (ip_route_flags_distance2, Line 587  DEFUN (ip_route_flags_distance2,
        "Silently discard pkts when matched\n"         "Silently discard pkts when matched\n"
        "Distance value for this route\n")         "Distance value for this route\n")
 {  {
  return zebra_static_ipv4 (vty, 1, argv[0], NULL, NULL, argv[1], argv[2]);  return zebra_static_ipv4 (vty, 1, argv[0], NULL, NULL, argv[1], argv[2],
                             NULL);
 }  }
   
 DEFUN (ip_route_mask_distance,  DEFUN (ip_route_mask_distance,
Line 268  DEFUN (ip_route_mask_distance, Line 603  DEFUN (ip_route_mask_distance,
        "Null interface\n"         "Null interface\n"
        "Distance value for this route\n")         "Distance value for this route\n")
 {  {
  return zebra_static_ipv4 (vty, 1, argv[0], argv[1], argv[2], NULL, argv[3]);  return zebra_static_ipv4 (vty, 1, argv[0], argv[1], argv[2], NULL, argv[3],
                             NULL);
 }  }
   
 DEFUN (ip_route_mask_flags_distance,  DEFUN (ip_route_mask_flags_distance,
Line 280  DEFUN (ip_route_mask_flags_distance, Line 616  DEFUN (ip_route_mask_flags_distance,
        "IP destination prefix mask\n"         "IP destination prefix mask\n"
        "IP gateway address\n"         "IP gateway address\n"
        "IP gateway interface name\n"         "IP gateway interface name\n"
        "Distance value for this route\n"  
        "Emit an ICMP unreachable when matched\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]);  return zebra_static_ipv4 (vty, 1, argv[0], argv[1], argv[2], argv[3], argv[4],
                             NULL);
 }  }
   
 DEFUN (ip_route_mask_flags_distance2,  DEFUN (ip_route_mask_flags_distance2,
Line 294  DEFUN (ip_route_mask_flags_distance2, Line 631  DEFUN (ip_route_mask_flags_distance2,
        "Establish static routes\n"         "Establish static routes\n"
        "IP destination prefix\n"         "IP destination prefix\n"
        "IP destination prefix mask\n"         "IP destination prefix mask\n"
        "Distance value for this route\n"  
        "Emit an ICMP unreachable when matched\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]);  return zebra_static_ipv4 (vty, 1, argv[0], argv[1], NULL, argv[2], argv[3],
                             NULL);
 }  }
   
 DEFUN (no_ip_route,   DEFUN (no_ip_route, 
Line 312  DEFUN (no_ip_route,  Line 650  DEFUN (no_ip_route, 
        "IP gateway interface name\n"         "IP gateway interface name\n"
        "Null interface\n")         "Null interface\n")
 {  {
  return zebra_static_ipv4 (vty, 0, argv[0], NULL, argv[1], NULL, NULL);  return zebra_static_ipv4 (vty, 0, argv[0], NULL, argv[1], NULL, NULL,
                             NULL);
 }  }
   
 ALIAS (no_ip_route,  ALIAS (no_ip_route,
Line 337  DEFUN (no_ip_route_flags2, Line 676  DEFUN (no_ip_route_flags2,
        "Emit an ICMP unreachable when matched\n"         "Emit an ICMP unreachable when matched\n"
        "Silently discard pkts when matched\n")         "Silently discard pkts when matched\n")
 {  {
  return zebra_static_ipv4 (vty, 0, argv[0], NULL, NULL, NULL, NULL);  return zebra_static_ipv4 (vty, 0, argv[0], NULL, NULL, NULL, NULL,
                             NULL);
 }  }
   
 DEFUN (no_ip_route_mask,  DEFUN (no_ip_route_mask,
Line 352  DEFUN (no_ip_route_mask, Line 692  DEFUN (no_ip_route_mask,
        "IP gateway interface name\n"         "IP gateway interface name\n"
        "Null interface\n")         "Null interface\n")
 {  {
  return zebra_static_ipv4 (vty, 0, argv[0], argv[1], argv[2], NULL, NULL);  return zebra_static_ipv4 (vty, 0, argv[0], argv[1], argv[2], NULL, NULL,
                             NULL);
 }  }
   
 ALIAS (no_ip_route_mask,  ALIAS (no_ip_route_mask,
Line 379  DEFUN (no_ip_route_mask_flags2, Line 720  DEFUN (no_ip_route_mask_flags2,
        "Emit an ICMP unreachable when matched\n"         "Emit an ICMP unreachable when matched\n"
        "Silently discard pkts when matched\n")         "Silently discard pkts when matched\n")
 {  {
  return zebra_static_ipv4 (vty, 0, argv[0], argv[1], NULL, NULL, NULL);  return zebra_static_ipv4 (vty, 0, argv[0], argv[1], NULL, NULL, NULL,
                             NULL);
 }  }
   
 DEFUN (no_ip_route_distance,  DEFUN (no_ip_route_distance,
Line 394  DEFUN (no_ip_route_distance, Line 736  DEFUN (no_ip_route_distance,
        "Null interface\n"         "Null interface\n"
        "Distance value for this route\n")         "Distance value for this route\n")
 {  {
  return zebra_static_ipv4 (vty, 0, argv[0], NULL, argv[1], NULL, argv[2]);  return zebra_static_ipv4 (vty, 0, argv[0], NULL, argv[1], NULL, argv[2],
                             NULL);
 }  }
   
 DEFUN (no_ip_route_flags_distance,  DEFUN (no_ip_route_flags_distance,
Line 410  DEFUN (no_ip_route_flags_distance, Line 753  DEFUN (no_ip_route_flags_distance,
        "Silently discard pkts when matched\n"         "Silently discard pkts when matched\n"
        "Distance value for this route\n")         "Distance value for this route\n")
 {  {
  return zebra_static_ipv4 (vty, 0, argv[0], NULL, argv[1], argv[2], argv[3]);  return zebra_static_ipv4 (vty, 0, argv[0], NULL, argv[1], argv[2], argv[3],
                             NULL);
 }  }
   
 DEFUN (no_ip_route_flags_distance2,  DEFUN (no_ip_route_flags_distance2,
Line 424  DEFUN (no_ip_route_flags_distance2, Line 768  DEFUN (no_ip_route_flags_distance2,
        "Silently discard pkts when matched\n"         "Silently discard pkts when matched\n"
        "Distance value for this route\n")         "Distance value for this route\n")
 {  {
  return zebra_static_ipv4 (vty, 0, argv[0], NULL, NULL, argv[1], argv[2]);  return zebra_static_ipv4 (vty, 0, argv[0], NULL, NULL, argv[1], argv[2],
                             NULL);
 }  }
   
 DEFUN (no_ip_route_mask_distance,  DEFUN (no_ip_route_mask_distance,
Line 440  DEFUN (no_ip_route_mask_distance, Line 785  DEFUN (no_ip_route_mask_distance,
        "Null interface\n"         "Null interface\n"
        "Distance value for this route\n")         "Distance value for this route\n")
 {  {
  return zebra_static_ipv4 (vty, 0, argv[0], argv[1], argv[2], NULL, argv[3]);  return zebra_static_ipv4 (vty, 0, argv[0], argv[1], argv[2], NULL, argv[3],
                             NULL);
 }  }
   
 DEFUN (no_ip_route_mask_flags_distance,  DEFUN (no_ip_route_mask_flags_distance,
Line 457  DEFUN (no_ip_route_mask_flags_distance, Line 803  DEFUN (no_ip_route_mask_flags_distance,
        "Silently discard pkts when matched\n"         "Silently discard pkts when matched\n"
        "Distance value for this route\n")         "Distance value for this route\n")
 {  {
  return zebra_static_ipv4 (vty, 0, argv[0], argv[1], argv[2], argv[3], argv[4]);  return zebra_static_ipv4 (vty, 0, argv[0], argv[1], argv[2], argv[3], argv[4],
                             NULL);
 }  }
   
 DEFUN (no_ip_route_mask_flags_distance2,  DEFUN (no_ip_route_mask_flags_distance2,
Line 472  DEFUN (no_ip_route_mask_flags_distance2, Line 819  DEFUN (no_ip_route_mask_flags_distance2,
        "Silently discard pkts when matched\n"         "Silently discard pkts when matched\n"
        "Distance value for this route\n")         "Distance value for this route\n")
 {  {
  return zebra_static_ipv4 (vty, 0, argv[0], argv[1], NULL, argv[2], argv[3]);  return zebra_static_ipv4 (vty, 0, argv[0], argv[1], NULL, argv[2], argv[3],
                             NULL);
 }  }
   
   DEFUN (ip_route_vrf,
          ip_route_vrf_cmd,
          "ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) " VRF_CMD_STR,
          IP_STR
          "Establish static routes\n"
          "IP destination prefix (e.g. 10.0.0.0/8)\n"
          "IP gateway address\n"
          "IP gateway interface name\n"
          "Null interface\n"
          VRF_CMD_HELP_STR)
   {
     return zebra_static_ipv4 (vty, 1, argv[0], NULL, argv[1], NULL, NULL,
                               argv[2]);
   }
   
   DEFUN (ip_route_flags_vrf,
          ip_route_flags_vrf_cmd,
          "ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) " VRF_CMD_STR,
          IP_STR
          "Establish static routes\n"
          "IP destination prefix (e.g. 10.0.0.0/8)\n"
          "IP gateway address\n"
          "IP gateway interface name\n"
          "Emit an ICMP unreachable when matched\n"
          "Silently discard pkts when matched\n"
          VRF_CMD_HELP_STR)
   {
     return zebra_static_ipv4 (vty, 1, argv[0], NULL, argv[1], argv[2], NULL,
                               argv[3]);
   }
   
   DEFUN (ip_route_flags2_vrf,
          ip_route_flags2_vrf_cmd,
          "ip route A.B.C.D/M (reject|blackhole) " VRF_CMD_STR,
          IP_STR
          "Establish static routes\n"
          "IP destination prefix (e.g. 10.0.0.0/8)\n"
          "Emit an ICMP unreachable when matched\n"
          "Silently discard pkts when matched\n"
          VRF_CMD_HELP_STR)
   {
     return zebra_static_ipv4 (vty, 1, argv[0], NULL, NULL, argv[1], NULL,
                               argv[2]);
   }
   
   /* Mask as A.B.C.D format.  */
   DEFUN (ip_route_mask_vrf,
          ip_route_mask_vrf_cmd,
          "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) " VRF_CMD_STR,
          IP_STR
          "Establish static routes\n"
          "IP destination prefix\n"
          "IP destination prefix mask\n"
          "IP gateway address\n"
          "IP gateway interface name\n"
          "Null interface\n"
          VRF_CMD_HELP_STR)
   {
     return zebra_static_ipv4 (vty, 1, argv[0], argv[1], argv[2], NULL, NULL,
                               argv[3]);
   }
   
   DEFUN (ip_route_mask_flags_vrf,
          ip_route_mask_flags_vrf_cmd,
          "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole) " VRF_CMD_STR,
          IP_STR
          "Establish static routes\n"
          "IP destination prefix\n"
          "IP destination prefix mask\n"
          "IP gateway address\n"
          "IP gateway interface name\n"
          "Emit an ICMP unreachable when matched\n"
          "Silently discard pkts when matched\n"
          VRF_CMD_HELP_STR)
   {
     return zebra_static_ipv4 (vty, 1, argv[0], argv[1], argv[2], argv[3], NULL,
                               argv[4]);
   }
   
   DEFUN (ip_route_mask_flags2_vrf,
          ip_route_mask_flags2_vrf_cmd,
          "ip route A.B.C.D A.B.C.D (reject|blackhole) " VRF_CMD_STR,
          IP_STR
          "Establish static routes\n"
          "IP destination prefix\n"
          "IP destination prefix mask\n"
          "Emit an ICMP unreachable when matched\n"
          "Silently discard pkts when matched\n"
          VRF_CMD_HELP_STR)
   {
     return zebra_static_ipv4 (vty, 1, argv[0], argv[1], NULL, argv[2], NULL,
                               argv[3]);
   }
   
   /* Distance option value.  */
   DEFUN (ip_route_distance_vrf,
          ip_route_distance_vrf_cmd,
          "ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) <1-255> " VRF_CMD_STR,
          IP_STR
          "Establish static routes\n"
          "IP destination prefix (e.g. 10.0.0.0/8)\n"
          "IP gateway address\n"
          "IP gateway interface name\n"
          "Null interface\n"
          "Distance value for this route\n"
          VRF_CMD_HELP_STR)
   {
     return zebra_static_ipv4 (vty, 1, argv[0], NULL, argv[1], NULL, argv[2],
                               argv[3]);
   }
   
   DEFUN (ip_route_flags_distance_vrf,
          ip_route_flags_distance_vrf_cmd,
          "ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) <1-255> " VRF_CMD_STR,
          IP_STR
          "Establish static routes\n"
          "IP destination prefix (e.g. 10.0.0.0/8)\n"
          "IP gateway address\n"
          "IP gateway interface name\n"
          "Emit an ICMP unreachable when matched\n"
          "Silently discard pkts when matched\n"
          "Distance value for this route\n"
          VRF_CMD_HELP_STR)
   {
     return zebra_static_ipv4 (vty, 1, argv[0], NULL, argv[1], argv[2], argv[3],
                               argv[4]);
   }
   
   DEFUN (ip_route_flags_distance2_vrf,
          ip_route_flags_distance2_vrf_cmd,
          "ip route A.B.C.D/M (reject|blackhole) <1-255> " VRF_CMD_STR,
          IP_STR
          "Establish static routes\n"
          "IP destination prefix (e.g. 10.0.0.0/8)\n"
          "Emit an ICMP unreachable when matched\n"
          "Silently discard pkts when matched\n"
          "Distance value for this route\n"
          VRF_CMD_HELP_STR)
   {
     return zebra_static_ipv4 (vty, 1, argv[0], NULL, NULL, argv[1], argv[2],
                               argv[3]);
   }
   
   DEFUN (ip_route_mask_distance_vrf,
          ip_route_mask_distance_vrf_cmd,
          "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) <1-255> " VRF_CMD_STR,
          IP_STR
          "Establish static routes\n"
          "IP destination prefix\n"
          "IP destination prefix mask\n"
          "IP gateway address\n"
          "IP gateway interface name\n"
          "Null interface\n"
          "Distance value for this route\n"
          VRF_CMD_HELP_STR)
   {
     return zebra_static_ipv4 (vty, 1, argv[0], argv[1], argv[2], NULL, argv[3],
                               argv[4]);
   }
   
   DEFUN (ip_route_mask_flags_distance_vrf,
          ip_route_mask_flags_distance_vrf_cmd,
          "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole) <1-255> " VRF_CMD_STR,
          IP_STR
          "Establish static routes\n"
          "IP destination prefix\n"
          "IP destination prefix mask\n"
          "IP gateway address\n"
          "IP gateway interface name\n"
          "Emit an ICMP unreachable when matched\n"
          "Silently discard pkts when matched\n"
          "Distance value for this route\n"
          VRF_CMD_HELP_STR)
   {
     return zebra_static_ipv4 (vty, 1, argv[0], argv[1], argv[2], argv[3], argv[4],
                               argv[5]);
   }
   
   DEFUN (ip_route_mask_flags_distance2_vrf,
          ip_route_mask_flags_distance2_vrf_cmd,
          "ip route A.B.C.D A.B.C.D (reject|blackhole) <1-255> " VRF_CMD_STR,
          IP_STR
          "Establish static routes\n"
          "IP destination prefix\n"
          "IP destination prefix mask\n"
          "Emit an ICMP unreachable when matched\n"
          "Silently discard pkts when matched\n"
          "Distance value for this route\n"
          VRF_CMD_HELP_STR)
   {
     return zebra_static_ipv4 (vty, 1, argv[0], argv[1], NULL, argv[2], argv[3],
                               argv[4]);
   }
   
   DEFUN (no_ip_route_vrf,
          no_ip_route_vrf_cmd,
          "no ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) " VRF_CMD_STR,
          NO_STR
          IP_STR
          "Establish static routes\n"
          "IP destination prefix (e.g. 10.0.0.0/8)\n"
          "IP gateway address\n"
          "IP gateway interface name\n"
          "Null interface\n"
          VRF_CMD_HELP_STR)
   {
     return zebra_static_ipv4 (vty, 0, argv[0], NULL, argv[1], NULL, NULL,
                               (argc > 3) ? argv[3] : argv[2]);
   }
   
   ALIAS (no_ip_route_vrf,
          no_ip_route_flags_vrf_cmd,
          "no ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) " VRF_CMD_STR,
          NO_STR
          IP_STR
          "Establish static routes\n"
          "IP destination prefix (e.g. 10.0.0.0/8)\n"
          "IP gateway address\n"
          "IP gateway interface name\n"
          "Emit an ICMP unreachable when matched\n"
          "Silently discard pkts when matched\n"
          VRF_CMD_HELP_STR)
   
   DEFUN (no_ip_route_flags2_vrf,
          no_ip_route_flags2_vrf_cmd,
          "no ip route A.B.C.D/M (reject|blackhole) " VRF_CMD_STR,
          NO_STR
          IP_STR
          "Establish static routes\n"
          "IP destination prefix (e.g. 10.0.0.0/8)\n"
          "Emit an ICMP unreachable when matched\n"
          "Silently discard pkts when matched\n"
          VRF_CMD_HELP_STR)
   {
     return zebra_static_ipv4 (vty, 0, argv[0], NULL, NULL, NULL, NULL,
                               argv[2]);
   }
   
   DEFUN (no_ip_route_mask_vrf,
          no_ip_route_mask_vrf_cmd,
          "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) " VRF_CMD_STR,
          NO_STR
          IP_STR
          "Establish static routes\n"
          "IP destination prefix\n"
          "IP destination prefix mask\n"
          "IP gateway address\n"
          "IP gateway interface name\n"
          "Null interface\n"
          VRF_CMD_HELP_STR)
   {
     return zebra_static_ipv4 (vty, 0, argv[0], argv[1], argv[2], NULL, NULL,
                               (argc > 4) ? argv[4] : argv[3]);
   }
   
   ALIAS (no_ip_route_mask_vrf,
          no_ip_route_mask_flags_vrf_cmd,
          "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole) " VRF_CMD_STR,
          NO_STR
          IP_STR
          "Establish static routes\n"
          "IP destination prefix\n"
          "IP destination prefix mask\n"
          "IP gateway address\n"
          "IP gateway interface name\n"
          "Emit an ICMP unreachable when matched\n"
          "Silently discard pkts when matched\n"
          VRF_CMD_HELP_STR)
   
   DEFUN (no_ip_route_mask_flags2_vrf,
          no_ip_route_mask_flags2_vrf_cmd,
          "no ip route A.B.C.D A.B.C.D (reject|blackhole) " VRF_CMD_STR,
          NO_STR
          IP_STR
          "Establish static routes\n"
          "IP destination prefix\n"
          "IP destination prefix mask\n"
          "Emit an ICMP unreachable when matched\n"
          "Silently discard pkts when matched\n"
          VRF_CMD_HELP_STR)
   {
     return zebra_static_ipv4 (vty, 0, argv[0], argv[1], NULL, NULL, NULL,
                               argv[2]);
   }
   
   DEFUN (no_ip_route_distance_vrf,
          no_ip_route_distance_vrf_cmd,
          "no ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) <1-255> " VRF_CMD_STR,
          NO_STR
          IP_STR
          "Establish static routes\n"
          "IP destination prefix (e.g. 10.0.0.0/8)\n"
          "IP gateway address\n"
          "IP gateway interface name\n"
          "Null interface\n"
          "Distance value for this route\n"
          VRF_CMD_HELP_STR)
   {
     return zebra_static_ipv4 (vty, 0, argv[0], NULL, argv[1], NULL, argv[2],
                               argv[3]);
   }
   
   DEFUN (no_ip_route_flags_distance_vrf,
          no_ip_route_flags_distance_vrf_cmd,
          "no ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) <1-255> " VRF_CMD_STR,
          NO_STR
          IP_STR
          "Establish static routes\n"
          "IP destination prefix (e.g. 10.0.0.0/8)\n"
          "IP gateway address\n"
          "IP gateway interface name\n"
          "Emit an ICMP unreachable when matched\n"
          "Silently discard pkts when matched\n"
          "Distance value for this route\n"
          VRF_CMD_HELP_STR)
   {
     return zebra_static_ipv4 (vty, 0, argv[0], NULL, argv[1], argv[2], argv[3],
                               argv[4]);
   }
   
   DEFUN (no_ip_route_flags_distance2_vrf,
          no_ip_route_flags_distance2_vrf_cmd,
          "no ip route A.B.C.D/M (reject|blackhole) <1-255> " VRF_CMD_STR,
          NO_STR
          IP_STR
          "Establish static routes\n"
          "IP destination prefix (e.g. 10.0.0.0/8)\n"
          "Emit an ICMP unreachable when matched\n"
          "Silently discard pkts when matched\n"
          "Distance value for this route\n"
          VRF_CMD_HELP_STR)
   {
     return zebra_static_ipv4 (vty, 0, argv[0], NULL, NULL, argv[1], argv[2],
                               argv[3]);
   }
   
   DEFUN (no_ip_route_mask_distance_vrf,
          no_ip_route_mask_distance_vrf_cmd,
          "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) <1-255> " VRF_CMD_STR,
          NO_STR
          IP_STR
          "Establish static routes\n"
          "IP destination prefix\n"
          "IP destination prefix mask\n"
          "IP gateway address\n"
          "IP gateway interface name\n"
          "Null interface\n"
          "Distance value for this route\n"
          VRF_CMD_HELP_STR)
   {
     return zebra_static_ipv4 (vty, 0, argv[0], argv[1], argv[2], NULL, argv[3],
                               argv[4]);
   }
   
   DEFUN (no_ip_route_mask_flags_distance_vrf,
          no_ip_route_mask_flags_distance_vrf_cmd,
          "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole) <1-255> " VRF_CMD_STR,
          NO_STR
          IP_STR
          "Establish static routes\n"
          "IP destination prefix\n"
          "IP destination prefix mask\n"
          "IP gateway address\n"
          "IP gateway interface name\n"
          "Emit an ICMP unreachable when matched\n"
          "Silently discard pkts when matched\n"
          "Distance value for this route\n"
          VRF_CMD_HELP_STR)
   {
     return zebra_static_ipv4 (vty, 0, argv[0], argv[1], argv[2], argv[3], argv[4],
                               argv[5]);
   }
   
   DEFUN (no_ip_route_mask_flags_distance2_vrf,
          no_ip_route_mask_flags_distance2_vrf_cmd,
          "no ip route A.B.C.D A.B.C.D (reject|blackhole) <1-255> " VRF_CMD_STR,
          NO_STR
          IP_STR
          "Establish static routes\n"
          "IP destination prefix\n"
          "IP destination prefix mask\n"
          "Emit an ICMP unreachable when matched\n"
          "Silently discard pkts when matched\n"
          "Distance value for this route\n"
          VRF_CMD_HELP_STR)
   {
     return zebra_static_ipv4 (vty, 0, argv[0], argv[1], NULL, argv[2], argv[3],
                               argv[4]);
   }
   
 char *proto_rm[AFI_MAX][ZEBRA_ROUTE_MAX+1];     /* "any" == ZEBRA_ROUTE_MAX */  char *proto_rm[AFI_MAX][ZEBRA_ROUTE_MAX+1];     /* "any" == ZEBRA_ROUTE_MAX */
   
 DEFUN (ip_protocol,  DEFUN (ip_protocol,
Line 530  DEFUN (no_ip_protocol, Line 1268  DEFUN (no_ip_protocol,
   
 /* New RIB.  Detailed information for IPv4 route. */  /* New RIB.  Detailed information for IPv4 route. */
 static void  static void
vty_show_ip_route_detail (struct vty *vty, struct route_node *rn)vty_show_ip_route_detail (struct vty *vty, struct route_node *rn, int mcast)
 {  {
   struct rib *rib;    struct rib *rib;
  struct nexthop *nexthop;  struct nexthop *nexthop, *tnexthop;
   int recursing;
   char buf[PREFIX_STRLEN];
   
   RNODE_FOREACH_RIB (rn, rib)    RNODE_FOREACH_RIB (rn, rib)
     {      {
      vty_out (vty, "Routing entry for %s/%d%s",       const char *mcast_info = "";
               inet_ntoa (rn->p.u.prefix4), rn->p.prefixlen,      if (mcast)
               VTY_NEWLINE);        {
           rib_table_info_t *info = rn->table->info;
           mcast_info = (info->safi == SAFI_MULTICAST)
                        ? " using Multicast RIB"
                        : " using Unicast RIB";
         }
       vty_out (vty, "Routing entry for %s%s%s",
                prefix2str (&rn->p, buf, sizeof(buf)), mcast_info,
               VTY_NEWLINE);
       vty_out (vty, "  Known via \"%s\"", zebra_route_string (rib->type));        vty_out (vty, "  Known via \"%s\"", zebra_route_string (rib->type));
       vty_out (vty, ", distance %u, metric %u", rib->distance, rib->metric);        vty_out (vty, ", distance %u, metric %u", rib->distance, rib->metric);
         if (rib->mtu)
           vty_out (vty, ", mtu %u", rib->mtu);
         vty_out (vty, ", vrf %u", rib->vrf_id);
       if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_SELECTED))        if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_SELECTED))
        vty_out (vty, ", best");        vty_out (vty, ", best");
       if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_FIB_OVERRIDE))
         vty_out (vty, ", fib-override");
       if (CHECK_FLAG (rib->status, RIB_ENTRY_SELECTED_FIB))
         vty_out (vty, ", fib");
       if (rib->refcnt)        if (rib->refcnt)
        vty_out (vty, ", refcnt %ld", rib->refcnt);        vty_out (vty, ", refcnt %ld", rib->refcnt);
       if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_BLACKHOLE))        if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_BLACKHOLE))
        vty_out (vty, ", blackhole");         vty_out (vty, ", blackhole");
       if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_REJECT))        if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_REJECT))
Line 555  vty_show_ip_route_detail (struct vty *vty, struct rout Line 1310  vty_show_ip_route_detail (struct vty *vty, struct rout
 #define ONE_DAY_SECOND 60*60*24  #define ONE_DAY_SECOND 60*60*24
 #define ONE_WEEK_SECOND 60*60*24*7  #define ONE_WEEK_SECOND 60*60*24*7
       if (rib->type == ZEBRA_ROUTE_RIP        if (rib->type == ZEBRA_ROUTE_RIP
          || rib->type == ZEBRA_ROUTE_OSPF          || rib->type == ZEBRA_ROUTE_RIPNG
          || rib->type == ZEBRA_ROUTE_BABEL          || rib->type == ZEBRA_ROUTE_OSPF
          || rib->type == ZEBRA_ROUTE_ISIS          || rib->type == ZEBRA_ROUTE_OSPF6
          || rib->type == ZEBRA_ROUTE_BGP)          || rib->type == ZEBRA_ROUTE_BABEL
           || rib->type == ZEBRA_ROUTE_ISIS
           || rib->type == ZEBRA_ROUTE_BGP)
         {          {
           time_t uptime;            time_t uptime;
           struct tm *tm;            struct tm *tm;
Line 582  vty_show_ip_route_detail (struct vty *vty, struct rout Line 1339  vty_show_ip_route_detail (struct vty *vty, struct rout
           vty_out (vty, " ago%s", VTY_NEWLINE);            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%s",
                    CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB) ? '*' : ' ',
                    recursing ? "  " : "");
   
          vty_out (vty, "  %c",          switch (nexthop->type)
                   CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB) ? '*' : ' ');            {
             case NEXTHOP_TYPE_IPV4:
             case NEXTHOP_TYPE_IPV4_IFINDEX:
               vty_out (vty, " %s", inet_ntoa (nexthop->gate.ipv4));
               if (nexthop->ifindex)
                 vty_out (vty, ", via %s",
                          ifindex2ifname_vrf (nexthop->ifindex, rib->vrf_id));
               break;
             case NEXTHOP_TYPE_IPV6:
             case NEXTHOP_TYPE_IPV6_IFINDEX:
             case NEXTHOP_TYPE_IPV6_IFNAME:
               vty_out (vty, " %s",
                        inet_ntop (AF_INET6, &nexthop->gate.ipv6, buf, sizeof(buf)));
               if (nexthop->type == NEXTHOP_TYPE_IPV6_IFNAME)
                 vty_out (vty, ", %s", nexthop->ifname);
               else if (nexthop->ifindex)
                 vty_out (vty, ", via %s",
                          ifindex2ifname_vrf (nexthop->ifindex, rib->vrf_id));
               break;
             case NEXTHOP_TYPE_IFINDEX:
               vty_out (vty, " directly connected, %s",
                        ifindex2ifname_vrf (nexthop->ifindex, rib->vrf_id));
               break;
             case NEXTHOP_TYPE_IFNAME:
               vty_out (vty, " directly connected, %s", nexthop->ifname);
               break;
             case NEXTHOP_TYPE_BLACKHOLE:
               vty_out (vty, " directly connected, Null0");
               break;
             default:
               break;
             }
           if (! CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_ACTIVE))
             vty_out (vty, " inactive");
   
          switch (nexthop->type)          if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_ONLINK))
            {            vty_out (vty, " onlink");
            case NEXTHOP_TYPE_IPV4: 
            case NEXTHOP_TYPE_IPV4_IFINDEX: 
              vty_out (vty, " %s", inet_ntoa (nexthop->gate.ipv4)); 
              if (nexthop->ifindex) 
                vty_out (vty, ", via %s", ifindex2ifname (nexthop->ifindex)); 
              break; 
            case NEXTHOP_TYPE_IFINDEX: 
              vty_out (vty, " directly connected, %s", 
                       ifindex2ifname (nexthop->ifindex)); 
              break; 
            case NEXTHOP_TYPE_IFNAME: 
              vty_out (vty, " directly connected, %s", nexthop->ifname); 
              break; 
      case NEXTHOP_TYPE_BLACKHOLE: 
        vty_out (vty, " directly connected, Null0"); 
        break; 
      default: 
              break; 
            } 
          if (! CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_ACTIVE)) 
            vty_out (vty, " inactive"); 
   
          if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_RECURSIVE))          if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_RECURSIVE))
            {            vty_out (vty, " (recursive)");
              vty_out (vty, " (recursive");
                          switch (nexthop->type)
              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; 
                } 
            } 
          switch (nexthop->type) 
             {              {
             case NEXTHOP_TYPE_IPV4:              case NEXTHOP_TYPE_IPV4:
             case NEXTHOP_TYPE_IPV4_IFINDEX:              case NEXTHOP_TYPE_IPV4_IFINDEX:
             case NEXTHOP_TYPE_IPV4_IFNAME:              case NEXTHOP_TYPE_IPV4_IFNAME:
               if (nexthop->src.ipv4.s_addr)                if (nexthop->src.ipv4.s_addr)
                 {                  {
                  if (inet_ntop(AF_INET, &nexthop->src.ipv4, addrstr,                  if (inet_ntop(AF_INET, &nexthop->src.ipv4, buf, sizeof buf))
                      sizeof addrstr))                    vty_out (vty, ", src %s", buf);
                    vty_out (vty, ", src %s", addrstr); 
                 }                  }
               break;                break;
 #ifdef HAVE_IPV6  #ifdef HAVE_IPV6
Line 650  vty_show_ip_route_detail (struct vty *vty, struct rout Line 1404  vty_show_ip_route_detail (struct vty *vty, struct rout
             case NEXTHOP_TYPE_IPV6_IFNAME:              case NEXTHOP_TYPE_IPV6_IFNAME:
               if (!IPV6_ADDR_SAME(&nexthop->src.ipv6, &in6addr_any))                if (!IPV6_ADDR_SAME(&nexthop->src.ipv6, &in6addr_any))
                 {                  {
                  if (inet_ntop(AF_INET6, &nexthop->src.ipv6, addrstr,                  if (inet_ntop(AF_INET6, &nexthop->src.ipv6, buf, sizeof buf))
                      sizeof addrstr))                    vty_out (vty, ", src %s", buf);
                    vty_out (vty, ", src %s", addrstr); 
                 }                  }
               break;                break;
 #endif /* HAVE_IPV6 */  #endif /* HAVE_IPV6 */
             default:              default:
               break;               break;
             }              }
          vty_out (vty, "%s", VTY_NEWLINE);          vty_out (vty, "%s", VTY_NEWLINE);
        }        }
       vty_out (vty, "%s", VTY_NEWLINE);        vty_out (vty, "%s", VTY_NEWLINE);
     }      }
 }  }
Line 668  vty_show_ip_route_detail (struct vty *vty, struct rout Line 1421  vty_show_ip_route_detail (struct vty *vty, struct rout
 static void  static void
 vty_show_ip_route (struct vty *vty, struct route_node *rn, struct rib *rib)  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;    int len = 0;
   char buf[BUFSIZ];    char buf[BUFSIZ];
   
   /* Nexthop information. */    /* Nexthop information. */
  for (nexthop = rib->nexthop; nexthop; nexthop = nexthop->next)  for (ALL_NEXTHOPS_RO(rib->nexthop, nexthop, tnexthop, recursing))
     {      {
       if (nexthop == rib->nexthop)        if (nexthop == rib->nexthop)
         {          {
           /* Prefix information. */            /* Prefix information. */
          len = vty_out (vty, "%c%c%c %s/%d",          len = vty_out (vty, "%c%c%c %s",
                          zebra_route_char (rib->type),                           zebra_route_char (rib->type),
                          CHECK_FLAG (rib->flags, ZEBRA_FLAG_SELECTED)                           CHECK_FLAG (rib->flags, ZEBRA_FLAG_SELECTED)
                          ? '>' : ' ',                           ? '>' : ' ',
                          CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB)                           CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB)
                          ? '*' : ' ',                           ? '*' : ' ',
                         inet_ntop (AF_INET, &rn->p.u.prefix, buf, BUFSIZ),                         prefix2str (&rn->p, buf, sizeof buf));
                         rn->p.prefixlen); 
                                   
           /* Distance and metric display. */            /* Distance and metric display. */
           if (rib->type != ZEBRA_ROUTE_CONNECT             if (rib->type != ZEBRA_ROUTE_CONNECT 
               && rib->type != ZEBRA_ROUTE_KERNEL)                && rib->type != ZEBRA_ROUTE_KERNEL)
             len += vty_out (vty, " [%d/%d]", rib->distance,              len += vty_out (vty, " [%d/%d]", rib->distance,
                             rib->metric);                              rib->metric);
   
             if (rib->vrf_id != VRF_DEFAULT)
               len += vty_out (vty, " [vrf %u]", rib->vrf_id);
         }          }
       else        else
         vty_out (vty, "  %c%*c",          vty_out (vty, "  %c%*c",
                  CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB)                   CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB)
                  ? '*' : ' ',                   ? '*' : ' ',
                 len - 3, ' ');                 len - 3 + (2 * recursing), ' ');
   
       switch (nexthop->type)        switch (nexthop->type)
        {        {
        case NEXTHOP_TYPE_IPV4:        case NEXTHOP_TYPE_IPV4:
        case NEXTHOP_TYPE_IPV4_IFINDEX:        case NEXTHOP_TYPE_IPV4_IFINDEX:
          vty_out (vty, " via %s", inet_ntoa (nexthop->gate.ipv4));          vty_out (vty, " via %s", inet_ntoa (nexthop->gate.ipv4));
          if (nexthop->ifindex)          if (nexthop->ifindex)
            vty_out (vty, ", %s", ifindex2ifname (nexthop->ifindex));            vty_out (vty, ", %s",
          break;                     ifindex2ifname_vrf (nexthop->ifindex, rib->vrf_id));
        case NEXTHOP_TYPE_IFINDEX:          break;
          vty_out (vty, " is directly connected, %s",        case NEXTHOP_TYPE_IPV6:
                   ifindex2ifname (nexthop->ifindex));        case NEXTHOP_TYPE_IPV6_IFINDEX:
          break;        case NEXTHOP_TYPE_IPV6_IFNAME:
        case NEXTHOP_TYPE_IFNAME:          vty_out (vty, " via %s",
          vty_out (vty, " is directly connected, %s", nexthop->ifname);                   inet_ntop (AF_INET6, &nexthop->gate.ipv6, buf, BUFSIZ));
          break;          if (nexthop->type == NEXTHOP_TYPE_IPV6_IFNAME)
  case NEXTHOP_TYPE_BLACKHOLE:            vty_out (vty, ", %s", nexthop->ifname);
    vty_out (vty, " is directly connected, Null0");          else if (nexthop->ifindex)
    break;            vty_out (vty, ", %s",
  default:                     ifindex2ifname_vrf (nexthop->ifindex, rib->vrf_id));
          break;          break;
        }        case NEXTHOP_TYPE_IFINDEX:
           vty_out (vty, " is directly connected, %s",
                    ifindex2ifname_vrf (nexthop->ifindex, rib->vrf_id));
           break;
         case NEXTHOP_TYPE_IFNAME:
           vty_out (vty, " is directly connected, %s", nexthop->ifname);
           break;
         case NEXTHOP_TYPE_BLACKHOLE:
           vty_out (vty, " is directly connected, Null0");
           break;
         default:
           break;
         }
       if (! CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_ACTIVE))        if (! CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_ACTIVE))
        vty_out (vty, " inactive");        vty_out (vty, " inactive");
   
         if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_ONLINK))
           vty_out (vty, " onlink");
   
       if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_RECURSIVE))        if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_RECURSIVE))
        {        vty_out (vty, " (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; 
            } 
        } 
       switch (nexthop->type)        switch (nexthop->type)
         {          {
           case NEXTHOP_TYPE_IPV4:            case NEXTHOP_TYPE_IPV4:
Line 749  vty_show_ip_route (struct vty *vty, struct route_node  Line 1504  vty_show_ip_route (struct vty *vty, struct route_node 
           case NEXTHOP_TYPE_IPV4_IFNAME:            case NEXTHOP_TYPE_IPV4_IFNAME:
             if (nexthop->src.ipv4.s_addr)              if (nexthop->src.ipv4.s_addr)
               {                {
                if (inet_ntop(AF_INET, &nexthop->src.ipv4, buf, sizeof buf))                if (inet_ntop(AF_INET, &nexthop->src.ipv4, buf, sizeof buf))
                   vty_out (vty, ", src %s", buf);                    vty_out (vty, ", src %s", buf);
               }                }
             break;              break;
Line 759  vty_show_ip_route (struct vty *vty, struct route_node  Line 1514  vty_show_ip_route (struct vty *vty, struct route_node 
           case NEXTHOP_TYPE_IPV6_IFNAME:            case NEXTHOP_TYPE_IPV6_IFNAME:
             if (!IPV6_ADDR_SAME(&nexthop->src.ipv6, &in6addr_any))              if (!IPV6_ADDR_SAME(&nexthop->src.ipv6, &in6addr_any))
               {                {
                if (inet_ntop(AF_INET6, &nexthop->src.ipv6, buf, sizeof buf))                if (inet_ntop(AF_INET6, &nexthop->src.ipv6, buf, sizeof buf))
                   vty_out (vty, ", src %s", buf);                    vty_out (vty, ", src %s", buf);
               }                }
             break;              break;
 #endif /* HAVE_IPV6 */  #endif /* HAVE_IPV6 */
           default:            default:
            break;            break;
         }          }
   
       if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_BLACKHOLE))        if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_BLACKHOLE))
Line 774  vty_show_ip_route (struct vty *vty, struct route_node  Line 1529  vty_show_ip_route (struct vty *vty, struct route_node 
                vty_out (vty, ", rej");                 vty_out (vty, ", rej");
   
       if (rib->type == ZEBRA_ROUTE_RIP        if (rib->type == ZEBRA_ROUTE_RIP
          || rib->type == ZEBRA_ROUTE_OSPF          || rib->type == ZEBRA_ROUTE_RIPNG
          || rib->type == ZEBRA_ROUTE_BABEL          || rib->type == ZEBRA_ROUTE_OSPF
          || rib->type == ZEBRA_ROUTE_ISIS          || rib->type == ZEBRA_ROUTE_OSPF6
          || rib->type == ZEBRA_ROUTE_BGP)          || rib->type == ZEBRA_ROUTE_BABEL
           || rib->type == ZEBRA_ROUTE_ISIS
           || rib->type == ZEBRA_ROUTE_BGP)
         {          {
           time_t uptime;            time_t uptime;
           struct tm *tm;            struct tm *tm;
Line 811  DEFUN (show_ip_route, Line 1568  DEFUN (show_ip_route,
        IP_STR         IP_STR
        "IP routing table\n")         "IP routing table\n")
 {  {
     vrf_id_t vrf_id = VRF_DEFAULT;
   
     if (argc > 0)
       VTY_GET_INTEGER ("VRF ID", vrf_id, argv[0]);
   
     return do_show_ip_route(vty, SAFI_UNICAST, vrf_id);
   }
   
   static int do_show_ip_route(struct vty *vty, safi_t safi, vrf_id_t vrf_id)
   {
   struct route_table *table;    struct route_table *table;
   struct route_node *rn;    struct route_node *rn;
   struct rib *rib;    struct rib *rib;
   int first = 1;    int first = 1;
   
  table = vrf_table (AFI_IP, SAFI_UNICAST, 0);  table = zebra_vrf_table (AFI_IP, safi, vrf_id);
   if (! table)    if (! table)
     return CMD_SUCCESS;      return CMD_SUCCESS;
   
Line 834  DEFUN (show_ip_route, Line 1601  DEFUN (show_ip_route,
   return CMD_SUCCESS;    return CMD_SUCCESS;
 }  }
   
   ALIAS (show_ip_route,
          show_ip_route_vrf_cmd,
          "show ip route " VRF_CMD_STR,
          SHOW_STR
          IP_STR
          "IP routing table\n"
          VRF_CMD_HELP_STR)
   
 DEFUN (show_ip_route_prefix_longer,  DEFUN (show_ip_route_prefix_longer,
        show_ip_route_prefix_longer_cmd,         show_ip_route_prefix_longer_cmd,
        "show ip route A.B.C.D/M longer-prefixes",         "show ip route A.B.C.D/M longer-prefixes",
Line 849  DEFUN (show_ip_route_prefix_longer, Line 1624  DEFUN (show_ip_route_prefix_longer,
   struct prefix p;    struct prefix p;
   int ret;    int ret;
   int first = 1;    int first = 1;
     vrf_id_t vrf_id = VRF_DEFAULT;
   
   ret = str2prefix (argv[0], &p);    ret = str2prefix (argv[0], &p);
   if (! ret)    if (! ret)
Line 856  DEFUN (show_ip_route_prefix_longer, Line 1632  DEFUN (show_ip_route_prefix_longer,
       vty_out (vty, "%% Malformed Prefix%s", VTY_NEWLINE);        vty_out (vty, "%% Malformed Prefix%s", VTY_NEWLINE);
       return CMD_WARNING;        return CMD_WARNING;
     }      }
  
  table = vrf_table (AFI_IP, SAFI_UNICAST, 0);  if (argc > 1)
     VTY_GET_INTEGER ("VRF ID", vrf_id, argv[1]);
 
   table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, vrf_id);
   if (! table)    if (! table)
     return CMD_SUCCESS;      return CMD_SUCCESS;
   
Line 876  DEFUN (show_ip_route_prefix_longer, Line 1655  DEFUN (show_ip_route_prefix_longer,
   return CMD_SUCCESS;    return CMD_SUCCESS;
 }  }
   
   ALIAS (show_ip_route_prefix_longer,
          show_ip_route_prefix_longer_vrf_cmd,
          "show ip route A.B.C.D/M longer-prefixes " VRF_CMD_STR,
          SHOW_STR
          IP_STR
          "IP routing table\n"
          "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
          "Show route matching the specified Network/Mask pair only\n"
          VRF_CMD_HELP_STR)
   
 DEFUN (show_ip_route_supernets,  DEFUN (show_ip_route_supernets,
        show_ip_route_supernets_cmd,         show_ip_route_supernets_cmd,
        "show ip route supernets-only",         "show ip route supernets-only",
Line 887  DEFUN (show_ip_route_supernets, Line 1676  DEFUN (show_ip_route_supernets,
   struct route_table *table;    struct route_table *table;
   struct route_node *rn;    struct route_node *rn;
   struct rib *rib;    struct rib *rib;
  u_int32_t addr;   u_int32_t addr;
   int first = 1;    int first = 1;
     vrf_id_t vrf_id = VRF_DEFAULT;
   
  table = vrf_table (AFI_IP, SAFI_UNICAST, 0);  if (argc > 0)
     VTY_GET_INTEGER ("VRF ID", vrf_id, argv[0]);
 
   table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, vrf_id);
   if (! table)    if (! table)
     return CMD_SUCCESS;      return CMD_SUCCESS;
   
Line 902  DEFUN (show_ip_route_supernets, Line 1695  DEFUN (show_ip_route_supernets,
   
         if ((IN_CLASSC (addr) && rn->p.prefixlen < 24)          if ((IN_CLASSC (addr) && rn->p.prefixlen < 24)
            || (IN_CLASSB (addr) && rn->p.prefixlen < 16)             || (IN_CLASSB (addr) && rn->p.prefixlen < 16)
           || (IN_CLASSA (addr) && rn->p.prefixlen < 8))            || (IN_CLASSA (addr) && rn->p.prefixlen < 8))
           {            {
             if (first)              if (first)
               {                {
Line 915  DEFUN (show_ip_route_supernets, Line 1708  DEFUN (show_ip_route_supernets,
   return CMD_SUCCESS;    return CMD_SUCCESS;
 }  }
   
   ALIAS (show_ip_route_supernets,
          show_ip_route_supernets_vrf_cmd,
          "show ip route supernets-only " VRF_CMD_STR,
          SHOW_STR
          IP_STR
          "IP routing table\n"
          "Show supernet entries only\n"
          VRF_CMD_HELP_STR)
   
 DEFUN (show_ip_route_protocol,  DEFUN (show_ip_route_protocol,
        show_ip_route_protocol_cmd,         show_ip_route_protocol_cmd,
        "show ip route " QUAGGA_IP_REDIST_STR_ZEBRA,         "show ip route " QUAGGA_IP_REDIST_STR_ZEBRA,
Line 928  DEFUN (show_ip_route_protocol, Line 1730  DEFUN (show_ip_route_protocol,
   struct route_node *rn;    struct route_node *rn;
   struct rib *rib;    struct rib *rib;
   int first = 1;    int first = 1;
     vrf_id_t vrf_id = VRF_DEFAULT;
   
   type = proto_redistnum (AFI_IP, argv[0]);    type = proto_redistnum (AFI_IP, argv[0]);
   if (type < 0)    if (type < 0)
Line 935  DEFUN (show_ip_route_protocol, Line 1738  DEFUN (show_ip_route_protocol,
       vty_out (vty, "Unknown route type%s", VTY_NEWLINE);        vty_out (vty, "Unknown route type%s", VTY_NEWLINE);
       return CMD_WARNING;        return CMD_WARNING;
     }      }
  
  table = vrf_table (AFI_IP, SAFI_UNICAST, 0);  if (argc > 1)
     VTY_GET_INTEGER ("VRF ID", vrf_id, argv[1]);
 
   table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, vrf_id);
   if (! table)    if (! table)
     return CMD_SUCCESS;      return CMD_SUCCESS;
   
Line 955  DEFUN (show_ip_route_protocol, Line 1761  DEFUN (show_ip_route_protocol,
   return CMD_SUCCESS;    return CMD_SUCCESS;
 }  }
   
   ALIAS (show_ip_route_protocol,
          show_ip_route_protocol_vrf_cmd,
          "show ip route " QUAGGA_IP_REDIST_STR_ZEBRA " " VRF_CMD_STR,
          SHOW_STR
          IP_STR
          "IP routing table\n"
          QUAGGA_IP_REDIST_HELP_STR_ZEBRA
          VRF_CMD_HELP_STR)
   
 DEFUN (show_ip_route_addr,  DEFUN (show_ip_route_addr,
        show_ip_route_addr_cmd,         show_ip_route_addr_cmd,
        "show ip route A.B.C.D",         "show ip route A.B.C.D",
Line 967  DEFUN (show_ip_route_addr, Line 1782  DEFUN (show_ip_route_addr,
   struct prefix_ipv4 p;    struct prefix_ipv4 p;
   struct route_table *table;    struct route_table *table;
   struct route_node *rn;    struct route_node *rn;
     vrf_id_t vrf_id = VRF_DEFAULT;
   
   ret = str2prefix_ipv4 (argv[0], &p);    ret = str2prefix_ipv4 (argv[0], &p);
   if (ret <= 0)    if (ret <= 0)
Line 975  DEFUN (show_ip_route_addr, Line 1791  DEFUN (show_ip_route_addr,
       return CMD_WARNING;        return CMD_WARNING;
     }      }
   
  table = vrf_table (AFI_IP, SAFI_UNICAST, 0);  if (argc > 1)
     VTY_GET_INTEGER ("VRF ID", vrf_id, argv[1]);
 
   table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, vrf_id);
   if (! table)    if (! table)
     return CMD_SUCCESS;      return CMD_SUCCESS;
   
Line 986  DEFUN (show_ip_route_addr, Line 1805  DEFUN (show_ip_route_addr,
       return CMD_WARNING;        return CMD_WARNING;
     }      }
   
  vty_show_ip_route_detail (vty, rn);  vty_show_ip_route_detail (vty, rn, 0);
   
   route_unlock_node (rn);    route_unlock_node (rn);
   
   return CMD_SUCCESS;    return CMD_SUCCESS;
 }  }
   
   ALIAS (show_ip_route_addr,
          show_ip_route_addr_vrf_cmd,
          "show ip route A.B.C.D " VRF_CMD_STR,
          SHOW_STR
          IP_STR
          "IP routing table\n"
          "Network in the IP routing table to display\n"
          VRF_CMD_HELP_STR)
   
 DEFUN (show_ip_route_prefix,  DEFUN (show_ip_route_prefix,
        show_ip_route_prefix_cmd,         show_ip_route_prefix_cmd,
        "show ip route A.B.C.D/M",         "show ip route A.B.C.D/M",
Line 1005  DEFUN (show_ip_route_prefix, Line 1833  DEFUN (show_ip_route_prefix,
   struct prefix_ipv4 p;    struct prefix_ipv4 p;
   struct route_table *table;    struct route_table *table;
   struct route_node *rn;    struct route_node *rn;
     vrf_id_t vrf_id = VRF_DEFAULT;
   
   ret = str2prefix_ipv4 (argv[0], &p);    ret = str2prefix_ipv4 (argv[0], &p);
   if (ret <= 0)    if (ret <= 0)
Line 1013  DEFUN (show_ip_route_prefix, Line 1842  DEFUN (show_ip_route_prefix,
       return CMD_WARNING;        return CMD_WARNING;
     }      }
   
  table = vrf_table (AFI_IP, SAFI_UNICAST, 0);  if (argc > 1)
     VTY_GET_INTEGER ("VRF ID", vrf_id, argv[1]);
 
   table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, vrf_id);
   if (! table)    if (! table)
     return CMD_SUCCESS;      return CMD_SUCCESS;
   
Line 1021  DEFUN (show_ip_route_prefix, Line 1853  DEFUN (show_ip_route_prefix,
   if (! rn || rn->p.prefixlen != p.prefixlen)    if (! rn || rn->p.prefixlen != p.prefixlen)
     {      {
       vty_out (vty, "%% Network not in table%s", VTY_NEWLINE);        vty_out (vty, "%% Network not in table%s", VTY_NEWLINE);
         if (rn)
           route_unlock_node (rn);
       return CMD_WARNING;        return CMD_WARNING;
     }      }
   
  vty_show_ip_route_detail (vty, rn);  vty_show_ip_route_detail (vty, rn, 0);
   
   route_unlock_node (rn);    route_unlock_node (rn);
   
   return CMD_SUCCESS;    return CMD_SUCCESS;
 }  }
   
   ALIAS (show_ip_route_prefix,
          show_ip_route_prefix_vrf_cmd,
          "show ip route A.B.C.D/M " VRF_CMD_STR,
          SHOW_STR
          IP_STR
          "IP routing table\n"
          "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
          VRF_CMD_HELP_STR)
   
 static void  static void
 vty_show_ip_route_summary (struct vty *vty, struct route_table *table)  vty_show_ip_route_summary (struct vty *vty, struct route_table *table)
 {  {
Line 1051  vty_show_ip_route_summary (struct vty *vty, struct rou Line 1894  vty_show_ip_route_summary (struct vty *vty, struct rou
         {          {
           rib_cnt[ZEBRA_ROUTE_TOTAL]++;            rib_cnt[ZEBRA_ROUTE_TOTAL]++;
           rib_cnt[rib->type]++;            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[ZEBRA_ROUTE_TOTAL]++;
               fib_cnt[rib->type]++;                fib_cnt[rib->type]++;
Line 1060  vty_show_ip_route_summary (struct vty *vty, struct rou Line 1904  vty_show_ip_route_summary (struct vty *vty, struct rou
               CHECK_FLAG (rib->flags, ZEBRA_FLAG_IBGP))                 CHECK_FLAG (rib->flags, ZEBRA_FLAG_IBGP)) 
             {              {
               rib_cnt[ZEBRA_ROUTE_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]++;                  fib_cnt[ZEBRA_ROUTE_IBGP]++;
             }              }
         }          }
   
  vty_out (vty, "%-20s %-20s %-20s %s",   vty_out (vty, "%-20s %-20s %s  (vrf %u)%s",
           "Route Source", "Routes", "FIB", VTY_NEWLINE);           "Route Source", "Routes", "FIB",
            ((rib_table_info_t *)table->info)->zvrf->vrf_id,
            VTY_NEWLINE);
   
   for (i = 0; i < ZEBRA_ROUTE_MAX; i++)     for (i = 0; i < ZEBRA_ROUTE_MAX; i++) 
     {      {
Line 1091  vty_show_ip_route_summary (struct vty *vty, struct rou Line 1938  vty_show_ip_route_summary (struct vty *vty, struct rou
   vty_out (vty, "------%s", VTY_NEWLINE);    vty_out (vty, "------%s", VTY_NEWLINE);
   vty_out (vty, "%-20s %-20d %-20d %s", "Totals", rib_cnt[ZEBRA_ROUTE_TOTAL],     vty_out (vty, "%-20s %-20d %-20d %s", "Totals", rib_cnt[ZEBRA_ROUTE_TOTAL], 
            fib_cnt[ZEBRA_ROUTE_TOTAL], VTY_NEWLINE);               fib_cnt[ZEBRA_ROUTE_TOTAL], VTY_NEWLINE);  
     vty_out (vty, "%s", VTY_NEWLINE);
 }  }
   
   /*
    * Implementation of the ip route summary prefix command.
    *
    * This command prints the primary prefixes that have been installed by various
    * protocols on the box.
    *
    */
   static void
   vty_show_ip_route_summary_prefix (struct vty *vty, struct route_table *table)
   {
     struct route_node *rn;
     struct rib *rib;
     struct nexthop *nexthop;
   #define ZEBRA_ROUTE_IBGP  ZEBRA_ROUTE_MAX
   #define ZEBRA_ROUTE_TOTAL (ZEBRA_ROUTE_IBGP + 1)
     u_int32_t rib_cnt[ZEBRA_ROUTE_TOTAL + 1];
     u_int32_t fib_cnt[ZEBRA_ROUTE_TOTAL + 1];
     u_int32_t i;
     int       cnt;
   
     memset (&rib_cnt, 0, sizeof(rib_cnt));
     memset (&fib_cnt, 0, sizeof(fib_cnt));
     for (rn = route_top (table); rn; rn = route_next (rn))
       RNODE_FOREACH_RIB (rn, rib)
         {
   
          /*
           * In case of ECMP, count only once.
           */
          cnt = 0;
          for (nexthop = rib->nexthop; (!cnt && nexthop); nexthop = nexthop->next)
            {
             cnt++;
             rib_cnt[ZEBRA_ROUTE_TOTAL]++;
             rib_cnt[rib->type]++;
             if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB))
                   {
                    fib_cnt[ZEBRA_ROUTE_TOTAL]++;
                fib_cnt[rib->type]++;
               }
                 if (rib->type == ZEBRA_ROUTE_BGP &&
                     CHECK_FLAG (rib->flags, ZEBRA_FLAG_IBGP))
               {
                    rib_cnt[ZEBRA_ROUTE_IBGP]++;
                        if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB))
                           fib_cnt[ZEBRA_ROUTE_IBGP]++;
               }
                }
         }
   
     vty_out (vty, "%-20s %-20s %s  (vrf %u)%s",
              "Route Source", "Prefix Routes", "FIB",
              ((rib_table_info_t *)table->info)->zvrf->vrf_id,
              VTY_NEWLINE);
   
     for (i = 0; i < ZEBRA_ROUTE_MAX; i++)
       {
         if (rib_cnt[i] > 0)
           {
             if (i == ZEBRA_ROUTE_BGP)
               {
                 vty_out (vty, "%-20s %-20d %-20d %s", "ebgp",
                          rib_cnt[ZEBRA_ROUTE_BGP] - rib_cnt[ZEBRA_ROUTE_IBGP],
                          fib_cnt[ZEBRA_ROUTE_BGP] - fib_cnt[ZEBRA_ROUTE_IBGP],
                          VTY_NEWLINE);
                 vty_out (vty, "%-20s %-20d %-20d %s", "ibgp",
                          rib_cnt[ZEBRA_ROUTE_IBGP], fib_cnt[ZEBRA_ROUTE_IBGP],
                          VTY_NEWLINE);
               }
             else
               vty_out (vty, "%-20s %-20d %-20d %s", zebra_route_string(i),
                        rib_cnt[i], fib_cnt[i], VTY_NEWLINE);
           }
       }
   
     vty_out (vty, "------%s", VTY_NEWLINE);
     vty_out (vty, "%-20s %-20d %-20d %s", "Totals", rib_cnt[ZEBRA_ROUTE_TOTAL],
              fib_cnt[ZEBRA_ROUTE_TOTAL], VTY_NEWLINE);
     vty_out (vty, "%s", VTY_NEWLINE);
   }
   
 /* Show route summary.  */  /* Show route summary.  */
 DEFUN (show_ip_route_summary,  DEFUN (show_ip_route_summary,
        show_ip_route_summary_cmd,         show_ip_route_summary_cmd,
Line 1103  DEFUN (show_ip_route_summary, Line 2032  DEFUN (show_ip_route_summary,
        "Summary of all routes\n")         "Summary of all routes\n")
 {  {
   struct route_table *table;    struct route_table *table;
     vrf_id_t vrf_id = VRF_DEFAULT;
   
  table = vrf_table (AFI_IP, SAFI_UNICAST, 0);  if (argc > 0)
     VTY_GET_INTEGER ("VRF ID", vrf_id, argv[0]);
 
   table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, vrf_id);
   if (! table)    if (! table)
     return CMD_SUCCESS;      return CMD_SUCCESS;
   
Line 1113  DEFUN (show_ip_route_summary, Line 2046  DEFUN (show_ip_route_summary,
   return CMD_SUCCESS;    return CMD_SUCCESS;
 }  }
   
   ALIAS (show_ip_route_summary,
          show_ip_route_summary_vrf_cmd,
          "show ip route summary " VRF_CMD_STR,
          SHOW_STR
          IP_STR
          "IP routing table\n"
          "Summary of all routes\n"
          VRF_CMD_HELP_STR)
   
   /* Show route summary prefix.  */
   DEFUN (show_ip_route_summary_prefix,
          show_ip_route_summary_prefix_cmd,
          "show ip route summary prefix",
          SHOW_STR
          IP_STR
          "IP routing table\n"
          "Summary of all routes\n"
          "Prefix routes\n")
   {
     struct route_table *table;
     vrf_id_t vrf_id = VRF_DEFAULT;
   
     if (argc > 0)
       VTY_GET_INTEGER ("VRF ID", vrf_id, argv[0]);
   
     table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, vrf_id);
     if (! table)
       return CMD_SUCCESS;
   
     vty_show_ip_route_summary_prefix (vty, table);
   
     return CMD_SUCCESS;
   }
   
   ALIAS (show_ip_route_summary_prefix,
          show_ip_route_summary_prefix_vrf_cmd,
          "show ip route summary prefix " VRF_CMD_STR,
          SHOW_STR
          IP_STR
          "IP routing table\n"
          "Summary of all routes\n"
          "Prefix routes\n"
          VRF_CMD_HELP_STR)
   
   DEFUN (show_ip_route_vrf_all,
          show_ip_route_vrf_all_cmd,
          "show ip route " VRF_ALL_CMD_STR,
          SHOW_STR
          IP_STR
          "IP routing table\n"
          VRF_ALL_CMD_HELP_STR)
   {
     struct route_table *table;
     struct route_node *rn;
     struct rib *rib;
     struct zebra_vrf *zvrf;
     vrf_iter_t iter;
     int first = 1;
   
     for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter))
       {
         if ((zvrf = vrf_iter2info (iter)) == NULL ||
             (table = zvrf->table[AFI_IP][SAFI_UNICAST]) == NULL)
           continue;
   
         /* 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;
   }
   
   DEFUN (show_ip_route_prefix_longer_vrf_all,
          show_ip_route_prefix_longer_vrf_all_cmd,
          "show ip route A.B.C.D/M longer-prefixes " VRF_ALL_CMD_STR,
          SHOW_STR
          IP_STR
          "IP routing table\n"
          "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
          "Show route matching the specified Network/Mask pair only\n"
          VRF_ALL_CMD_HELP_STR)
   {
     struct route_table *table;
     struct route_node *rn;
     struct rib *rib;
     struct prefix p;
     struct zebra_vrf *zvrf;
     vrf_iter_t iter;
     int ret;
     int first = 1;
   
     ret = str2prefix (argv[0], &p);
     if (! ret)
       {
         vty_out (vty, "%% Malformed Prefix%s", VTY_NEWLINE);
         return CMD_WARNING;
       }
   
     for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter))
       {
         if ((zvrf = vrf_iter2info (iter)) == NULL ||
             (table = zvrf->table[AFI_IP][SAFI_UNICAST]) == NULL)
           continue;
   
         /* Show matched type IPv4 routes. */
         for (rn = route_top (table); rn; rn = route_next (rn))
           RNODE_FOREACH_RIB (rn, rib)
             if (prefix_match (&p, &rn->p))
               {
                 if (first)
                   {
                     vty_out (vty, SHOW_ROUTE_V4_HEADER);
                     first = 0;
                   }
                 vty_show_ip_route (vty, rn, rib);
               }
       }
   
     return CMD_SUCCESS;
   }
   
   DEFUN (show_ip_route_supernets_vrf_all,
          show_ip_route_supernets_vrf_all_cmd,
          "show ip route supernets-only " VRF_ALL_CMD_STR,
          SHOW_STR
          IP_STR
          "IP routing table\n"
          "Show supernet entries only\n"
          VRF_ALL_CMD_HELP_STR)
   {
     struct route_table *table;
     struct route_node *rn;
     struct rib *rib;
     struct zebra_vrf *zvrf;
     vrf_iter_t iter;
     u_int32_t addr;
     int first = 1;
   
     for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter))
       {
         if ((zvrf = vrf_iter2info (iter)) == NULL ||
             (table = zvrf->table[AFI_IP][SAFI_UNICAST]) == NULL)
           continue;
   
         /* Show matched type IPv4 routes. */
         for (rn = route_top (table); rn; rn = route_next (rn))
           RNODE_FOREACH_RIB (rn, rib)
             {
               addr = ntohl (rn->p.u.prefix4.s_addr);
   
               if ((IN_CLASSC (addr) && rn->p.prefixlen < 24)
                  || (IN_CLASSB (addr) && rn->p.prefixlen < 16)
                  || (IN_CLASSA (addr) && rn->p.prefixlen < 8))
                 {
                   if (first)
                     {
                       vty_out (vty, SHOW_ROUTE_V4_HEADER);
                       first = 0;
                     }
                   vty_show_ip_route (vty, rn, rib);
                 }
             }
       }
   
     return CMD_SUCCESS;
   }
   
   DEFUN (show_ip_route_protocol_vrf_all,
          show_ip_route_protocol_vrf_all_cmd,
          "show ip route " QUAGGA_IP_REDIST_STR_ZEBRA " " VRF_ALL_CMD_STR,
          SHOW_STR
          IP_STR
          "IP routing table\n"
          QUAGGA_IP_REDIST_HELP_STR_ZEBRA
          VRF_ALL_CMD_HELP_STR)
   {
     int type;
     struct route_table *table;
     struct route_node *rn;
     struct rib *rib;
     struct zebra_vrf *zvrf;
     vrf_iter_t iter;
     int first = 1;
   
     type = proto_redistnum (AFI_IP, argv[0]);
     if (type < 0)
       {
         vty_out (vty, "Unknown route type%s", VTY_NEWLINE);
         return CMD_WARNING;
       }
   
     for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter))
       {
         if ((zvrf = vrf_iter2info (iter)) == NULL ||
             (table = zvrf->table[AFI_IP][SAFI_UNICAST]) == NULL)
           continue;
   
         /* Show matched type IPv4 routes. */
         for (rn = route_top (table); rn; rn = route_next (rn))
           RNODE_FOREACH_RIB (rn, rib)
             if (rib->type == type)
               {
                 if (first)
                   {
                     vty_out (vty, SHOW_ROUTE_V4_HEADER);
                     first = 0;
                   }
                 vty_show_ip_route (vty, rn, rib);
               }
       }
   
     return CMD_SUCCESS;
   }
   
   DEFUN (show_ip_route_addr_vrf_all,
          show_ip_route_addr_vrf_all_cmd,
          "show ip route A.B.C.D " VRF_ALL_CMD_STR,
          SHOW_STR
          IP_STR
          "IP routing table\n"
          "Network in the IP routing table to display\n"
          VRF_ALL_CMD_HELP_STR)
   {
     int ret;
     struct prefix_ipv4 p;
     struct route_table *table;
     struct route_node *rn;
     struct zebra_vrf *zvrf;
     vrf_iter_t iter;
   
     ret = str2prefix_ipv4 (argv[0], &p);
     if (ret <= 0)
       {
         vty_out (vty, "%% Malformed IPv4 address%s", VTY_NEWLINE);
         return CMD_WARNING;
       }
   
     for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter))
       {
         if ((zvrf = vrf_iter2info (iter)) == NULL ||
             (table = zvrf->table[AFI_IP][SAFI_UNICAST]) == NULL)
           continue;
   
         rn = route_node_match (table, (struct prefix *) &p);
         if (! rn)
           continue;
   
         vty_show_ip_route_detail (vty, rn, 0);
   
         route_unlock_node (rn);
       }
   
     return CMD_SUCCESS;
   }
   
   DEFUN (show_ip_route_prefix_vrf_all,
          show_ip_route_prefix_vrf_all_cmd,
          "show ip route A.B.C.D/M " VRF_ALL_CMD_STR,
          SHOW_STR
          IP_STR
          "IP routing table\n"
          "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
          VRF_ALL_CMD_HELP_STR)
   {
     int ret;
     struct prefix_ipv4 p;
     struct route_table *table;
     struct route_node *rn;
     struct zebra_vrf *zvrf;
     vrf_iter_t iter;
   
     ret = str2prefix_ipv4 (argv[0], &p);
     if (ret <= 0)
       {
         vty_out (vty, "%% Malformed IPv4 address%s", VTY_NEWLINE);
         return CMD_WARNING;
       }
   
     for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter))
       {
         if ((zvrf = vrf_iter2info (iter)) == NULL ||
             (table = zvrf->table[AFI_IP][SAFI_UNICAST]) == NULL)
           continue;
   
         rn = route_node_match (table, (struct prefix *) &p);
         if (! rn)
           continue;
         if (rn->p.prefixlen != p.prefixlen)
           {
             route_unlock_node (rn);
             continue;
           }
   
         vty_show_ip_route_detail (vty, rn, 0);
   
         route_unlock_node (rn);
       }
   
     return CMD_SUCCESS;
   }
   
   DEFUN (show_ip_route_summary_vrf_all,
          show_ip_route_summary_vrf_all_cmd,
          "show ip route summary " VRF_ALL_CMD_STR,
          SHOW_STR
          IP_STR
          "IP routing table\n"
          "Summary of all routes\n"
          VRF_ALL_CMD_HELP_STR)
   {
     struct zebra_vrf *zvrf;
     vrf_iter_t iter;
   
     for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter))
       if ((zvrf = vrf_iter2info (iter)) != NULL)
         vty_show_ip_route_summary (vty, zvrf->table[AFI_IP][SAFI_UNICAST]);
   
     return CMD_SUCCESS;
   }
   
   DEFUN (show_ip_route_summary_prefix_vrf_all,
          show_ip_route_summary_prefix_vrf_all_cmd,
          "show ip route summary prefix " VRF_ALL_CMD_STR,
          SHOW_STR
          IP_STR
          "IP routing table\n"
          "Summary of all routes\n"
          "Prefix routes\n"
          VRF_ALL_CMD_HELP_STR)
   {
     struct zebra_vrf *zvrf;
     vrf_iter_t iter;
   
     for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter))
       if ((zvrf = vrf_iter2info (iter)) != NULL)
         vty_show_ip_route_summary_prefix (vty, zvrf->table[AFI_IP][SAFI_UNICAST]);
   
     return CMD_SUCCESS;
   }
   
 /* Write IPv4 static route configuration. */  /* Write IPv4 static route configuration. */
 static int  static int
static_config_ipv4 (struct vty *vty)static_config_ipv4 (struct vty *vty, safi_t safi, const char *cmd)
 {  {
   struct route_node *rn;    struct route_node *rn;
  struct static_ipv4 *si;    struct static_route *si;  
   struct route_table *stable;    struct route_table *stable;
     struct zebra_vrf *zvrf;
     vrf_iter_t iter;
   int write;    int write;
   
   write = 0;    write = 0;
   
  /* Lookup table.  */  for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter))
  stable = vrf_static_table (AFI_IP, SAFI_UNICAST, 0);    {
  if (! stable)      if ((zvrf = vrf_iter2info (iter)) == NULL ||
    return -1;          (stable = zvrf->stable[AFI_IP][safi]) == NULL)
         continue;
   
  for (rn = route_top (stable); rn; rn = route_next (rn))      for (rn = route_top (stable); rn; rn = route_next (rn))
    for (si = rn->info; si; si = si->next)        for (si = rn->info; si; si = si->next)
      { 
        vty_out (vty, "ip route %s/%d", inet_ntoa (rn->p.u.prefix4), 
                 rn->p.prefixlen); 
 
        switch (si->type) 
           {            {
            case STATIC_IPV4_GATEWAY:            vty_out (vty, "%s %s/%d", cmd, inet_ntoa (rn->p.u.prefix4),
              vty_out (vty, " %s", inet_ntoa (si->gate.ipv4));                     rn->p.prefixlen);
              break; 
            case STATIC_IPV4_IFNAME: 
              vty_out (vty, " %s", si->gate.ifname); 
              break; 
            case STATIC_IPV4_BLACKHOLE: 
              vty_out (vty, " Null0"); 
              break; 
          } 
         
        /* flags are incompatible with STATIC_IPV4_BLACKHOLE */ 
        if (si->type != STATIC_IPV4_BLACKHOLE) 
          { 
            if (CHECK_FLAG(si->flags, ZEBRA_FLAG_REJECT)) 
              vty_out (vty, " %s", "reject"); 
   
            if (CHECK_FLAG(si->flags, ZEBRA_FLAG_BLACKHOLE))            switch (si->type)
              vty_out (vty, " %s", "blackhole");              {
          }                case STATIC_IPV4_GATEWAY:
                   vty_out (vty, " %s", inet_ntoa (si->addr.ipv4));
                   break;
                 case STATIC_IPV4_IFNAME:
                   vty_out (vty, " %s", si->ifname);
                   break;
                 case STATIC_IPV4_BLACKHOLE:
                   vty_out (vty, " Null0");
                   break;
               }
   
        if (si->distance != ZEBRA_STATIC_DISTANCE_DEFAULT)            /* flags are incompatible with STATIC_IPV4_BLACKHOLE */
          vty_out (vty, " %d", si->distance);            if (si->type != STATIC_IPV4_BLACKHOLE)
               {
                 if (CHECK_FLAG(si->flags, ZEBRA_FLAG_REJECT))
                   vty_out (vty, " %s", "reject");
   
        vty_out (vty, "%s", VTY_NEWLINE);                if (CHECK_FLAG(si->flags, ZEBRA_FLAG_BLACKHOLE))
                   vty_out (vty, " %s", "blackhole");
               }
   
        write = 1;            if (si->distance != ZEBRA_STATIC_DISTANCE_DEFAULT)
      }              vty_out (vty, " %d", si->distance);
 
             if (si->vrf_id != VRF_DEFAULT)
               vty_out (vty, " vrf %u", si->vrf_id);
 
             vty_out (vty, "%s", VTY_NEWLINE);
 
             write = 1;
           }
     }
   return write;    return write;
 }  }
   
Line 1197  DEFUN (show_ip_protocol, Line 2486  DEFUN (show_ip_protocol,
     return CMD_SUCCESS;      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  #ifdef HAVE_IPV6
 /* General fucntion for IPv6 static route. */  /* General fucntion for IPv6 static route. */
 static int  static int
 static_ipv6_func (struct vty *vty, int add_cmd, const char *dest_str,  static_ipv6_func (struct vty *vty, int add_cmd, const char *dest_str,
                   const char *gate_str, const char *ifname,                    const char *gate_str, const char *ifname,
                  const char *flag_str, const char *distance_str)                  const char *flag_str, const char *distance_str,
                   const char *vrf_id_str)
 {  {
   int ret;    int ret;
   u_char distance;    u_char distance;
Line 1245  static_ipv6_func (struct vty *vty, int add_cmd, const  Line 2500  static_ipv6_func (struct vty *vty, int add_cmd, const 
   struct in6_addr *gate = NULL;    struct in6_addr *gate = NULL;
   struct in6_addr gate_addr;    struct in6_addr gate_addr;
   u_char type = 0;    u_char type = 0;
  int table = 0;  vrf_id_t vrf_id = VRF_DEFAULT;
   u_char flag = 0;    u_char flag = 0;
       
   ret = str2prefix (dest_str, &p);    ret = str2prefix (dest_str, &p);
Line 1311  static_ipv6_func (struct vty *vty, int add_cmd, const  Line 2566  static_ipv6_func (struct vty *vty, int add_cmd, const 
         }          }
     }      }
   
     /* VRF id */
     if (vrf_id_str)
       VTY_GET_INTEGER ("VRF ID", vrf_id, vrf_id_str);
   
   if (add_cmd)    if (add_cmd)
    static_add_ipv6 (&p, type, gate, ifname, flag, distance, table);    static_add_ipv6 (&p, type, gate, ifname, flag, distance, vrf_id);
   else    else
    static_delete_ipv6 (&p, type, gate, ifname, distance, table);    static_delete_ipv6 (&p, type, gate, ifname, distance, vrf_id);
   
   return CMD_SUCCESS;    return CMD_SUCCESS;
 }  }
Line 1328  DEFUN (ipv6_route, Line 2587  DEFUN (ipv6_route,
        "IPv6 gateway address\n"         "IPv6 gateway address\n"
        "IPv6 gateway interface name\n")         "IPv6 gateway interface name\n")
 {  {
  return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, NULL);  return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, NULL,
                            NULL);
 }  }
   
 DEFUN (ipv6_route_flags,  DEFUN (ipv6_route_flags,
Line 1342  DEFUN (ipv6_route_flags, Line 2602  DEFUN (ipv6_route_flags,
        "Emit an ICMP unreachable when matched\n"         "Emit an ICMP unreachable when matched\n"
        "Silently discard pkts when matched\n")         "Silently discard pkts when matched\n")
 {  {
  return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, argv[2], NULL);  return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, argv[2], NULL,
                            NULL);
 }  }
   
 DEFUN (ipv6_route_ifname,  DEFUN (ipv6_route_ifname,
Line 1354  DEFUN (ipv6_route_ifname, Line 2615  DEFUN (ipv6_route_ifname,
        "IPv6 gateway address\n"         "IPv6 gateway address\n"
        "IPv6 gateway interface name\n")         "IPv6 gateway interface name\n")
 {  {
  return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, NULL);  return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, NULL,
                            NULL);
 }  }
   
 DEFUN (ipv6_route_ifname_flags,  DEFUN (ipv6_route_ifname_flags,
Line 1368  DEFUN (ipv6_route_ifname_flags, Line 2630  DEFUN (ipv6_route_ifname_flags,
        "Emit an ICMP unreachable when matched\n"         "Emit an ICMP unreachable when matched\n"
        "Silently discard pkts when matched\n")         "Silently discard pkts when matched\n")
 {  {
  return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], argv[3], NULL);  return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], argv[3], NULL,
                            NULL);
 }  }
   
 DEFUN (ipv6_route_pref,  DEFUN (ipv6_route_pref,
Line 1381  DEFUN (ipv6_route_pref, Line 2644  DEFUN (ipv6_route_pref,
        "IPv6 gateway interface name\n"         "IPv6 gateway interface name\n"
        "Distance value for this prefix\n")         "Distance value for this prefix\n")
 {  {
  return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, argv[2]);  return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, argv[2],
                            NULL);
 }  }
   
 DEFUN (ipv6_route_flags_pref,  DEFUN (ipv6_route_flags_pref,
Line 1396  DEFUN (ipv6_route_flags_pref, Line 2660  DEFUN (ipv6_route_flags_pref,
        "Silently discard pkts when matched\n"         "Silently discard pkts when matched\n"
        "Distance value for this prefix\n")         "Distance value for this prefix\n")
 {  {
  return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, argv[2], argv[3]);  return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, argv[2], argv[3],
                            NULL);
 }  }
   
 DEFUN (ipv6_route_ifname_pref,  DEFUN (ipv6_route_ifname_pref,
Line 1409  DEFUN (ipv6_route_ifname_pref, Line 2674  DEFUN (ipv6_route_ifname_pref,
        "IPv6 gateway interface name\n"         "IPv6 gateway interface name\n"
        "Distance value for this prefix\n")         "Distance value for this prefix\n")
 {  {
  return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, argv[3]);  return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, argv[3],
                            NULL);
 }  }
   
 DEFUN (ipv6_route_ifname_flags_pref,  DEFUN (ipv6_route_ifname_flags_pref,
Line 1424  DEFUN (ipv6_route_ifname_flags_pref, Line 2690  DEFUN (ipv6_route_ifname_flags_pref,
        "Silently discard pkts when matched\n"         "Silently discard pkts when matched\n"
        "Distance value for this prefix\n")         "Distance value for this prefix\n")
 {  {
  return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], argv[3], argv[4]);  return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], argv[3], argv[4],
                            NULL);
 }  }
   
 DEFUN (no_ipv6_route,  DEFUN (no_ipv6_route,
Line 1437  DEFUN (no_ipv6_route, Line 2704  DEFUN (no_ipv6_route,
        "IPv6 gateway address\n"         "IPv6 gateway address\n"
        "IPv6 gateway interface name\n")         "IPv6 gateway interface name\n")
 {  {
  return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL, NULL);  return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL, NULL,
                            NULL);
 }  }
   
 ALIAS (no_ipv6_route,  ALIAS (no_ipv6_route,
Line 1462  DEFUN (no_ipv6_route_ifname, Line 2730  DEFUN (no_ipv6_route_ifname,
        "IPv6 gateway address\n"         "IPv6 gateway address\n"
        "IPv6 gateway interface name\n")         "IPv6 gateway interface name\n")
 {  {
  return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, NULL);  return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, NULL,
                            NULL);
 }  }
   
 ALIAS (no_ipv6_route_ifname,  ALIAS (no_ipv6_route_ifname,
Line 1488  DEFUN (no_ipv6_route_pref, Line 2757  DEFUN (no_ipv6_route_pref,
        "IPv6 gateway interface name\n"         "IPv6 gateway interface name\n"
        "Distance value for this prefix\n")         "Distance value for this prefix\n")
 {  {
  return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL, argv[2]);  return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL, argv[2],
                            NULL);
 }  }
   
 DEFUN (no_ipv6_route_flags_pref,  DEFUN (no_ipv6_route_flags_pref,
Line 1505  DEFUN (no_ipv6_route_flags_pref, Line 2775  DEFUN (no_ipv6_route_flags_pref,
        "Distance value for this prefix\n")         "Distance value for this prefix\n")
 {  {
   /* We do not care about argv[2] */    /* We do not care about argv[2] */
  return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, argv[2], argv[3]);  return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, argv[2], argv[3],
                            NULL);
 }  }
   
 DEFUN (no_ipv6_route_ifname_pref,  DEFUN (no_ipv6_route_ifname_pref,
Line 1519  DEFUN (no_ipv6_route_ifname_pref, Line 2790  DEFUN (no_ipv6_route_ifname_pref,
        "IPv6 gateway interface name\n"         "IPv6 gateway interface name\n"
        "Distance value for this prefix\n")         "Distance value for this prefix\n")
 {  {
  return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, argv[3]);  return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, argv[3],
                            NULL);
 }  }
   
 DEFUN (no_ipv6_route_ifname_flags_pref,  DEFUN (no_ipv6_route_ifname_flags_pref,
Line 1535  DEFUN (no_ipv6_route_ifname_flags_pref, Line 2807  DEFUN (no_ipv6_route_ifname_flags_pref,
        "Silently discard pkts when matched\n"         "Silently discard pkts when matched\n"
        "Distance value for this prefix\n")         "Distance value for this prefix\n")
 {  {
  return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], argv[3], argv[4]);  return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], argv[3], argv[4],
                            NULL);
 }  }
   
/* New RIB.  Detailed information for IPv6 route. */DEFUN (ipv6_route_vrf,
static void       ipv6_route_vrf_cmd,
vty_show_ipv6_route_detail (struct vty *vty, struct route_node *rn)       "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) " VRF_CMD_STR,
        IP_STR
        "Establish static routes\n"
        "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
        "IPv6 gateway address\n"
        "IPv6 gateway interface name\n"
        VRF_CMD_HELP_STR)
 {  {
  struct rib *rib;  return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, NULL,
  struct nexthop *nexthop;                           argv[2]);
  char buf[BUFSIZ];}
   
  RNODE_FOREACH_RIB (rn, rib)DEFUN (ipv6_route_flags_vrf,
    {       ipv6_route_flags_vrf_cmd,
      vty_out (vty, "Routing entry for %s/%d%s",        "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) " VRF_CMD_STR,
               inet_ntop (AF_INET6, &rn->p.u.prefix6, buf, BUFSIZ),       IP_STR
               rn->p.prefixlen,       "Establish static routes\n"
               VTY_NEWLINE);       "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
      vty_out (vty, "  Known via \"%s\"", zebra_route_string (rib->type));       "IPv6 gateway address\n"
      vty_out (vty, ", distance %u, metric %u", rib->distance, rib->metric);       "IPv6 gateway interface name\n"
      if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_SELECTED))       "Emit an ICMP unreachable when matched\n"
        vty_out (vty, ", best");       "Silently discard pkts when matched\n"
      if (rib->refcnt)       VRF_CMD_HELP_STR)
        vty_out (vty, ", refcnt %ld", rib->refcnt);{
      if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_BLACKHOLE))  return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, argv[2], NULL,
       vty_out (vty, ", blackhole");                           argv[3]);
      if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_REJECT))}
       vty_out (vty, ", reject"); 
      vty_out (vty, "%s", VTY_NEWLINE); 
   
#define ONE_DAY_SECOND 60*60*24DEFUN (ipv6_route_ifname_vrf,
#define ONE_WEEK_SECOND 60*60*24*7       ipv6_route_ifname_vrf_cmd,
      if (rib->type == ZEBRA_ROUTE_RIPNG       "ipv6 route X:X::X:X/M X:X::X:X INTERFACE " VRF_CMD_STR,
          || rib->type == ZEBRA_ROUTE_OSPF6       IP_STR
          || rib->type == ZEBRA_ROUTE_BABEL       "Establish static routes\n"
          || rib->type == ZEBRA_ROUTE_ISIS       "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
          || rib->type == ZEBRA_ROUTE_BGP)       "IPv6 gateway address\n"
        {       "IPv6 gateway interface name\n"
          time_t uptime;       VRF_CMD_HELP_STR)
          struct tm *tm;{
   return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, NULL,
                            argv[3]);
 }
   
          uptime = time (NULL);DEFUN (ipv6_route_ifname_flags_vrf,
          uptime -= rib->uptime;       ipv6_route_ifname_flags_vrf_cmd,
          tm = gmtime (&uptime);       "ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) " VRF_CMD_STR,
        IP_STR
        "Establish static routes\n"
        "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
        "IPv6 gateway address\n"
        "IPv6 gateway interface name\n"
        "Emit an ICMP unreachable when matched\n"
        "Silently discard pkts when matched\n"
        VRF_CMD_HELP_STR)
 {
   return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], argv[3], NULL,
                            argv[4]);
 }
   
          vty_out (vty, "  Last update ");DEFUN (ipv6_route_pref_vrf,
        ipv6_route_pref_vrf_cmd,
        "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) <1-255> " VRF_CMD_STR,
        IP_STR
        "Establish static routes\n"
        "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
        "IPv6 gateway address\n"
        "IPv6 gateway interface name\n"
        "Distance value for this prefix\n"
        VRF_CMD_HELP_STR)
 {
   return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, argv[2],
                            argv[3]);
 }
   
          if (uptime < ONE_DAY_SECOND)DEFUN (ipv6_route_flags_pref_vrf,
            vty_out (vty,  "%02d:%02d:%02d",        ipv6_route_flags_pref_vrf_cmd,
                     tm->tm_hour, tm->tm_min, tm->tm_sec);       "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) <1-255> " VRF_CMD_STR,
          else if (uptime < ONE_WEEK_SECOND)       IP_STR
            vty_out (vty, "%dd%02dh%02dm",        "Establish static routes\n"
                     tm->tm_yday, tm->tm_hour, tm->tm_min);       "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
          else       "IPv6 gateway address\n"
            vty_out (vty, "%02dw%dd%02dh",        "IPv6 gateway interface name\n"
                     tm->tm_yday/7,       "Emit an ICMP unreachable when matched\n"
                     tm->tm_yday - ((tm->tm_yday/7) * 7), tm->tm_hour);       "Silently discard pkts when matched\n"
          vty_out (vty, " ago%s", VTY_NEWLINE);       "Distance value for this prefix\n"
        }       VRF_CMD_HELP_STR)
 {
   return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, argv[2], argv[3],
                            argv[4]);
 }
   
      for (nexthop = rib->nexthop; nexthop; nexthop = nexthop->next)DEFUN (ipv6_route_ifname_pref_vrf,
        {       ipv6_route_ifname_pref_vrf_cmd,
          vty_out (vty, "  %c",       "ipv6 route X:X::X:X/M X:X::X:X INTERFACE <1-255> " VRF_CMD_STR,
                   CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB) ? '*' : ' ');       IP_STR
        "Establish static routes\n"
        "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
        "IPv6 gateway address\n"
        "IPv6 gateway interface name\n"
        "Distance value for this prefix\n"
        VRF_CMD_HELP_STR)
 {
   return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, argv[3],
                            argv[4]);
 }
   
          switch (nexthop->type)DEFUN (ipv6_route_ifname_flags_pref_vrf,
            {       ipv6_route_ifname_flags_pref_vrf_cmd,
            case NEXTHOP_TYPE_IPV6:       "ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) <1-255> " VRF_CMD_STR,
            case NEXTHOP_TYPE_IPV6_IFINDEX:       IP_STR
            case NEXTHOP_TYPE_IPV6_IFNAME:       "Establish static routes\n"
              vty_out (vty, " %s",       "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
                       inet_ntop (AF_INET6, &nexthop->gate.ipv6, buf, BUFSIZ));       "IPv6 gateway address\n"
              if (nexthop->type == NEXTHOP_TYPE_IPV6_IFNAME)       "IPv6 gateway interface name\n"
                vty_out (vty, ", %s", nexthop->ifname);       "Emit an ICMP unreachable when matched\n"
              else if (nexthop->ifindex)       "Silently discard pkts when matched\n"
                vty_out (vty, ", via %s", ifindex2ifname (nexthop->ifindex));       "Distance value for this prefix\n"
              break;       VRF_CMD_HELP_STR)
            case NEXTHOP_TYPE_IFINDEX:{
              vty_out (vty, " directly connected, %s",  return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], argv[3], argv[4],
                       ifindex2ifname (nexthop->ifindex));                           argv[5]);
              break; 
            case NEXTHOP_TYPE_IFNAME: 
              vty_out (vty, " directly connected, %s", 
                       nexthop->ifname); 
              break; 
            default: 
              break; 
            } 
          if (! CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_ACTIVE)) 
            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, "%s", VTY_NEWLINE); 
        } 
      vty_out (vty, "%s", VTY_NEWLINE); 
    } 
 }  }
   
static voidDEFUN (no_ipv6_route_vrf,
vty_show_ipv6_route (struct vty *vty, struct route_node *rn,       no_ipv6_route_vrf_cmd,
                     struct rib *rib)       "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) " VRF_CMD_STR,
        NO_STR
        IP_STR
        "Establish static routes\n"
        "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
        "IPv6 gateway address\n"
        "IPv6 gateway interface name\n"
        VRF_CMD_HELP_STR)
 {  {
  struct nexthop *nexthop;  return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL, NULL,
  int len = 0;                           (argc > 3) ? argv[3] : argv[2]);
  char buf[BUFSIZ];}
   
  /* Nexthop information. */ALIAS (no_ipv6_route_vrf,
  for (nexthop = rib->nexthop; nexthop; nexthop = nexthop->next)       no_ipv6_route_flags_vrf_cmd,
    {       "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) " VRF_CMD_STR,
      if (nexthop == rib->nexthop)       NO_STR
        {       IP_STR
          /* Prefix information. */       "Establish static routes\n"
          len = vty_out (vty, "%c%c%c %s/%d",       "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
                         zebra_route_char (rib->type),       "IPv6 gateway address\n"
                         CHECK_FLAG (rib->flags, ZEBRA_FLAG_SELECTED)       "IPv6 gateway interface name\n"
                         ? '>' : ' ',       "Emit an ICMP unreachable when matched\n"
                         CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB)       "Silently discard pkts when matched\n"
                         ? '*' : ' ',       VRF_CMD_HELP_STR)
                         inet_ntop (AF_INET6, &rn->p.u.prefix6, buf, BUFSIZ), 
                         rn->p.prefixlen); 
   
          /* Distance and metric display. */DEFUN (no_ipv6_route_ifname_vrf,
          if (rib->type != ZEBRA_ROUTE_CONNECT        no_ipv6_route_ifname_vrf_cmd,
              && rib->type != ZEBRA_ROUTE_KERNEL)       "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE " VRF_CMD_STR,
            len += vty_out (vty, " [%d/%d]", rib->distance,       NO_STR
                            rib->metric);       IP_STR
        }       "Establish static routes\n"
      else       "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
        vty_out (vty, "  %c%*c",       "IPv6 gateway address\n"
                 CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB)       "IPv6 gateway interface name\n"
                 ? '*' : ' ',       VRF_CMD_HELP_STR)
                 len - 3, ' ');{
   return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, NULL,
                            (argc > 4) ? argv[4] : argv[3]);
 }
   
      switch (nexthop->type)ALIAS (no_ipv6_route_ifname_vrf,
        {       no_ipv6_route_ifname_flags_vrf_cmd,
        case NEXTHOP_TYPE_IPV6:       "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) " VRF_CMD_STR,
        case NEXTHOP_TYPE_IPV6_IFINDEX:       NO_STR
        case NEXTHOP_TYPE_IPV6_IFNAME:       IP_STR
          vty_out (vty, " via %s",       "Establish static routes\n"
                   inet_ntop (AF_INET6, &nexthop->gate.ipv6, buf, BUFSIZ));       "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
          if (nexthop->type == NEXTHOP_TYPE_IPV6_IFNAME)       "IPv6 gateway address\n"
            vty_out (vty, ", %s", nexthop->ifname);       "IPv6 gateway interface name\n"
          else if (nexthop->ifindex)       "Emit an ICMP unreachable when matched\n"
            vty_out (vty, ", %s", ifindex2ifname (nexthop->ifindex));       "Silently discard pkts when matched\n"
          break;       VRF_CMD_HELP_STR)
        case NEXTHOP_TYPE_IFINDEX: 
          vty_out (vty, " is directly connected, %s", 
                   ifindex2ifname (nexthop->ifindex)); 
          break; 
        case NEXTHOP_TYPE_IFNAME: 
          vty_out (vty, " is directly connected, %s", 
                   nexthop->ifname); 
          break; 
        default: 
          break; 
        } 
      if (! CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_ACTIVE)) 
        vty_out (vty, " inactive"); 
   
      if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_RECURSIVE))DEFUN (no_ipv6_route_pref_vrf,
        {       no_ipv6_route_pref_vrf_cmd,
          vty_out (vty, " (recursive");       "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) <1-255> " VRF_CMD_STR,
                       NO_STR
          switch (nexthop->rtype)       IP_STR
            {       "Establish static routes\n"
            case NEXTHOP_TYPE_IPV6:       "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
            case NEXTHOP_TYPE_IPV6_IFINDEX:       "IPv6 gateway address\n"
            case NEXTHOP_TYPE_IPV6_IFNAME:       "IPv6 gateway interface name\n"
              vty_out (vty, " via %s)",       "Distance value for this prefix\n"
                       inet_ntop (AF_INET6, &nexthop->rgate.ipv6,       VRF_CMD_HELP_STR)
                                  buf, BUFSIZ));{
              if (nexthop->rifindex)  return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL, argv[2],
                vty_out (vty, ", %s", ifindex2ifname (nexthop->rifindex));                           argv[3]);
              break;}
            case NEXTHOP_TYPE_IFINDEX: 
            case NEXTHOP_TYPE_IFNAME: 
              vty_out (vty, " is directly connected, %s)", 
                       ifindex2ifname (nexthop->rifindex)); 
              break; 
            default: 
              break; 
            } 
        } 
   
      if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_BLACKHOLE))DEFUN (no_ipv6_route_flags_pref_vrf,
       vty_out (vty, ", bh");       no_ipv6_route_flags_pref_vrf_cmd,
      if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_REJECT))       "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) <1-255> " VRF_CMD_STR,
       vty_out (vty, ", rej");       NO_STR
             IP_STR
      if (rib->type == ZEBRA_ROUTE_RIPNG       "Establish static routes\n"
          || rib->type == ZEBRA_ROUTE_OSPF6       "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
          || rib->type == ZEBRA_ROUTE_BABEL       "IPv6 gateway address\n"
          || rib->type == ZEBRA_ROUTE_ISIS       "IPv6 gateway interface name\n"
          || rib->type == ZEBRA_ROUTE_BGP)       "Emit an ICMP unreachable when matched\n"
        {       "Silently discard pkts when matched\n"
          time_t uptime;       "Distance value for this prefix\n"
          struct tm *tm;       VRF_CMD_HELP_STR)
 {
   /* We do not care about argv[2] */
   return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, argv[2], argv[3],
                            argv[4]);
 }
   
          uptime = time (NULL);DEFUN (no_ipv6_route_ifname_pref_vrf,
          uptime -= rib->uptime;       no_ipv6_route_ifname_pref_vrf_cmd,
          tm = gmtime (&uptime);       "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE <1-255> " VRF_CMD_STR,
        NO_STR
        IP_STR
        "Establish static routes\n"
        "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
        "IPv6 gateway address\n"
        "IPv6 gateway interface name\n"
        "Distance value for this prefix\n"
        VRF_CMD_HELP_STR)
 {
   return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, argv[3],
                            argv[4]);
 }
   
#define ONE_DAY_SECOND 60*60*24DEFUN (no_ipv6_route_ifname_flags_pref_vrf,
#define ONE_WEEK_SECOND 60*60*24*7       no_ipv6_route_ifname_flags_pref_vrf_cmd,
       "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) <1-255> " VRF_CMD_STR,
          if (uptime < ONE_DAY_SECOND)       NO_STR
            vty_out (vty,  ", %02d:%02d:%02d",        IP_STR
                     tm->tm_hour, tm->tm_min, tm->tm_sec);       "Establish static routes\n"
          else if (uptime < ONE_WEEK_SECOND)       "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
            vty_out (vty, ", %dd%02dh%02dm",        "IPv6 gateway address\n"
                     tm->tm_yday, tm->tm_hour, tm->tm_min);       "IPv6 gateway interface name\n"
          else       "Emit an ICMP unreachable when matched\n"
            vty_out (vty, ", %02dw%dd%02dh",        "Silently discard pkts when matched\n"
                     tm->tm_yday/7,       "Distance value for this prefix\n"
                     tm->tm_yday - ((tm->tm_yday/7) * 7), tm->tm_hour);       VRF_CMD_HELP_STR)
        }{
      vty_out (vty, "%s", VTY_NEWLINE);  return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], argv[3], argv[4],
    }                           argv[5]);
 }  }
   
 DEFUN (show_ipv6_route,  DEFUN (show_ipv6_route,
Line 1788  DEFUN (show_ipv6_route, Line 3071  DEFUN (show_ipv6_route,
   struct route_node *rn;    struct route_node *rn;
   struct rib *rib;    struct rib *rib;
   int first = 1;    int first = 1;
     vrf_id_t vrf_id = VRF_DEFAULT;
   
  table = vrf_table (AFI_IP6, SAFI_UNICAST, 0);  if (argc > 0)
     VTY_GET_INTEGER ("VRF ID", vrf_id, argv[0]);
 
   table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, vrf_id);
   if (! table)    if (! table)
     return CMD_SUCCESS;      return CMD_SUCCESS;
   
Line 1802  DEFUN (show_ipv6_route, Line 3089  DEFUN (show_ipv6_route,
             vty_out (vty, SHOW_ROUTE_V6_HEADER);              vty_out (vty, SHOW_ROUTE_V6_HEADER);
             first = 0;              first = 0;
           }            }
        vty_show_ipv6_route (vty, rn, rib);        vty_show_ip_route (vty, rn, rib);
       }        }
   return CMD_SUCCESS;    return CMD_SUCCESS;
 }  }
   
   ALIAS (show_ipv6_route,
          show_ipv6_route_vrf_cmd,
          "show ipv6 route " VRF_CMD_STR,
          SHOW_STR
          IP_STR
          "IPv6 routing table\n"
          VRF_CMD_HELP_STR)
   
 DEFUN (show_ipv6_route_prefix_longer,  DEFUN (show_ipv6_route_prefix_longer,
        show_ipv6_route_prefix_longer_cmd,         show_ipv6_route_prefix_longer_cmd,
        "show ipv6 route X:X::X:X/M longer-prefixes",         "show ipv6 route X:X::X:X/M longer-prefixes",
Line 1822  DEFUN (show_ipv6_route_prefix_longer, Line 3117  DEFUN (show_ipv6_route_prefix_longer,
   struct prefix p;    struct prefix p;
   int ret;    int ret;
   int first = 1;    int first = 1;
     vrf_id_t vrf_id = VRF_DEFAULT;
   
   table = vrf_table (AFI_IP6, SAFI_UNICAST, 0);  
   if (! table)  
     return CMD_SUCCESS;  
   
   ret = str2prefix (argv[0], &p);    ret = str2prefix (argv[0], &p);
   if (! ret)    if (! ret)
     {      {
Line 1834  DEFUN (show_ipv6_route_prefix_longer, Line 3126  DEFUN (show_ipv6_route_prefix_longer,
       return CMD_WARNING;        return CMD_WARNING;
     }      }
   
     if (argc > 1)
       VTY_GET_INTEGER ("VRF ID", vrf_id, argv[1]);
   
     table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, vrf_id);
     if (! table)
       return CMD_SUCCESS;
   
   /* Show matched type IPv6 routes. */    /* Show matched type IPv6 routes. */
   for (rn = route_top (table); rn; rn = route_next (rn))    for (rn = route_top (table); rn; rn = route_next (rn))
     RNODE_FOREACH_RIB (rn, rib)      RNODE_FOREACH_RIB (rn, rib)
Line 1844  DEFUN (show_ipv6_route_prefix_longer, Line 3143  DEFUN (show_ipv6_route_prefix_longer,
               vty_out (vty, SHOW_ROUTE_V6_HEADER);                vty_out (vty, SHOW_ROUTE_V6_HEADER);
               first = 0;                first = 0;
             }              }
          vty_show_ipv6_route (vty, rn, rib);          vty_show_ip_route (vty, rn, rib);
         }          }
   return CMD_SUCCESS;    return CMD_SUCCESS;
 }  }
   
   ALIAS (show_ipv6_route_prefix_longer,
          show_ipv6_route_prefix_longer_vrf_cmd,
          "show ipv6 route X:X::X:X/M longer-prefixes " VRF_CMD_STR,
          SHOW_STR
          IP_STR
          "IPv6 routing table\n"
          "IPv6 prefix\n"
          "Show route matching the specified Network/Mask pair only\n"
          VRF_CMD_HELP_STR)
   
 DEFUN (show_ipv6_route_protocol,  DEFUN (show_ipv6_route_protocol,
        show_ipv6_route_protocol_cmd,         show_ipv6_route_protocol_cmd,
        "show ipv6 route " QUAGGA_IP6_REDIST_STR_ZEBRA,         "show ipv6 route " QUAGGA_IP6_REDIST_STR_ZEBRA,
Line 1862  DEFUN (show_ipv6_route_protocol, Line 3171  DEFUN (show_ipv6_route_protocol,
   struct route_node *rn;    struct route_node *rn;
   struct rib *rib;    struct rib *rib;
   int first = 1;    int first = 1;
     vrf_id_t vrf_id = VRF_DEFAULT;
   
   type = proto_redistnum (AFI_IP6, argv[0]);    type = proto_redistnum (AFI_IP6, argv[0]);
   if (type < 0)    if (type < 0)
Line 1869  DEFUN (show_ipv6_route_protocol, Line 3179  DEFUN (show_ipv6_route_protocol,
       vty_out (vty, "Unknown route type%s", VTY_NEWLINE);        vty_out (vty, "Unknown route type%s", VTY_NEWLINE);
       return CMD_WARNING;        return CMD_WARNING;
     }      }
  
  table = vrf_table (AFI_IP6, SAFI_UNICAST, 0);  if (argc > 1)
     VTY_GET_INTEGER ("VRF ID", vrf_id, argv[1]);
 
   table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, vrf_id);
   if (! table)    if (! table)
     return CMD_SUCCESS;      return CMD_SUCCESS;
   
Line 1884  DEFUN (show_ipv6_route_protocol, Line 3197  DEFUN (show_ipv6_route_protocol,
               vty_out (vty, SHOW_ROUTE_V6_HEADER);                vty_out (vty, SHOW_ROUTE_V6_HEADER);
               first = 0;                first = 0;
             }              }
          vty_show_ipv6_route (vty, rn, rib);          vty_show_ip_route (vty, rn, rib);
         }          }
   return CMD_SUCCESS;    return CMD_SUCCESS;
 }  }
   
   ALIAS (show_ipv6_route_protocol,
          show_ipv6_route_protocol_vrf_cmd,
          "show ipv6 route " QUAGGA_IP6_REDIST_STR_ZEBRA " " VRF_CMD_STR,
          SHOW_STR
          IP_STR
          "IP routing table\n"
          QUAGGA_IP6_REDIST_HELP_STR_ZEBRA
          VRF_CMD_HELP_STR)
   
 DEFUN (show_ipv6_route_addr,  DEFUN (show_ipv6_route_addr,
        show_ipv6_route_addr_cmd,         show_ipv6_route_addr_cmd,
        "show ipv6 route X:X::X:X",         "show ipv6 route X:X::X:X",
Line 1901  DEFUN (show_ipv6_route_addr, Line 3223  DEFUN (show_ipv6_route_addr,
   struct prefix_ipv6 p;    struct prefix_ipv6 p;
   struct route_table *table;    struct route_table *table;
   struct route_node *rn;    struct route_node *rn;
     vrf_id_t vrf_id = VRF_DEFAULT;
   
   ret = str2prefix_ipv6 (argv[0], &p);    ret = str2prefix_ipv6 (argv[0], &p);
   if (ret <= 0)    if (ret <= 0)
Line 1909  DEFUN (show_ipv6_route_addr, Line 3232  DEFUN (show_ipv6_route_addr,
       return CMD_WARNING;        return CMD_WARNING;
     }      }
   
  table = vrf_table (AFI_IP6, SAFI_UNICAST, 0);  if (argc > 1)
     VTY_GET_INTEGER ("VRF ID", vrf_id, argv[1]);
 
   table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, vrf_id);
   if (! table)    if (! table)
     return CMD_SUCCESS;      return CMD_SUCCESS;
   
Line 1920  DEFUN (show_ipv6_route_addr, Line 3246  DEFUN (show_ipv6_route_addr,
       return CMD_WARNING;        return CMD_WARNING;
     }      }
   
  vty_show_ipv6_route_detail (vty, rn);  vty_show_ip_route_detail (vty, rn, 0);
   
   route_unlock_node (rn);    route_unlock_node (rn);
   
   return CMD_SUCCESS;    return CMD_SUCCESS;
 }  }
   
   ALIAS (show_ipv6_route_addr,
          show_ipv6_route_addr_vrf_cmd,
          "show ipv6 route X:X::X:X " VRF_CMD_STR,
          SHOW_STR
          IP_STR
          "IPv6 routing table\n"
          "IPv6 Address\n"
          VRF_CMD_HELP_STR)
   
 DEFUN (show_ipv6_route_prefix,  DEFUN (show_ipv6_route_prefix,
        show_ipv6_route_prefix_cmd,         show_ipv6_route_prefix_cmd,
        "show ipv6 route X:X::X:X/M",         "show ipv6 route X:X::X:X/M",
Line 1939  DEFUN (show_ipv6_route_prefix, Line 3274  DEFUN (show_ipv6_route_prefix,
   struct prefix_ipv6 p;    struct prefix_ipv6 p;
   struct route_table *table;    struct route_table *table;
   struct route_node *rn;    struct route_node *rn;
     vrf_id_t vrf_id = VRF_DEFAULT;
   
   ret = str2prefix_ipv6 (argv[0], &p);    ret = str2prefix_ipv6 (argv[0], &p);
   if (ret <= 0)    if (ret <= 0)
Line 1947  DEFUN (show_ipv6_route_prefix, Line 3283  DEFUN (show_ipv6_route_prefix,
       return CMD_WARNING;        return CMD_WARNING;
     }      }
   
  table = vrf_table (AFI_IP6, SAFI_UNICAST, 0);  if (argc > 1)
     VTY_GET_INTEGER ("VRF ID", vrf_id, argv[1]);
 
   table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, vrf_id);
   if (! table)    if (! table)
     return CMD_SUCCESS;      return CMD_SUCCESS;
   
Line 1955  DEFUN (show_ipv6_route_prefix, Line 3294  DEFUN (show_ipv6_route_prefix,
   if (! rn || rn->p.prefixlen != p.prefixlen)    if (! rn || rn->p.prefixlen != p.prefixlen)
     {      {
       vty_out (vty, "%% Network not in table%s", VTY_NEWLINE);        vty_out (vty, "%% Network not in table%s", VTY_NEWLINE);
         if (rn)
           route_unlock_node (rn);
       return CMD_WARNING;        return CMD_WARNING;
     }      }
   
  vty_show_ipv6_route_detail (vty, rn);  vty_show_ip_route_detail (vty, rn, 0);
   
   route_unlock_node (rn);    route_unlock_node (rn);
   
   return CMD_SUCCESS;    return CMD_SUCCESS;
 }  }
   
   ALIAS (show_ipv6_route_prefix,
          show_ipv6_route_prefix_vrf_cmd,
          "show ipv6 route X:X::X:X/M " VRF_CMD_STR,
          SHOW_STR
          IP_STR
          "IPv6 routing table\n"
          "IPv6 prefix\n"
          VRF_CMD_HELP_STR)
   
 /* Show route summary.  */  /* Show route summary.  */
 DEFUN (show_ipv6_route_summary,  DEFUN (show_ipv6_route_summary,
        show_ipv6_route_summary_cmd,         show_ipv6_route_summary_cmd,
Line 1975  DEFUN (show_ipv6_route_summary, Line 3325  DEFUN (show_ipv6_route_summary,
        "Summary of all IPv6 routes\n")         "Summary of all IPv6 routes\n")
 {  {
   struct route_table *table;    struct route_table *table;
     vrf_id_t vrf_id = VRF_DEFAULT;
   
  table = vrf_table (AFI_IP6, SAFI_UNICAST, 0);  if (argc > 0)
     VTY_GET_INTEGER ("VRF ID", vrf_id, argv[0]);
 
   table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, vrf_id);
   if (! table)    if (! table)
     return CMD_SUCCESS;      return CMD_SUCCESS;
   
Line 1985  DEFUN (show_ipv6_route_summary, Line 3339  DEFUN (show_ipv6_route_summary,
   return CMD_SUCCESS;    return CMD_SUCCESS;
 }  }
   
   ALIAS (show_ipv6_route_summary,
          show_ipv6_route_summary_vrf_cmd,
          "show ipv6 route summary " VRF_CMD_STR,
          SHOW_STR
          IP_STR
          "IPv6 routing table\n"
          "Summary of all IPv6 routes\n"
          VRF_CMD_HELP_STR)
   
   /* Show ipv6 route summary prefix.  */
   DEFUN (show_ipv6_route_summary_prefix,
          show_ipv6_route_summary_prefix_cmd,
          "show ipv6 route summary prefix",
          SHOW_STR
          IP_STR
          "IPv6 routing table\n"
          "Summary of all IPv6 routes\n"
          "Prefix routes\n")
   {
     struct route_table *table;
     vrf_id_t vrf_id = VRF_DEFAULT;
   
     if (argc > 0)
       VTY_GET_INTEGER ("VRF ID", vrf_id, argv[0]);
   
     table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, vrf_id);
     if (! table)
       return CMD_SUCCESS;
   
     vty_show_ip_route_summary_prefix (vty, table);
   
     return CMD_SUCCESS;
   }
   
   ALIAS (show_ipv6_route_summary_prefix,
          show_ipv6_route_summary_prefix_vrf_cmd,
          "show ipv6 route summary prefix " VRF_CMD_STR,
          SHOW_STR
          IP_STR
          "IPv6 routing table\n"
          "Summary of all IPv6 routes\n"
          "Prefix routes\n"
          VRF_CMD_HELP_STR)
   
 /*  /*
  * Show IPv6 mroute command.Used to dump   * Show IPv6 mroute command.Used to dump
  * the Multicast routing table.   * the Multicast routing table.
Line 2001  DEFUN (show_ipv6_mroute, Line 3399  DEFUN (show_ipv6_mroute,
   struct route_node *rn;    struct route_node *rn;
   struct rib *rib;    struct rib *rib;
   int first = 1;    int first = 1;
     vrf_id_t vrf_id = VRF_DEFAULT;
   
  table = vrf_table (AFI_IP6, SAFI_MULTICAST, 0);  if (argc > 0)
     VTY_GET_INTEGER ("VRF ID", vrf_id, argv[0]);
 
   table = zebra_vrf_table (AFI_IP6, SAFI_MULTICAST, vrf_id);
   if (! table)    if (! table)
     return CMD_SUCCESS;      return CMD_SUCCESS;
   
Line 2015  DEFUN (show_ipv6_mroute, Line 3417  DEFUN (show_ipv6_mroute,
            vty_out (vty, SHOW_ROUTE_V6_HEADER);             vty_out (vty, SHOW_ROUTE_V6_HEADER);
            first = 0;             first = 0;
          }           }
       vty_show_ipv6_route (vty, rn, rib);       vty_show_ip_route (vty, rn, rib);
       }        }
   return CMD_SUCCESS;    return CMD_SUCCESS;
 }  }
   
   ALIAS (show_ipv6_mroute,
          show_ipv6_mroute_vrf_cmd,
          "show ipv6 mroute " VRF_CMD_STR,
          SHOW_STR
          IP_STR
          "IPv6 Multicast routing table\n"
          VRF_CMD_HELP_STR)
   
   DEFUN (show_ipv6_route_vrf_all,
          show_ipv6_route_vrf_all_cmd,
          "show ipv6 route " VRF_ALL_CMD_STR,
          SHOW_STR
          IP_STR
          "IPv6 routing table\n"
          VRF_ALL_CMD_HELP_STR)
   {
     struct route_table *table;
     struct route_node *rn;
     struct rib *rib;
     struct zebra_vrf *zvrf;
     vrf_iter_t iter;
     int first = 1;
   
     for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter))
       {
         if ((zvrf = vrf_iter2info (iter)) == NULL ||
             (table = zvrf->table[AFI_IP6][SAFI_UNICAST]) == NULL)
           continue;
   
         /* Show all IPv6 route. */
         for (rn = route_top (table); rn; rn = route_next (rn))
           RNODE_FOREACH_RIB (rn, rib)
             {
               if (first)
                 {
                   vty_out (vty, SHOW_ROUTE_V6_HEADER);
                   first = 0;
                 }
               vty_show_ip_route (vty, rn, rib);
             }
       }
   
     return CMD_SUCCESS;
   }
   
   DEFUN (show_ipv6_route_prefix_longer_vrf_all,
          show_ipv6_route_prefix_longer_vrf_all_cmd,
          "show ipv6 route X:X::X:X/M longer-prefixes " VRF_ALL_CMD_STR,
          SHOW_STR
          IP_STR
          "IPv6 routing table\n"
          "IPv6 prefix\n"
          "Show route matching the specified Network/Mask pair only\n"
          VRF_ALL_CMD_HELP_STR)
   {
     struct route_table *table;
     struct route_node *rn;
     struct rib *rib;
     struct prefix p;
     struct zebra_vrf *zvrf;
     vrf_iter_t iter;
     int ret;
     int first = 1;
   
     ret = str2prefix (argv[0], &p);
     if (! ret)
       {
         vty_out (vty, "%% Malformed Prefix%s", VTY_NEWLINE);
         return CMD_WARNING;
       }
   
     for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter))
       {
         if ((zvrf = vrf_iter2info (iter)) == NULL ||
             (table = zvrf->table[AFI_IP6][SAFI_UNICAST]) == NULL)
           continue;
   
         /* Show matched type IPv6 routes. */
         for (rn = route_top (table); rn; rn = route_next (rn))
           RNODE_FOREACH_RIB (rn, rib)
             if (prefix_match (&p, &rn->p))
               {
                 if (first)
                   {
                     vty_out (vty, SHOW_ROUTE_V6_HEADER);
                     first = 0;
                   }
                 vty_show_ip_route (vty, rn, rib);
               }
       }
   
     return CMD_SUCCESS;
   }
   
   DEFUN (show_ipv6_route_protocol_vrf_all,
          show_ipv6_route_protocol_vrf_all_cmd,
          "show ipv6 route " QUAGGA_IP6_REDIST_STR_ZEBRA " " VRF_ALL_CMD_STR,
          SHOW_STR
          IP_STR
          "IP routing table\n"
          QUAGGA_IP6_REDIST_HELP_STR_ZEBRA
          VRF_ALL_CMD_HELP_STR)
   {
     int type;
     struct route_table *table;
     struct route_node *rn;
     struct rib *rib;
     struct zebra_vrf *zvrf;
     vrf_iter_t iter;
     int first = 1;
   
     type = proto_redistnum (AFI_IP6, argv[0]);
     if (type < 0)
       {
         vty_out (vty, "Unknown route type%s", VTY_NEWLINE);
         return CMD_WARNING;
       }
   
     for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter))
       {
         if ((zvrf = vrf_iter2info (iter)) == NULL ||
             (table = zvrf->table[AFI_IP6][SAFI_UNICAST]) == NULL)
           continue;
   
         /* Show matched type IPv6 routes. */
         for (rn = route_top (table); rn; rn = route_next (rn))
           RNODE_FOREACH_RIB (rn, rib)
             if (rib->type == type)
               {
                 if (first)
                   {
                     vty_out (vty, SHOW_ROUTE_V6_HEADER);
                     first = 0;
                   }
                 vty_show_ip_route (vty, rn, rib);
               }
       }
   
     return CMD_SUCCESS;
   }
   
   DEFUN (show_ipv6_route_addr_vrf_all,
          show_ipv6_route_addr_vrf_all_cmd,
          "show ipv6 route X:X::X:X " VRF_ALL_CMD_STR,
          SHOW_STR
          IP_STR
          "IPv6 routing table\n"
          "IPv6 Address\n"
          VRF_ALL_CMD_HELP_STR)
   {
     int ret;
     struct prefix_ipv6 p;
     struct route_table *table;
     struct route_node *rn;
     struct zebra_vrf *zvrf;
     vrf_iter_t iter;
   
     ret = str2prefix_ipv6 (argv[0], &p);
     if (ret <= 0)
       {
         vty_out (vty, "Malformed IPv6 address%s", VTY_NEWLINE);
         return CMD_WARNING;
       }
   
     for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter))
       {
         if ((zvrf = vrf_iter2info (iter)) == NULL ||
             (table = zvrf->table[AFI_IP6][SAFI_UNICAST]) == NULL)
           continue;
   
         rn = route_node_match (table, (struct prefix *) &p);
         if (! rn)
           continue;
   
         vty_show_ip_route_detail (vty, rn, 0);
   
         route_unlock_node (rn);
       }
   
     return CMD_SUCCESS;
   }
   
   DEFUN (show_ipv6_route_prefix_vrf_all,
          show_ipv6_route_prefix_vrf_all_cmd,
          "show ipv6 route X:X::X:X/M " VRF_ALL_CMD_STR,
          SHOW_STR
          IP_STR
          "IPv6 routing table\n"
          "IPv6 prefix\n"
          VRF_ALL_CMD_HELP_STR)
   {
     int ret;
     struct prefix_ipv6 p;
     struct route_table *table;
     struct route_node *rn;
     struct zebra_vrf *zvrf;
     vrf_iter_t iter;
   
     ret = str2prefix_ipv6 (argv[0], &p);
     if (ret <= 0)
       {
         vty_out (vty, "Malformed IPv6 prefix%s", VTY_NEWLINE);
         return CMD_WARNING;
       }
   
     for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter))
       {
         if ((zvrf = vrf_iter2info (iter)) == NULL ||
             (table = zvrf->table[AFI_IP6][SAFI_UNICAST]) == NULL)
           continue;
   
         rn = route_node_match (table, (struct prefix *) &p);
         if (! rn)
           continue;
         if (rn->p.prefixlen != p.prefixlen)
           {
             route_unlock_node (rn);
             continue;
           }
   
         vty_show_ip_route_detail (vty, rn, 0);
   
         route_unlock_node (rn);
       }
   
     return CMD_SUCCESS;
   }
   
   /* Show route summary.  */
   DEFUN (show_ipv6_route_summary_vrf_all,
          show_ipv6_route_summary_vrf_all_cmd,
          "show ipv6 route summary " VRF_ALL_CMD_STR,
          SHOW_STR
          IP_STR
          "IPv6 routing table\n"
          "Summary of all IPv6 routes\n"
          VRF_ALL_CMD_HELP_STR)
   {
     struct zebra_vrf *zvrf;
     vrf_iter_t iter;
   
     for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter))
       if ((zvrf = vrf_iter2info (iter)) != NULL)
         vty_show_ip_route_summary (vty, zvrf->table[AFI_IP6][SAFI_UNICAST]);
   
     return CMD_SUCCESS;
   }
   
   DEFUN (show_ipv6_mroute_vrf_all,
          show_ipv6_mroute_vrf_all_cmd,
          "show ipv6 mroute " VRF_ALL_CMD_STR,
          SHOW_STR
          IP_STR
          "IPv6 Multicast routing table\n"
          VRF_ALL_CMD_HELP_STR)
   {
     struct route_table *table;
     struct route_node *rn;
     struct rib *rib;
     struct zebra_vrf *zvrf;
     vrf_iter_t iter;
     int first = 1;
   
     for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter))
       {
         if ((zvrf = vrf_iter2info (iter)) == NULL ||
             (table = zvrf->table[AFI_IP6][SAFI_UNICAST]) == NULL)
           continue;
   
         /* Show all IPv6 route. */
         for (rn = route_top (table); rn; rn = route_next (rn))
           RNODE_FOREACH_RIB (rn, rib)
             {
              if (first)
                {
                  vty_out (vty, SHOW_ROUTE_V6_HEADER);
                  first = 0;
                }
              vty_show_ip_route (vty, rn, rib);
             }
       }
     return CMD_SUCCESS;
   }
   
   DEFUN (show_ipv6_route_summary_prefix_vrf_all,
          show_ipv6_route_summary_prefix_vrf_all_cmd,
          "show ipv6 route summary prefix " VRF_ALL_CMD_STR,
          SHOW_STR
          IP_STR
          "IPv6 routing table\n"
          "Summary of all IPv6 routes\n"
          "Prefix routes\n"
          VRF_ALL_CMD_HELP_STR)
   {
     struct zebra_vrf *zvrf;
     vrf_iter_t iter;
   
     for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter))
       if ((zvrf = vrf_iter2info (iter)) != NULL)
         vty_show_ip_route_summary_prefix (vty, zvrf->table[AFI_IP6][SAFI_UNICAST]);
   
     return CMD_SUCCESS;
   }
   
 /* Write IPv6 static route configuration. */  /* Write IPv6 static route configuration. */
 static int  static int
 static_config_ipv6 (struct vty *vty)  static_config_ipv6 (struct vty *vty)
 {  {
   struct route_node *rn;    struct route_node *rn;
  struct static_ipv6 *si;    struct static_route *si;  
   int write;    int write;
   char buf[BUFSIZ];    char buf[BUFSIZ];
   struct route_table *stable;    struct route_table *stable;
     struct zebra_vrf *zvrf;
     vrf_iter_t iter;
   
   write = 0;    write = 0;
   
  /* Lookup table.  */  for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter))
  stable = vrf_static_table (AFI_IP6, SAFI_UNICAST, 0);    {
  if (! stable)      if ((zvrf = vrf_iter2info (iter)) == NULL ||
    return -1;          (stable = zvrf->stable[AFI_IP6][SAFI_UNICAST]) == NULL)
         continue;
   
  for (rn = route_top (stable); rn; rn = route_next (rn))      for (rn = route_top (stable); rn; rn = route_next (rn))
    for (si = rn->info; si; si = si->next)        for (si = rn->info; si; si = si->next)
      {          {
        vty_out (vty, "ipv6 route %s/%d",            vty_out (vty, "ipv6 route %s", prefix2str (&rn->p, buf, sizeof buf));
                 inet_ntop (AF_INET6, &rn->p.u.prefix6, buf, BUFSIZ), 
                 rn->p.prefixlen); 
   
        switch (si->type)            switch (si->type)
          {              {
          case STATIC_IPV6_GATEWAY:              case STATIC_IPV6_GATEWAY:
            vty_out (vty, " %s", inet_ntop (AF_INET6, &si->ipv6, buf, BUFSIZ));                vty_out (vty, " %s",
            break;                         inet_ntop (AF_INET6, &si->addr.ipv6, buf, BUFSIZ));
          case STATIC_IPV6_IFNAME:                break;
            vty_out (vty, " %s", si->ifname);              case STATIC_IPV6_IFNAME:
            break;                vty_out (vty, " %s", si->ifname);
          case STATIC_IPV6_GATEWAY_IFNAME:                break;
            vty_out (vty, " %s %s",              case STATIC_IPV6_GATEWAY_IFNAME:
                     inet_ntop (AF_INET6, &si->ipv6, buf, BUFSIZ), si->ifname);                vty_out (vty, " %s %s",
            break;                         inet_ntop (AF_INET6, &si->addr.ipv6, buf, BUFSIZ),
          }                         si->ifname);
                 break;
               }
   
       if (CHECK_FLAG(si->flags, ZEBRA_FLAG_REJECT))            if (CHECK_FLAG(si->flags, ZEBRA_FLAG_REJECT))
               vty_out (vty, " %s", "reject");              vty_out (vty, " %s", "reject");
   
       if (CHECK_FLAG(si->flags, ZEBRA_FLAG_BLACKHOLE))            if (CHECK_FLAG(si->flags, ZEBRA_FLAG_BLACKHOLE))
               vty_out (vty, " %s", "blackhole");              vty_out (vty, " %s", "blackhole");
   
        if (si->distance != ZEBRA_STATIC_DISTANCE_DEFAULT)            if (si->distance != ZEBRA_STATIC_DISTANCE_DEFAULT)
          vty_out (vty, " %d", si->distance);              vty_out (vty, " %d", si->distance);
        vty_out (vty, "%s", VTY_NEWLINE); 
   
        write = 1;            if (si->vrf_id != VRF_DEFAULT)
      }              vty_out (vty, " vrf %u", si->vrf_id);
 
             vty_out (vty, "%s", VTY_NEWLINE);
 
             write = 1;
           }
     }
   return write;    return write;
 }  }
 #endif /* HAVE_IPV6 */  #endif /* HAVE_IPV6 */
Line 2080  zebra_ip_config (struct vty *vty) Line 3794  zebra_ip_config (struct vty *vty)
 {  {
   int write = 0;    int write = 0;
   
  write += static_config_ipv4 (vty);  write += static_config_ipv4 (vty, SAFI_UNICAST, "ip route");
   write += static_config_ipv4 (vty, SAFI_MULTICAST, "ip mroute");
 #ifdef HAVE_IPV6  #ifdef HAVE_IPV6
   write += static_config_ipv6 (vty);    write += static_config_ipv6 (vty);
 #endif /* HAVE_IPV6 */  #endif /* HAVE_IPV6 */
Line 2088  zebra_ip_config (struct vty *vty) Line 3803  zebra_ip_config (struct vty *vty)
   return write;    return write;
 }  }
   
/* ip protocol configuration write function */static int config_write_vty(struct vty *vty)
static int config_write_protocol(struct vty *vty){
{   
   int i;    int i;
     enum multicast_mode ipv4_multicast_mode = multicast_mode_ipv4_get ();
   
     if (ipv4_multicast_mode != MCAST_NO_CONFIG)
       vty_out (vty, "ip multicast rpf-lookup-mode %s%s",
                ipv4_multicast_mode == MCAST_URIB_ONLY ? "urib-only" :
                ipv4_multicast_mode == MCAST_MRIB_ONLY ? "mrib-only" :
                ipv4_multicast_mode == MCAST_MIX_MRIB_FIRST ? "mrib-then-urib" :
                ipv4_multicast_mode == MCAST_MIX_DISTANCE ? "lower-distance" :
                "longer-prefix",
                VTY_NEWLINE);
   
   for (i=0;i<ZEBRA_ROUTE_MAX;i++)    for (i=0;i<ZEBRA_ROUTE_MAX;i++)
     {      {
       if (proto_rm[AFI_IP][i])        if (proto_rm[AFI_IP][i])
Line 2117  void Line 3841  void
 zebra_vty_init (void)  zebra_vty_init (void)
 {  {
   install_node (&ip_node, zebra_ip_config);    install_node (&ip_node, zebra_ip_config);
  install_node (&protocol_node, config_write_protocol);  install_node (&protocol_node, config_write_vty);
   
     install_element (CONFIG_NODE, &ip_mroute_cmd);
     install_element (CONFIG_NODE, &ip_mroute_dist_cmd);
     install_element (CONFIG_NODE, &no_ip_mroute_cmd);
     install_element (CONFIG_NODE, &no_ip_mroute_dist_cmd);
     install_element (CONFIG_NODE, &ip_multicast_mode_cmd);
     install_element (CONFIG_NODE, &no_ip_multicast_mode_cmd);
     install_element (CONFIG_NODE, &no_ip_multicast_mode_noarg_cmd);
   install_element (CONFIG_NODE, &ip_protocol_cmd);    install_element (CONFIG_NODE, &ip_protocol_cmd);
   install_element (CONFIG_NODE, &no_ip_protocol_cmd);    install_element (CONFIG_NODE, &no_ip_protocol_cmd);
   install_element (VIEW_NODE, &show_ip_protocol_cmd);    install_element (VIEW_NODE, &show_ip_protocol_cmd);
Line 2154  zebra_vty_init (void) Line 3885  zebra_vty_init (void)
   install_element (VIEW_NODE, &show_ip_route_protocol_cmd);    install_element (VIEW_NODE, &show_ip_route_protocol_cmd);
   install_element (VIEW_NODE, &show_ip_route_supernets_cmd);    install_element (VIEW_NODE, &show_ip_route_supernets_cmd);
   install_element (VIEW_NODE, &show_ip_route_summary_cmd);    install_element (VIEW_NODE, &show_ip_route_summary_cmd);
     install_element (VIEW_NODE, &show_ip_route_summary_prefix_cmd);
   install_element (ENABLE_NODE, &show_ip_route_cmd);    install_element (ENABLE_NODE, &show_ip_route_cmd);
   install_element (ENABLE_NODE, &show_ip_route_addr_cmd);    install_element (ENABLE_NODE, &show_ip_route_addr_cmd);
   install_element (ENABLE_NODE, &show_ip_route_prefix_cmd);    install_element (ENABLE_NODE, &show_ip_route_prefix_cmd);
Line 2161  zebra_vty_init (void) Line 3893  zebra_vty_init (void)
   install_element (ENABLE_NODE, &show_ip_route_protocol_cmd);    install_element (ENABLE_NODE, &show_ip_route_protocol_cmd);
   install_element (ENABLE_NODE, &show_ip_route_supernets_cmd);    install_element (ENABLE_NODE, &show_ip_route_supernets_cmd);
   install_element (ENABLE_NODE, &show_ip_route_summary_cmd);    install_element (ENABLE_NODE, &show_ip_route_summary_cmd);
     install_element (ENABLE_NODE, &show_ip_route_summary_prefix_cmd);
   
  install_element (VIEW_NODE, &show_ip_mroute_cmd);  install_element (VIEW_NODE, &show_ip_rpf_cmd);
  install_element (ENABLE_NODE, &show_ip_mroute_cmd);  install_element (ENABLE_NODE, &show_ip_rpf_cmd);
   install_element (VIEW_NODE, &show_ip_rpf_addr_cmd);
   install_element (ENABLE_NODE, &show_ip_rpf_addr_cmd);
   
     /* Commands for VRF */
   
     install_element (CONFIG_NODE, &ip_mroute_vrf_cmd);
     install_element (CONFIG_NODE, &ip_mroute_dist_vrf_cmd);
     install_element (CONFIG_NODE, &no_ip_mroute_vrf_cmd);
     install_element (CONFIG_NODE, &no_ip_mroute_dist_vrf_cmd);
   
     install_element (CONFIG_NODE, &ip_route_vrf_cmd);
     install_element (CONFIG_NODE, &ip_route_flags_vrf_cmd);
     install_element (CONFIG_NODE, &ip_route_flags2_vrf_cmd);
     install_element (CONFIG_NODE, &ip_route_mask_vrf_cmd);
     install_element (CONFIG_NODE, &ip_route_mask_flags_vrf_cmd);
     install_element (CONFIG_NODE, &ip_route_mask_flags2_vrf_cmd);
     install_element (CONFIG_NODE, &no_ip_route_vrf_cmd);
     install_element (CONFIG_NODE, &no_ip_route_flags_vrf_cmd);
     install_element (CONFIG_NODE, &no_ip_route_flags2_vrf_cmd);
     install_element (CONFIG_NODE, &no_ip_route_mask_vrf_cmd);
     install_element (CONFIG_NODE, &no_ip_route_mask_flags_vrf_cmd);
     install_element (CONFIG_NODE, &no_ip_route_mask_flags2_vrf_cmd);
     install_element (CONFIG_NODE, &ip_route_distance_vrf_cmd);
     install_element (CONFIG_NODE, &ip_route_flags_distance_vrf_cmd);
     install_element (CONFIG_NODE, &ip_route_flags_distance2_vrf_cmd);
     install_element (CONFIG_NODE, &ip_route_mask_distance_vrf_cmd);
     install_element (CONFIG_NODE, &ip_route_mask_flags_distance_vrf_cmd);
     install_element (CONFIG_NODE, &ip_route_mask_flags_distance2_vrf_cmd);
     install_element (CONFIG_NODE, &no_ip_route_distance_vrf_cmd);
     install_element (CONFIG_NODE, &no_ip_route_flags_distance_vrf_cmd);
     install_element (CONFIG_NODE, &no_ip_route_flags_distance2_vrf_cmd);
     install_element (CONFIG_NODE, &no_ip_route_mask_flags_distance_vrf_cmd);
     install_element (CONFIG_NODE, &no_ip_route_mask_flags_distance2_vrf_cmd);
   
     install_element (VIEW_NODE, &show_ip_route_vrf_cmd);
     install_element (VIEW_NODE, &show_ip_route_addr_vrf_cmd);
     install_element (VIEW_NODE, &show_ip_route_prefix_vrf_cmd);
     install_element (VIEW_NODE, &show_ip_route_prefix_longer_vrf_cmd);
     install_element (VIEW_NODE, &show_ip_route_protocol_vrf_cmd);
     install_element (VIEW_NODE, &show_ip_route_supernets_vrf_cmd);
     install_element (VIEW_NODE, &show_ip_route_summary_vrf_cmd);
     install_element (VIEW_NODE, &show_ip_route_summary_prefix_vrf_cmd);
     install_element (ENABLE_NODE, &show_ip_route_vrf_cmd);
     install_element (ENABLE_NODE, &show_ip_route_addr_vrf_cmd);
     install_element (ENABLE_NODE, &show_ip_route_prefix_vrf_cmd);
     install_element (ENABLE_NODE, &show_ip_route_prefix_longer_vrf_cmd);
     install_element (ENABLE_NODE, &show_ip_route_protocol_vrf_cmd);
     install_element (ENABLE_NODE, &show_ip_route_supernets_vrf_cmd);
     install_element (ENABLE_NODE, &show_ip_route_summary_vrf_cmd);
     install_element (ENABLE_NODE, &show_ip_route_summary_prefix_vrf_cmd);
   
     install_element (VIEW_NODE, &show_ip_route_vrf_all_cmd);
     install_element (VIEW_NODE, &show_ip_route_addr_vrf_all_cmd);
     install_element (VIEW_NODE, &show_ip_route_prefix_vrf_all_cmd);
     install_element (VIEW_NODE, &show_ip_route_prefix_longer_vrf_all_cmd);
     install_element (VIEW_NODE, &show_ip_route_protocol_vrf_all_cmd);
     install_element (VIEW_NODE, &show_ip_route_supernets_vrf_all_cmd);
     install_element (VIEW_NODE, &show_ip_route_summary_vrf_all_cmd);
     install_element (VIEW_NODE, &show_ip_route_summary_prefix_vrf_all_cmd);
     install_element (ENABLE_NODE, &show_ip_route_vrf_all_cmd);
     install_element (ENABLE_NODE, &show_ip_route_addr_vrf_all_cmd);
     install_element (ENABLE_NODE, &show_ip_route_prefix_vrf_all_cmd);
     install_element (ENABLE_NODE, &show_ip_route_prefix_longer_vrf_all_cmd);
     install_element (ENABLE_NODE, &show_ip_route_protocol_vrf_all_cmd);
     install_element (ENABLE_NODE, &show_ip_route_supernets_vrf_all_cmd);
     install_element (ENABLE_NODE, &show_ip_route_summary_vrf_all_cmd);
     install_element (ENABLE_NODE, &show_ip_route_summary_prefix_vrf_all_cmd);
   
     install_element (VIEW_NODE, &show_ip_rpf_vrf_cmd);
     install_element (VIEW_NODE, &show_ip_rpf_vrf_all_cmd);
     install_element (VIEW_NODE, &show_ip_rpf_addr_vrf_cmd);
     install_element (VIEW_NODE, &show_ip_rpf_addr_vrf_all_cmd);
     install_element (ENABLE_NODE, &show_ip_rpf_vrf_cmd);
     install_element (ENABLE_NODE, &show_ip_rpf_vrf_all_cmd);
     install_element (ENABLE_NODE, &show_ip_rpf_addr_vrf_cmd);
     install_element (ENABLE_NODE, &show_ip_rpf_addr_vrf_all_cmd);
   
 #ifdef HAVE_IPV6  #ifdef HAVE_IPV6
   install_element (CONFIG_NODE, &ipv6_route_cmd);    install_element (CONFIG_NODE, &ipv6_route_cmd);
   install_element (CONFIG_NODE, &ipv6_route_flags_cmd);    install_element (CONFIG_NODE, &ipv6_route_flags_cmd);
Line 2185  zebra_vty_init (void) Line 3993  zebra_vty_init (void)
   install_element (CONFIG_NODE, &no_ipv6_route_ifname_flags_pref_cmd);    install_element (CONFIG_NODE, &no_ipv6_route_ifname_flags_pref_cmd);
   install_element (VIEW_NODE, &show_ipv6_route_cmd);    install_element (VIEW_NODE, &show_ipv6_route_cmd);
   install_element (VIEW_NODE, &show_ipv6_route_summary_cmd);    install_element (VIEW_NODE, &show_ipv6_route_summary_cmd);
     install_element (VIEW_NODE, &show_ipv6_route_summary_prefix_cmd);
   install_element (VIEW_NODE, &show_ipv6_route_protocol_cmd);    install_element (VIEW_NODE, &show_ipv6_route_protocol_cmd);
   install_element (VIEW_NODE, &show_ipv6_route_addr_cmd);    install_element (VIEW_NODE, &show_ipv6_route_addr_cmd);
   install_element (VIEW_NODE, &show_ipv6_route_prefix_cmd);    install_element (VIEW_NODE, &show_ipv6_route_prefix_cmd);
Line 2195  zebra_vty_init (void) Line 4004  zebra_vty_init (void)
   install_element (ENABLE_NODE, &show_ipv6_route_prefix_cmd);    install_element (ENABLE_NODE, &show_ipv6_route_prefix_cmd);
   install_element (ENABLE_NODE, &show_ipv6_route_prefix_longer_cmd);    install_element (ENABLE_NODE, &show_ipv6_route_prefix_longer_cmd);
   install_element (ENABLE_NODE, &show_ipv6_route_summary_cmd);    install_element (ENABLE_NODE, &show_ipv6_route_summary_cmd);
     install_element (ENABLE_NODE, &show_ipv6_route_summary_prefix_cmd);
   
   install_element (VIEW_NODE, &show_ipv6_mroute_cmd);    install_element (VIEW_NODE, &show_ipv6_mroute_cmd);
   install_element (ENABLE_NODE, &show_ipv6_mroute_cmd);    install_element (ENABLE_NODE, &show_ipv6_mroute_cmd);
   
     /* Commands for VRF */
   
     install_element (CONFIG_NODE, &ipv6_route_vrf_cmd);
     install_element (CONFIG_NODE, &ipv6_route_flags_vrf_cmd);
     install_element (CONFIG_NODE, &ipv6_route_ifname_vrf_cmd);
     install_element (CONFIG_NODE, &ipv6_route_ifname_flags_vrf_cmd);
     install_element (CONFIG_NODE, &no_ipv6_route_vrf_cmd);
     install_element (CONFIG_NODE, &no_ipv6_route_flags_vrf_cmd);
     install_element (CONFIG_NODE, &no_ipv6_route_ifname_vrf_cmd);
     install_element (CONFIG_NODE, &no_ipv6_route_ifname_flags_vrf_cmd);
     install_element (CONFIG_NODE, &ipv6_route_pref_vrf_cmd);
     install_element (CONFIG_NODE, &ipv6_route_flags_pref_vrf_cmd);
     install_element (CONFIG_NODE, &ipv6_route_ifname_pref_vrf_cmd);
     install_element (CONFIG_NODE, &ipv6_route_ifname_flags_pref_vrf_cmd);
     install_element (CONFIG_NODE, &no_ipv6_route_pref_vrf_cmd);
     install_element (CONFIG_NODE, &no_ipv6_route_flags_pref_vrf_cmd);
     install_element (CONFIG_NODE, &no_ipv6_route_ifname_pref_vrf_cmd);
     install_element (CONFIG_NODE, &no_ipv6_route_ifname_flags_pref_vrf_cmd);
   
     install_element (VIEW_NODE, &show_ipv6_route_vrf_cmd);
     install_element (VIEW_NODE, &show_ipv6_route_summary_vrf_cmd);
     install_element (VIEW_NODE, &show_ipv6_route_summary_prefix_vrf_cmd);
     install_element (VIEW_NODE, &show_ipv6_route_protocol_vrf_cmd);
     install_element (VIEW_NODE, &show_ipv6_route_addr_vrf_cmd);
     install_element (VIEW_NODE, &show_ipv6_route_prefix_vrf_cmd);
     install_element (VIEW_NODE, &show_ipv6_route_prefix_longer_vrf_cmd);
     install_element (ENABLE_NODE, &show_ipv6_route_vrf_cmd);
     install_element (ENABLE_NODE, &show_ipv6_route_protocol_vrf_cmd);
     install_element (ENABLE_NODE, &show_ipv6_route_addr_vrf_cmd);
     install_element (ENABLE_NODE, &show_ipv6_route_prefix_vrf_cmd);
     install_element (ENABLE_NODE, &show_ipv6_route_prefix_longer_vrf_cmd);
     install_element (ENABLE_NODE, &show_ipv6_route_summary_vrf_cmd);
     install_element (ENABLE_NODE, &show_ipv6_route_summary_prefix_vrf_cmd);
   
     install_element (VIEW_NODE, &show_ipv6_route_vrf_all_cmd);
     install_element (VIEW_NODE, &show_ipv6_route_summary_vrf_all_cmd);
     install_element (VIEW_NODE, &show_ipv6_route_summary_prefix_vrf_all_cmd);
     install_element (VIEW_NODE, &show_ipv6_route_protocol_vrf_all_cmd);
     install_element (VIEW_NODE, &show_ipv6_route_addr_vrf_all_cmd);
     install_element (VIEW_NODE, &show_ipv6_route_prefix_vrf_all_cmd);
     install_element (VIEW_NODE, &show_ipv6_route_prefix_longer_vrf_all_cmd);
     install_element (ENABLE_NODE, &show_ipv6_route_vrf_all_cmd);
     install_element (ENABLE_NODE, &show_ipv6_route_protocol_vrf_all_cmd);
     install_element (ENABLE_NODE, &show_ipv6_route_addr_vrf_all_cmd);
     install_element (ENABLE_NODE, &show_ipv6_route_prefix_vrf_all_cmd);
     install_element (ENABLE_NODE, &show_ipv6_route_prefix_longer_vrf_all_cmd);
     install_element (ENABLE_NODE, &show_ipv6_route_summary_vrf_all_cmd);
     install_element (ENABLE_NODE, &show_ipv6_route_summary_prefix_vrf_all_cmd);
   
     install_element (VIEW_NODE, &show_ipv6_mroute_vrf_cmd);
     install_element (ENABLE_NODE, &show_ipv6_mroute_vrf_cmd);
   
     install_element (VIEW_NODE, &show_ipv6_mroute_vrf_all_cmd);
     install_element (ENABLE_NODE, &show_ipv6_mroute_vrf_all_cmd);
 #endif /* HAVE_IPV6 */  #endif /* HAVE_IPV6 */
 }  }

Removed from v.1.1.1.3  
changed lines
  Added in v.1.1.1.4


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>