Merge pull request #581 from donaldsharp/zebra

Zebra
This commit is contained in:
David Lamparter 2017-05-22 17:44:33 +02:00 committed by GitHub
commit 1aba7c0944
8 changed files with 63 additions and 9 deletions

View File

@ -498,6 +498,11 @@ If so, the box can't work as a router.
Display whether the host's IP v6 forwarding is enabled or not.
@end deffn
@deffn Command {show zebra} {}
Display various statistics related to the installation and deletion
of routes, neighbor updates, and LSP's into the kernel.
@end deffn
@deffn Command {show zebra fpm stats} {}
Display statistics related to the zebra code that interacts with the
optional Forwarding Plane Manager (FPM) component.

View File

@ -151,6 +151,10 @@ Shows requestlist of neighbor.
This command shows internal routing table.
@end deffn
@deffn {Command} {show ipv6 ospf6 zebra} {}
Shows state about what is being redistributed between zebra and OSPF6
@end deffn
@node OSPF6 Configuration Examples
@section OSPF6 Configuration Examples

View File

@ -304,13 +304,12 @@ ospf6_zebra_read_ipv6 (int command, struct zclient *zclient,
return 0;
}
DEFUN (show_zebra,
show_zebra_cmd,
"show zebra",
show_ospf6_zebra_cmd,
"show ipv6 ospf6 zebra",
SHOW_STR
IPV6_STR
OSPF6_STR
"Zebra information\n")
{
int i;
@ -836,7 +835,7 @@ ospf6_zebra_init (struct thread_master *master)
install_node (&zebra_node, config_write_ospf6_zebra);
/* Install command element for zebra node. */
install_element (VIEW_NODE, &show_zebra_cmd);
install_element (VIEW_NODE, &show_ospf6_zebra_cmd);
install_default (ZEBRA_NODE);
install_element (ZEBRA_NODE, &redistribute_ospf6_cmd);
install_element (ZEBRA_NODE, &no_redistribute_ospf6_cmd);

View File

@ -774,6 +774,7 @@ if_nbr_ipv6ll_to_ipv4ll_neigh_update (struct interface *ifp,
struct in6_addr *address,
int add)
{
struct zebra_vrf *zvrf = vrf_info_lookup(ifp->vrf_id);
char buf[16] = "169.254.0.1";
struct in_addr ipv4_ll;
char mac[6];
@ -782,6 +783,7 @@ if_nbr_ipv6ll_to_ipv4ll_neigh_update (struct interface *ifp,
ipv6_ll_address_to_mac(address, (u_char *)mac);
kernel_neigh_update (add, ifp->ifindex, ipv4_ll.s_addr, mac, 6);
zvrf->neigh_updates++;
}
static void

View File

@ -927,6 +927,7 @@ lsp_process (struct work_queue *wq, void *data)
zebra_lsp_t *lsp;
zebra_nhlfe_t *oldbest, *newbest;
char buf[BUFSIZ], buf2[BUFSIZ];
struct zebra_vrf *zvrf = vrf_info_lookup (VRF_DEFAULT);
lsp = (zebra_lsp_t *)data;
if (!lsp) // unexpected
@ -955,15 +956,24 @@ lsp_process (struct work_queue *wq, void *data)
{
/* Not already installed */
if (newbest)
{
kernel_add_lsp (lsp);
zvrf->lsp_installs++;
}
}
else
{
/* Installed, may need an update and/or delete. */
if (!newbest)
{
kernel_del_lsp (lsp);
zvrf->lsp_removals++;
}
else if (CHECK_FLAG (lsp->flags, LSP_FLAG_CHANGED))
{
kernel_upd_lsp (lsp);
zvrf->lsp_installs++;
}
}
return WQ_SUCCESS;

View File

@ -1114,6 +1114,7 @@ rib_install_kernel (struct route_node *rn, struct rib *rib, struct rib *old)
rib_table_info_t *info = srcdest_rnode_table_info(rn);
int recursing;
struct prefix *p, *src_p;
struct zebra_vrf *zvrf = vrf_info_lookup (rib->vrf_id);
srcdest_rnode_prefixes (rn, &p, &src_p);
@ -1130,6 +1131,7 @@ rib_install_kernel (struct route_node *rn, struct rib *rib, struct rib *old)
*/
hook_call(rib_update, rn, "installing in kernel");
ret = kernel_route_rib (p, src_p, old, rib);
zvrf->installs++;
/* If install succeeds, update FIB flag for nexthops. */
if (!ret)
@ -1158,6 +1160,7 @@ rib_uninstall_kernel (struct route_node *rn, struct rib *rib)
rib_table_info_t *info = srcdest_rnode_table_info(rn);
int recursing;
struct prefix *p, *src_p;
struct zebra_vrf *zvrf = vrf_info_lookup (rib->vrf_id);
srcdest_rnode_prefixes (rn, &p, &src_p);
@ -1174,6 +1177,7 @@ rib_uninstall_kernel (struct route_node *rn, struct rib *rib)
*/
hook_call(rib_update, rn, "uninstalling from kernel");
ret = kernel_route_rib (p, src_p, rib, NULL);
zvrf->removals++;
for (ALL_NEXTHOPS_RO(rib->nexthop, nexthop, tnexthop, recursing))
UNSET_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB);

View File

@ -94,6 +94,13 @@ struct zebra_vrf
/* MPLS processing flags */
u_int16_t mpls_flags;
#define MPLS_FLAG_SCHEDULE_LSPS (1 << 0)
/* Route Installs */
uint64_t installs;
uint64_t removals;
uint64_t neigh_updates;
uint64_t lsp_installs;
uint64_t lsp_removals;
};
static inline vrf_id_t

View File

@ -2817,6 +2817,28 @@ DEFUN (no_ip_forwarding,
return CMD_SUCCESS;
}
DEFUN (show_zebra,
show_zebra_cmd,
"show zebra",
SHOW_STR
"Zebra information\n")
{
struct vrf *vrf;
vty_out (vty, " Route Route Neighbor LSP LSP%s", VTY_NEWLINE);
vty_out (vty, "VRF Installs Removals Updates Installs Removals%s", VTY_NEWLINE);
RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name)
{
struct zebra_vrf *zvrf = vrf->info;
vty_out (vty,"%-25s %10ld %10ld %10ld %10ld %10ld%s",
vrf->name, zvrf->installs, zvrf->removals,
zvrf->neigh_updates, zvrf->lsp_installs, zvrf->lsp_removals,
VTY_NEWLINE);
}
return CMD_SUCCESS;
}
/* This command is for debugging purpose. */
DEFUN (show_zebra_client,
show_zebra_client_cmd,
@ -3005,6 +3027,7 @@ zebra_init (void)
install_element (VIEW_NODE, &show_ip_forwarding_cmd);
install_element (CONFIG_NODE, &ip_forwarding_cmd);
install_element (CONFIG_NODE, &no_ip_forwarding_cmd);
install_element (ENABLE_NODE, &show_zebra_cmd);
install_element (ENABLE_NODE, &show_zebra_client_cmd);
install_element (ENABLE_NODE, &show_zebra_client_summary_cmd);