summaryrefslogtreecommitdiffstats
path: root/src/plugins/gbp/gbp_scanner.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/gbp/gbp_scanner.c')
-rw-r--r--src/plugins/gbp/gbp_scanner.c43
1 files changed, 39 insertions, 4 deletions
diff --git a/src/plugins/gbp/gbp_scanner.c b/src/plugins/gbp/gbp_scanner.c
index a2d0c9a98cb..90507a60568 100644
--- a/src/plugins/gbp/gbp_scanner.c
+++ b/src/plugins/gbp/gbp_scanner.c
@@ -19,8 +19,16 @@
#include <plugins/gbp/gbp_endpoint.h>
#include <plugins/gbp/gbp_vxlan.h>
+/**
+ * Scanner logger
+ */
vlib_log_class_t gs_logger;
+/**
+ * Scanner state
+ */
+static bool gs_enabled;
+
#define GBP_SCANNER_DBG(...) \
vlib_log_debug (gs_logger, __VA_ARGS__);
@@ -28,13 +36,13 @@ static uword
gbp_scanner (vlib_main_t * vm, vlib_node_runtime_t * rt, vlib_frame_t * f)
{
uword event_type, *event_data = 0;
- bool enabled = 0, do_scan = 0;
+ bool do_scan = 0;
while (1)
{
do_scan = 0;
- if (enabled)
+ if (gs_enabled)
{
/* scan every 'inactive threshold' seconds */
vlib_process_wait_for_event_or_clock (vm,
@@ -55,11 +63,14 @@ gbp_scanner (vlib_main_t * vm, vlib_node_runtime_t * rt, vlib_frame_t * f)
break;
case GBP_ENDPOINT_SCAN_START:
- enabled = 1;
+ gs_enabled = 1;
break;
case GBP_ENDPOINT_SCAN_STOP:
- enabled = 0;
+ gs_enabled = 0;
+ break;
+
+ case GBP_ENDPOINT_SCAN_SET_TIME:
break;
default:
@@ -84,6 +95,30 @@ VLIB_REGISTER_NODE (gbp_scanner_node) = {
};
/* *INDENT-ON* */
+static clib_error_t *
+gbp_scanner_cli (vlib_main_t * vm,
+ unformat_input_t * input, vlib_cli_command_t * cmd)
+{
+ vlib_cli_output (vm, "GBP-scanner: enabled:%d interval:%f",
+ gs_enabled, gbp_endpoint_scan_threshold ());
+
+ return (NULL);
+}
+
+/*?
+ * Show GBP scanner
+ *
+ * @cliexpar
+ * @cliexstart{show gbp scanner}
+ * @cliexend
+ ?*/
+/* *INDENT-OFF* */
+VLIB_CLI_COMMAND (gbp_scanner_cli_node, static) = {
+ .path = "show gbp scanner",
+ .short_help = "show gbp scanner",
+ .function = gbp_scanner_cli,
+};
+/* *INDENT-ON* */
static clib_error_t *
gbp_scanner_init (vlib_main_t * vm)