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

version 1.1.1.1, 2012/02/21 17:26:11 version 1.1.1.3, 2013/07/21 23:54:41
Line 535  vty_show_ip_route_detail (struct vty *vty, struct rout Line 535  vty_show_ip_route_detail (struct vty *vty, struct rout
   struct rib *rib;    struct rib *rib;
   struct nexthop *nexthop;    struct nexthop *nexthop;
   
  for (rib = rn->info; rib; rib = rib->next)  RNODE_FOREACH_RIB (rn, rib)
     {      {
       vty_out (vty, "Routing entry for %s/%d%s",         vty_out (vty, "Routing entry for %s/%d%s", 
                inet_ntoa (rn->p.u.prefix4), rn->p.prefixlen,                 inet_ntoa (rn->p.u.prefix4), rn->p.prefixlen,
                VTY_NEWLINE);                 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 %d, metric %d", rib->distance, rib->metric);      vty_out (vty, ", distance %u, metric %u", rib->distance, rib->metric);
       if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_SELECTED))        if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_SELECTED))
         vty_out (vty, ", best");          vty_out (vty, ", best");
       if (rib->refcnt)        if (rib->refcnt)
Line 556  vty_show_ip_route_detail (struct vty *vty, struct rout Line 556  vty_show_ip_route_detail (struct vty *vty, struct rout
 #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_OSPF
             || rib->type == ZEBRA_ROUTE_BABEL
           || rib->type == ZEBRA_ROUTE_ISIS            || rib->type == ZEBRA_ROUTE_ISIS
           || rib->type == ZEBRA_ROUTE_BGP)            || rib->type == ZEBRA_ROUTE_BGP)
         {          {
Line 774  vty_show_ip_route (struct vty *vty, struct route_node  Line 775  vty_show_ip_route (struct vty *vty, struct route_node 
   
       if (rib->type == ZEBRA_ROUTE_RIP        if (rib->type == ZEBRA_ROUTE_RIP
           || rib->type == ZEBRA_ROUTE_OSPF            || rib->type == ZEBRA_ROUTE_OSPF
             || rib->type == ZEBRA_ROUTE_BABEL
           || rib->type == ZEBRA_ROUTE_ISIS            || rib->type == ZEBRA_ROUTE_ISIS
           || rib->type == ZEBRA_ROUTE_BGP)            || rib->type == ZEBRA_ROUTE_BGP)
         {          {
Line 802  vty_show_ip_route (struct vty *vty, struct route_node  Line 804  vty_show_ip_route (struct vty *vty, struct route_node 
     }      }
 }  }
   
 #define SHOW_ROUTE_V4_HEADER "Codes: K - kernel route, C - connected, " \  
   "S - static, R - RIP, O - OSPF,%s       I - ISIS, B - BGP, " \  
   "> - selected route, * - FIB route%s%s"  
   
 DEFUN (show_ip_route,  DEFUN (show_ip_route,
        show_ip_route_cmd,         show_ip_route_cmd,
        "show ip route",         "show ip route",
Line 824  DEFUN (show_ip_route, Line 822  DEFUN (show_ip_route,
   
   /* Show all IPv4 routes. */    /* Show all IPv4 routes. */
   for (rn = route_top (table); rn; rn = route_next (rn))    for (rn = route_top (table); rn; rn = route_next (rn))
    for (rib = rn->info; rib; rib = rib->next)    RNODE_FOREACH_RIB (rn, rib)
       {        {
         if (first)          if (first)
           {            {
            vty_out (vty, SHOW_ROUTE_V4_HEADER, VTY_NEWLINE, VTY_NEWLINE,            vty_out (vty, SHOW_ROUTE_V4_HEADER);
                     VTY_NEWLINE); 
             first = 0;              first = 0;
           }            }
         vty_show_ip_route (vty, rn, rib);          vty_show_ip_route (vty, rn, rib);
Line 866  DEFUN (show_ip_route_prefix_longer, Line 863  DEFUN (show_ip_route_prefix_longer,
   
   /* Show matched type IPv4 routes. */    /* Show matched type IPv4 routes. */
   for (rn = route_top (table); rn; rn = route_next (rn))    for (rn = route_top (table); rn; rn = route_next (rn))
    for (rib = rn->info; rib; rib = rib->next)    RNODE_FOREACH_RIB (rn, rib)
       if (prefix_match (&p, &rn->p))        if (prefix_match (&p, &rn->p))
         {          {
           if (first)            if (first)
             {              {
              vty_out (vty, SHOW_ROUTE_V4_HEADER, VTY_NEWLINE,              vty_out (vty, SHOW_ROUTE_V4_HEADER);
                       VTY_NEWLINE, VTY_NEWLINE); 
               first = 0;                first = 0;
             }              }
           vty_show_ip_route (vty, rn, rib);            vty_show_ip_route (vty, rn, rib);
Line 900  DEFUN (show_ip_route_supernets, Line 896  DEFUN (show_ip_route_supernets,
   
   /* Show matched type IPv4 routes. */    /* Show matched type IPv4 routes. */
   for (rn = route_top (table); rn; rn = route_next (rn))    for (rn = route_top (table); rn; rn = route_next (rn))
    for (rib = rn->info; rib; rib = rib->next)    RNODE_FOREACH_RIB (rn, rib)
       {        {
         addr = ntohl (rn->p.u.prefix4.s_addr);          addr = ntohl (rn->p.u.prefix4.s_addr);
   
Line 910  DEFUN (show_ip_route_supernets, Line 906  DEFUN (show_ip_route_supernets,
           {            {
             if (first)              if (first)
               {                {
                vty_out (vty, SHOW_ROUTE_V4_HEADER, VTY_NEWLINE,                vty_out (vty, SHOW_ROUTE_V4_HEADER);
                         VTY_NEWLINE, VTY_NEWLINE); 
                 first = 0;                  first = 0;
               }                }
             vty_show_ip_route (vty, rn, rib);              vty_show_ip_route (vty, rn, rib);
Line 922  DEFUN (show_ip_route_supernets, Line 917  DEFUN (show_ip_route_supernets,
   
 DEFUN (show_ip_route_protocol,  DEFUN (show_ip_route_protocol,
        show_ip_route_protocol_cmd,         show_ip_route_protocol_cmd,
       "show ip route (bgp|connected|isis|kernel|ospf|rip|static)",       "show ip route " QUAGGA_IP_REDIST_STR_ZEBRA,
        SHOW_STR         SHOW_STR
        IP_STR         IP_STR
        "IP routing table\n"         "IP routing table\n"
       "Border Gateway Protocol (BGP)\n"       QUAGGA_IP_REDIST_HELP_STR_ZEBRA)
       "Connected\n" 
       "ISO IS-IS (ISIS)\n" 
       "Kernel\n" 
       "Open Shortest Path First (OSPF)\n" 
       "Routing Information Protocol (RIP)\n" 
       "Static routes\n") 
 {  {
   int type;    int type;
   struct route_table *table;    struct route_table *table;
Line 940  DEFUN (show_ip_route_protocol, Line 929  DEFUN (show_ip_route_protocol,
   struct rib *rib;    struct rib *rib;
   int first = 1;    int first = 1;
   
  if (strncmp (argv[0], "b", 1) == 0)  type = proto_redistnum (AFI_IP, argv[0]);
    type = ZEBRA_ROUTE_BGP;  if (type < 0)
  else if (strncmp (argv[0], "c", 1) == 0) 
    type = ZEBRA_ROUTE_CONNECT; 
  else if (strncmp (argv[0], "k", 1) ==0) 
    type = ZEBRA_ROUTE_KERNEL; 
  else if (strncmp (argv[0], "o", 1) == 0) 
    type = ZEBRA_ROUTE_OSPF; 
  else if (strncmp (argv[0], "i", 1) == 0) 
    type = ZEBRA_ROUTE_ISIS; 
  else if (strncmp (argv[0], "r", 1) == 0) 
    type = ZEBRA_ROUTE_RIP; 
  else if (strncmp (argv[0], "s", 1) == 0) 
    type = ZEBRA_ROUTE_STATIC; 
  else  
     {      {
       vty_out (vty, "Unknown route type%s", VTY_NEWLINE);        vty_out (vty, "Unknown route type%s", VTY_NEWLINE);
       return CMD_WARNING;        return CMD_WARNING;
Line 966  DEFUN (show_ip_route_protocol, Line 942  DEFUN (show_ip_route_protocol,
   
   /* Show matched type IPv4 routes. */    /* Show matched type IPv4 routes. */
   for (rn = route_top (table); rn; rn = route_next (rn))    for (rn = route_top (table); rn; rn = route_next (rn))
    for (rib = rn->info; rib; rib = rib->next)    RNODE_FOREACH_RIB (rn, rib)
       if (rib->type == type)        if (rib->type == type)
         {          {
           if (first)            if (first)
             {              {
              vty_out (vty, SHOW_ROUTE_V4_HEADER,              vty_out (vty, SHOW_ROUTE_V4_HEADER);
                       VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE); 
               first = 0;                first = 0;
             }              }
           vty_show_ip_route (vty, rn, rib);            vty_show_ip_route (vty, rn, rib);
Line 1071  vty_show_ip_route_summary (struct vty *vty, struct rou Line 1046  vty_show_ip_route_summary (struct vty *vty, struct rou
   memset (&rib_cnt, 0, sizeof(rib_cnt));    memset (&rib_cnt, 0, sizeof(rib_cnt));
   memset (&fib_cnt, 0, sizeof(fib_cnt));    memset (&fib_cnt, 0, sizeof(fib_cnt));
   for (rn = route_top (table); rn; rn = route_next (rn))    for (rn = route_top (table); rn; rn = route_next (rn))
    for (rib = rn->info; rib; rib = rib->next)    RNODE_FOREACH_RIB (rn, rib)
       for (nexthop = rib->nexthop; nexthop; nexthop = nexthop->next)        for (nexthop = rib->nexthop; nexthop; nexthop = nexthop->next)
         {          {
           rib_cnt[ZEBRA_ROUTE_TOTAL]++;            rib_cnt[ZEBRA_ROUTE_TOTAL]++;
Line 1222  DEFUN (show_ip_protocol, Line 1197  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. */
Line 1537  vty_show_ipv6_route_detail (struct vty *vty, struct ro Line 1546  vty_show_ipv6_route_detail (struct vty *vty, struct ro
   struct nexthop *nexthop;    struct nexthop *nexthop;
   char buf[BUFSIZ];    char buf[BUFSIZ];
   
  for (rib = rn->info; rib; rib = rib->next)  RNODE_FOREACH_RIB (rn, rib)
     {      {
       vty_out (vty, "Routing entry for %s/%d%s",         vty_out (vty, "Routing entry for %s/%d%s", 
                inet_ntop (AF_INET6, &rn->p.u.prefix6, buf, BUFSIZ),                 inet_ntop (AF_INET6, &rn->p.u.prefix6, buf, BUFSIZ),
                rn->p.prefixlen,                 rn->p.prefixlen,
                VTY_NEWLINE);                 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 %d, metric %d", rib->distance, rib->metric);      vty_out (vty, ", distance %u, metric %u", rib->distance, rib->metric);
       if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_SELECTED))        if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_SELECTED))
         vty_out (vty, ", best");          vty_out (vty, ", best");
       if (rib->refcnt)        if (rib->refcnt)
Line 1559  vty_show_ipv6_route_detail (struct vty *vty, struct ro Line 1568  vty_show_ipv6_route_detail (struct vty *vty, struct ro
 #define ONE_WEEK_SECOND 60*60*24*7  #define ONE_WEEK_SECOND 60*60*24*7
       if (rib->type == ZEBRA_ROUTE_RIPNG        if (rib->type == ZEBRA_ROUTE_RIPNG
           || rib->type == ZEBRA_ROUTE_OSPF6            || rib->type == ZEBRA_ROUTE_OSPF6
             || rib->type == ZEBRA_ROUTE_BABEL
           || rib->type == ZEBRA_ROUTE_ISIS            || rib->type == ZEBRA_ROUTE_ISIS
           || rib->type == ZEBRA_ROUTE_BGP)            || rib->type == ZEBRA_ROUTE_BGP)
         {          {
Line 1738  vty_show_ipv6_route (struct vty *vty, struct route_nod Line 1748  vty_show_ipv6_route (struct vty *vty, struct route_nod
               
       if (rib->type == ZEBRA_ROUTE_RIPNG        if (rib->type == ZEBRA_ROUTE_RIPNG
           || rib->type == ZEBRA_ROUTE_OSPF6            || rib->type == ZEBRA_ROUTE_OSPF6
             || rib->type == ZEBRA_ROUTE_BABEL
           || rib->type == ZEBRA_ROUTE_ISIS            || rib->type == ZEBRA_ROUTE_ISIS
           || rib->type == ZEBRA_ROUTE_BGP)            || rib->type == ZEBRA_ROUTE_BGP)
         {          {
Line 1766  vty_show_ipv6_route (struct vty *vty, struct route_nod Line 1777  vty_show_ipv6_route (struct vty *vty, struct route_nod
     }      }
 }  }
   
 #define SHOW_ROUTE_V6_HEADER "Codes: K - kernel route, C - connected, S - static, R - RIPng, O - OSPFv3,%s       I - ISIS, B - BGP, * - FIB route.%s%s"  
   
 DEFUN (show_ipv6_route,  DEFUN (show_ipv6_route,
        show_ipv6_route_cmd,         show_ipv6_route_cmd,
        "show ipv6 route",         "show ipv6 route",
Line 1786  DEFUN (show_ipv6_route, Line 1795  DEFUN (show_ipv6_route,
   
   /* Show all IPv6 route. */    /* Show all IPv6 route. */
   for (rn = route_top (table); rn; rn = route_next (rn))    for (rn = route_top (table); rn; rn = route_next (rn))
    for (rib = rn->info; rib; rib = rib->next)    RNODE_FOREACH_RIB (rn, rib)
       {        {
         if (first)          if (first)
           {            {
            vty_out (vty, SHOW_ROUTE_V6_HEADER, VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE);            vty_out (vty, SHOW_ROUTE_V6_HEADER);
             first = 0;              first = 0;
           }            }
         vty_show_ipv6_route (vty, rn, rib);          vty_show_ipv6_route (vty, rn, rib);
Line 1827  DEFUN (show_ipv6_route_prefix_longer, Line 1836  DEFUN (show_ipv6_route_prefix_longer,
   
   /* 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))
    for (rib = rn->info; rib; rib = rib->next)    RNODE_FOREACH_RIB (rn, rib)
       if (prefix_match (&p, &rn->p))        if (prefix_match (&p, &rn->p))
         {          {
           if (first)            if (first)
             {              {
              vty_out (vty, SHOW_ROUTE_V6_HEADER, VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE);              vty_out (vty, SHOW_ROUTE_V6_HEADER);
               first = 0;                first = 0;
             }              }
           vty_show_ipv6_route (vty, rn, rib);            vty_show_ipv6_route (vty, rn, rib);
Line 1842  DEFUN (show_ipv6_route_prefix_longer, Line 1851  DEFUN (show_ipv6_route_prefix_longer,
   
 DEFUN (show_ipv6_route_protocol,  DEFUN (show_ipv6_route_protocol,
        show_ipv6_route_protocol_cmd,         show_ipv6_route_protocol_cmd,
       "show ipv6 route (bgp|connected|isis|kernel|ospf6|ripng|static)",       "show ipv6 route " QUAGGA_IP6_REDIST_STR_ZEBRA,
        SHOW_STR         SHOW_STR
        IP_STR         IP_STR
        "IP routing table\n"         "IP routing table\n"
       "Border Gateway Protocol (BGP)\n"        QUAGGA_IP6_REDIST_HELP_STR_ZEBRA)
       "Connected\n" 
       "ISO IS-IS (ISIS)\n" 
       "Kernel\n" 
       "Open Shortest Path First (OSPFv3)\n" 
       "Routing Information Protocol (RIPng)\n" 
       "Static routes\n") 
 {  {
   int type;    int type;
   struct route_table *table;    struct route_table *table;
Line 1860  DEFUN (show_ipv6_route_protocol, Line 1863  DEFUN (show_ipv6_route_protocol,
   struct rib *rib;    struct rib *rib;
   int first = 1;    int first = 1;
   
  if (strncmp (argv[0], "b", 1) == 0)  type = proto_redistnum (AFI_IP6, argv[0]);
    type = ZEBRA_ROUTE_BGP;  if (type < 0)
  else if (strncmp (argv[0], "c", 1) == 0) 
    type = ZEBRA_ROUTE_CONNECT; 
  else if (strncmp (argv[0], "k", 1) ==0) 
    type = ZEBRA_ROUTE_KERNEL; 
  else if (strncmp (argv[0], "o", 1) == 0) 
    type = ZEBRA_ROUTE_OSPF6; 
  else if (strncmp (argv[0], "i", 1) == 0) 
    type = ZEBRA_ROUTE_ISIS; 
  else if (strncmp (argv[0], "r", 1) == 0) 
    type = ZEBRA_ROUTE_RIPNG; 
  else if (strncmp (argv[0], "s", 1) == 0) 
    type = ZEBRA_ROUTE_STATIC; 
  else  
     {      {
       vty_out (vty, "Unknown route type%s", VTY_NEWLINE);        vty_out (vty, "Unknown route type%s", VTY_NEWLINE);
       return CMD_WARNING;        return CMD_WARNING;
Line 1886  DEFUN (show_ipv6_route_protocol, Line 1876  DEFUN (show_ipv6_route_protocol,
   
   /* 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))
    for (rib = rn->info; rib; rib = rib->next)    RNODE_FOREACH_RIB (rn, rib)
       if (rib->type == type)        if (rib->type == type)
         {          {
           if (first)            if (first)
             {              {
              vty_out (vty, SHOW_ROUTE_V6_HEADER, VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE);              vty_out (vty, SHOW_ROUTE_V6_HEADER);
               first = 0;                first = 0;
             }              }
           vty_show_ipv6_route (vty, rn, rib);            vty_show_ipv6_route (vty, rn, rib);
Line 1995  DEFUN (show_ipv6_route_summary, Line 1985  DEFUN (show_ipv6_route_summary,
   return CMD_SUCCESS;    return CMD_SUCCESS;
 }  }
   
   /*
    * Show IPv6 mroute command.Used to dump
    * the Multicast routing table.
    */
   
   DEFUN (show_ipv6_mroute,
          show_ipv6_mroute_cmd,
          "show ipv6 mroute",
          SHOW_STR
          IP_STR
          "IPv6 Multicast routing table\n")
   {
     struct route_table *table;
     struct route_node *rn;
     struct rib *rib;
     int first = 1;
   
     table = vrf_table (AFI_IP6, SAFI_MULTICAST, 0);
     if (! table)
       return CMD_SUCCESS;
   
     /* 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_ipv6_route (vty, rn, rib);
         }
     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)
Line 2137  zebra_vty_init (void) Line 2162  zebra_vty_init (void)
   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 (VIEW_NODE, &show_ip_mroute_cmd);
     install_element (ENABLE_NODE, &show_ip_mroute_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 2166  zebra_vty_init (void) Line 2195  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 (VIEW_NODE, &show_ipv6_mroute_cmd);
     install_element (ENABLE_NODE, &show_ipv6_mroute_cmd);
 #endif /* HAVE_IPV6 */  #endif /* HAVE_IPV6 */
 }  }

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


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