vat: unload unused vat plugins
[vpp.git] / src / plugins / stn / stn_test.c
index a4497cd..40ebd77 100644 (file)
@@ -67,7 +67,7 @@ stn_test_main_t stn_test_main;
  * we just generated
  */
 #define foreach_stn_api_reply_msg                       \
-_(STN_RULE_DETAILS, stn_rule_details)
+_(STN_RULES_DETAILS, stn_rules_details)
 
 static int
 api_stn_rules_dump (vat_main_t * vam)
@@ -102,7 +102,7 @@ api_stn_rules_dump (vat_main_t * vam)
 }
 
 static void
-vl_api_stn_rule_details_t_handler (vl_api_stn_rule_details_t * mp)
+vl_api_stn_rules_details_t_handler (vl_api_stn_rules_details_t * mp)
 {
   vat_main_t *vam = stn_test_main.vat_main;
   fformat (vam->ofp, "addr: %U sw_if_index: %u\n",
@@ -154,6 +154,10 @@ vat_plugin_register (vat_main_t * vam)
 
   name = format (0, "stn_%08x%c", api_version, 0);
   sm->msg_id_base = vl_client_get_first_plugin_msg_id ((char *) name);
+  vec_free (name);
+
+  if (sm->msg_id_base == (u16) ~ 0)
+    return clib_error_return (0, "stn plugin not loaded...");
 
   /* Get the control ping ID */
 #define _(id,n,crc) \
@@ -165,8 +169,6 @@ vat_plugin_register (vat_main_t * vam)
   if (sm->msg_id_base != (u16) ~ 0)
     stn_vat_api_hookup (vam);
 
-  vec_free (name);
-
   return 0;
 }