summaryrefslogtreecommitdiffstats
path: root/src/plugins/igmp/igmp_config.c
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2018-11-13 13:27:18 +0000
committerOle Trøan <otroan@employees.org>2018-11-13 14:45:40 +0000
commite82eb635b1377c2b14d28127a121eabd10b3b83d (patch)
treec152b97a71b8e44a3a5b7918f69cfe492bdfb06d /src/plugins/igmp/igmp_config.c
parent5d9df1db07969fea8f391bd48ba14cceb840da1e (diff)
IGMP: improve CLI debug output
Change-Id: If88fc3acdba1f73b3e8be94d8014556c5239596c Signed-off-by: Neale Ranns <nranns@cisco.com>
Diffstat (limited to 'src/plugins/igmp/igmp_config.c')
-rw-r--r--src/plugins/igmp/igmp_config.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/src/plugins/igmp/igmp_config.c b/src/plugins/igmp/igmp_config.c
index 76e8ace14d9..f9acc299ff1 100644
--- a/src/plugins/igmp/igmp_config.c
+++ b/src/plugins/igmp/igmp_config.c
@@ -87,6 +87,54 @@ igmp_group_lookup (igmp_config_t * config, const igmp_key_t * key)
return group;
}
+u8 *
+format_igmp_config_timer_type (u8 * s, va_list * args)
+{
+ igmp_config_timer_type_t type = va_arg (*args, igmp_config_timer_type_t);
+
+ switch (type)
+ {
+#define _(v,t) case IGMP_CONFIG_TIMER_##v: return (format (s, "%s", t));
+ foreach_igmp_config_timer_type
+#undef _
+ }
+ return (s);
+}
+
+
+u8 *
+format_igmp_config (u8 * s, va_list * args)
+{
+ igmp_config_t *config;
+ igmp_group_t *group;
+ vnet_main_t *vnm;
+ u32 ii;
+
+ config = va_arg (*args, igmp_config_t *);
+ vnm = vnet_get_main ();
+
+ s = format (s, "interface: %U mode: %U %U",
+ format_vnet_sw_if_index_name, vnm, config->sw_if_index,
+ format_igmp_mode, config->mode,
+ format_igmp_proxy_device_id, config->proxy_device_id);
+
+ for (ii = 0; ii < IGMP_CONFIG_N_TIMERS; ii++)
+ {
+ s = format (s, "\n %U:%U",
+ format_igmp_config_timer_type, ii,
+ format_igmp_timer_id, config->timers[ii]);
+ }
+
+ /* *INDENT-OFF* */
+ FOR_EACH_GROUP (group, config,
+ ({
+ s = format (s, "\n%U", format_igmp_group, group, 4);
+ }));
+ /* *INDENT-ON* */
+
+ return (s);
+}
+
/*
* fd.io coding-style-patch-verification: ON
*