summaryrefslogtreecommitdiffstats
path: root/zebra/debug.c
diff options
context:
space:
mode:
authorAvneesh Sachdev <avneesh@opensourcerouting.org>2012-11-13 23:48:59 +0100
committerDavid Lamparter <equinox@opensourcerouting.org>2012-11-30 21:41:17 +0100
commit5adc2528d386f037cc39e8029616295c3fec2db4 (patch)
tree2f54793f50a591d99a39d75fbf6bbd7dbe752dda /zebra/debug.c
parentfpm: Add public header for Forwarding Plane Manager (diff)
downloadfrr-5adc2528d386f037cc39e8029616295c3fec2db4.tar.xz
frr-5adc2528d386f037cc39e8029616295c3fec2db4.zip
zebra: add module to communicate routes to FPM
Enhance zebra to send routes to the (optional) Forwarding Path Manager component using the interface defined by fpm/fpm.h. * configure.ac - Add --enable-fpm flag. The FPM-related code in zebra is activated only if the build is configured with '--enable-fpm'. - Add HAVE_NETLINK automake conditional. This allows us to conditionally build netlink-dependent C code. * zebra/{rib.h,zebra_rib.c} - Add the 'fpm_q_entries' field to the rib_dest_t structure. This allows dests to be placed on the fpm queue. - Define a couple new rib_dest_t flags that hold FPM-related state. - Invoke the zfpm_trigger_update() function for a route_node whenever the information to be sent to the FPM changes. - rib_can_delete_dest(): Return FALSE if we have to update the FPM about the given dest. This ensures that the dest is not deleted even if there are no ribs hanging off of it. * zebra/zebra_fpm.c This file holds most of the code for interacting with the FPM. - If quagga was configured with '--enable-fpm', periodically try to connect to the FPM. - When the connection comes up, enqueue all relevent dests to the FPM queue. - When the FPM socket is readable, dequeue the next rib_dest_t from the FPM queue, encode it in to a message and send the message to the FPM. - When the connection to the FPM goes down, remove all dests from the FPM queue, and then start trying to connect to the FPM again. - Expose the following new operational commands: show zebra fpm stats clear zebra fpm stats * zebra/zebra_fpm_netlink.c - zfpm_netlink_encode_route(): Function to encode information about a rib_dest_t in netlink format. * zebra/zebra_fpm_private.h Private header file for the zebra FPM module. * zebra/zebra_fpm.h Header file exported by zebra FPM module to the rest of zebra. * zebra/debug.c Add the 'debug zebra fpm' command. * zebra/main.c Initialize the zebra-FPM code on startup. * zebra/misc_null.c Add stub for zfpm_trigger_update(). * zebra/Makefile.am - Include new file zebra_fpm.c in build. - Include zebra_fpm_netlink.c in build if HAVE_NETLINK is defined. * vtysh/Makefile.am Include zebra_fpm.c in list of files that define cli commands. Signed-off-by: Avneesh Sachdev <avneesh@opensourcerouting.org> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'zebra/debug.c')
-rw-r--r--zebra/debug.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/zebra/debug.c b/zebra/debug.c
index 175029b8a..7bfdb77d9 100644
--- a/zebra/debug.c
+++ b/zebra/debug.c
@@ -29,6 +29,7 @@ unsigned long zebra_debug_event;
unsigned long zebra_debug_packet;
unsigned long zebra_debug_kernel;
unsigned long zebra_debug_rib;
+unsigned long zebra_debug_fpm;
DEFUN (show_debugging_zebra,
show_debugging_zebra_cmd,
@@ -71,6 +72,9 @@ DEFUN (show_debugging_zebra,
if (IS_ZEBRA_DEBUG_RIB_Q)
vty_out (vty, " Zebra RIB queue debugging is on%s", VTY_NEWLINE);
+ if (IS_ZEBRA_DEBUG_FPM)
+ vty_out (vty, " Zebra FPM debugging is on%s", VTY_NEWLINE);
+
return CMD_SUCCESS;
}
@@ -169,6 +173,17 @@ DEFUN (debug_zebra_rib_q,
return CMD_SUCCESS;
}
+DEFUN (debug_zebra_fpm,
+ debug_zebra_fpm_cmd,
+ "debug zebra fpm",
+ DEBUG_STR
+ "Zebra configuration\n"
+ "Debug zebra FPM events\n")
+{
+ SET_FLAG (zebra_debug_fpm, ZEBRA_DEBUG_FPM);
+ return CMD_SUCCESS;
+}
+
DEFUN (no_debug_zebra_events,
no_debug_zebra_events_cmd,
"no debug zebra events",
@@ -247,6 +262,18 @@ DEFUN (no_debug_zebra_rib_q,
return CMD_SUCCESS;
}
+DEFUN (no_debug_zebra_fpm,
+ no_debug_zebra_fpm_cmd,
+ "no debug zebra fpm",
+ NO_STR
+ DEBUG_STR
+ "Zebra configuration\n"
+ "Debug zebra FPM events\n")
+{
+ zebra_debug_fpm = 0;
+ return CMD_SUCCESS;
+}
+
/* Debug node. */
struct cmd_node debug_node =
{
@@ -302,6 +329,11 @@ config_write_debug (struct vty *vty)
vty_out (vty, "debug zebra rib queue%s", VTY_NEWLINE);
write++;
}
+ if (IS_ZEBRA_DEBUG_FPM)
+ {
+ vty_out (vty, "debug zebra fpm%s", VTY_NEWLINE);
+ write++;
+ }
return write;
}
@@ -312,6 +344,7 @@ zebra_debug_init (void)
zebra_debug_packet = 0;
zebra_debug_kernel = 0;
zebra_debug_rib = 0;
+ zebra_debug_fpm = 0;
install_node (&debug_node, config_write_debug);
@@ -325,11 +358,13 @@ zebra_debug_init (void)
install_element (ENABLE_NODE, &debug_zebra_kernel_cmd);
install_element (ENABLE_NODE, &debug_zebra_rib_cmd);
install_element (ENABLE_NODE, &debug_zebra_rib_q_cmd);
+ install_element (ENABLE_NODE, &debug_zebra_fpm_cmd);
install_element (ENABLE_NODE, &no_debug_zebra_events_cmd);
install_element (ENABLE_NODE, &no_debug_zebra_packet_cmd);
install_element (ENABLE_NODE, &no_debug_zebra_kernel_cmd);
install_element (ENABLE_NODE, &no_debug_zebra_rib_cmd);
install_element (ENABLE_NODE, &no_debug_zebra_rib_q_cmd);
+ install_element (ENABLE_NODE, &no_debug_zebra_fpm_cmd);
install_element (CONFIG_NODE, &debug_zebra_events_cmd);
install_element (CONFIG_NODE, &debug_zebra_packet_cmd);
@@ -338,9 +373,11 @@ zebra_debug_init (void)
install_element (CONFIG_NODE, &debug_zebra_kernel_cmd);
install_element (CONFIG_NODE, &debug_zebra_rib_cmd);
install_element (CONFIG_NODE, &debug_zebra_rib_q_cmd);
+ install_element (CONFIG_NODE, &debug_zebra_fpm_cmd);
install_element (CONFIG_NODE, &no_debug_zebra_events_cmd);
install_element (CONFIG_NODE, &no_debug_zebra_packet_cmd);
install_element (CONFIG_NODE, &no_debug_zebra_kernel_cmd);
install_element (CONFIG_NODE, &no_debug_zebra_rib_cmd);
install_element (CONFIG_NODE, &no_debug_zebra_rib_q_cmd);
+ install_element (CONFIG_NODE, &no_debug_zebra_fpm_cmd);
}