perfmon: check for duplicates after other checks 15/35115/3
authorRay Kinsella <mdr@ashroe.eu>
Fri, 28 Jan 2022 04:59:00 +0000 (04:59 +0000)
committerDamjan Marion <dmarion@me.com>
Sun, 30 Jan 2022 15:08:18 +0000 (15:08 +0000)
Move checking for duplicate bundle names after the other checks.

Type: fix

Signed-off-by: Ray Kinsella <mdr@ashroe.eu>
Change-Id: I7fed5be758814e166eb8756b3df090130ac13bfd

src/plugins/perfmon/perfmon.c

index 1569036..594a987 100644 (file)
@@ -398,9 +398,6 @@ perfmon_init (vlib_main_t *vm)
       clib_error_t *err;
       uword *p;
 
-      if (hash_get_mem (pm->bundle_by_name, b->name) != 0)
-       clib_panic ("duplicate bundle name '%s'", b->name);
-
       if ((p = hash_get_mem (pm->source_by_name, b->source)) == 0)
        {
          log_debug ("missing source '%s', skipping bundle '%s'", b->source,
@@ -426,6 +423,9 @@ perfmon_init (vlib_main_t *vm)
          continue;
        }
 
+      if (hash_get_mem (pm->bundle_by_name, b->name) != 0)
+       clib_panic ("duplicate bundle name '%s'", b->name);
+
       hash_set_mem (pm->bundle_by_name, b->name, b);
       log_debug ("bundle '%s' regisrtered", b->name);