diff --git a/src/examples/sample-plugin/sample/sample_test.c b/src/examples/sample-plugin/sample/sample_test.c
index bf7a059..6dd3a3e 100644
--- a/src/examples/sample-plugin/sample/sample_test.c
+++ b/src/examples/sample-plugin/sample/sample_test.c
@@ -98,6 +98,7 @@
     int enable_disable = 1;
     u32 sw_if_index = ~0;
     vl_api_sample_macswap_enable_disable_t * mp;
+    int ret;
 
     /* Parse args required to build the message */
     while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT) {
@@ -125,7 +126,8 @@
     S(mp);
 
     /* Wait for a reply... */
-    W;
+    W (ret);
+    return ret;
 }
 
 /* 
diff --git a/src/plugins/acl/acl_test.c b/src/plugins/acl/acl_test.c
index 39d7e1c..23dc6bc 100644
--- a/src/plugins/acl/acl_test.c
+++ b/src/plugins/acl/acl_test.c
@@ -267,6 +267,7 @@
     acl_test_main_t * sm = &acl_test_main;
     vl_api_acl_plugin_get_version_t * mp;
     u32 msg_size = sizeof(*mp);
+    int ret;
 
     vam->result_ready = 0;
     mp = vl_msg_api_alloc_as_if_client(msg_size);
@@ -278,9 +279,8 @@
     S(mp);
 
     /* Wait for a reply... */
-    W;
-
-    return 0;
+    W (ret);
+    return ret;
 }
 
 static int api_macip_acl_interface_get (vat_main_t * vam)
@@ -288,6 +288,7 @@
     acl_test_main_t * sm = &acl_test_main;
     vl_api_acl_plugin_get_version_t * mp;
     u32 msg_size = sizeof(*mp);
+    int ret;
 
     vam->result_ready = 0;
     mp = vl_msg_api_alloc_as_if_client(msg_size);
@@ -299,9 +300,8 @@
     S(mp);
 
     /* Wait for a reply... */
-    W;
-
-    return 0;
+    W (ret);
+    return ret;
 }
 
 #define vec_validate_acl_rules(v, idx) \
@@ -335,6 +335,7 @@
     ip4_address_t src_v4address, dst_v4address;
     ip6_address_t src_v6address, dst_v6address;
     u8 *tag = 0;
+    int ret;
 
     if (!unformat (i, "%d", &acl_index)) {
 	/* Just assume -1 */
@@ -479,7 +480,8 @@
     S(mp);
 
     /* Wait for a reply... */
-    W;
+    W (ret);
+    return ret;
 }
 
 static int api_acl_del (vat_main_t * vam)
@@ -487,6 +489,7 @@
     unformat_input_t * i = vam->input;
     vl_api_acl_del_t * mp;
     u32 acl_index = ~0;
+    int ret;
 
     if (!unformat (i, "%d", &acl_index)) {
       errmsg ("missing acl index\n");
@@ -501,7 +504,8 @@
     S(mp);
 
     /* Wait for a reply... */
-    W;
+    W (ret);
+    return ret;
 }
 
 static int api_macip_acl_del (vat_main_t * vam)
@@ -509,6 +513,7 @@
     unformat_input_t * i = vam->input;
     vl_api_acl_del_t * mp;
     u32 acl_index = ~0;
+    int ret;
 
     if (!unformat (i, "%d", &acl_index)) {
       errmsg ("missing acl index\n");
@@ -523,7 +528,8 @@
     S(mp);
 
     /* Wait for a reply... */
-    W;
+    W (ret);
+    return ret;
 }
 
 static int api_acl_interface_add_del (vat_main_t * vam)
@@ -534,6 +540,7 @@
     u32 acl_index = ~0;
     u8 is_input = 0;
     u8 is_add = 0;
+    int ret;
 
 //    acl_interface_add_del <intfc> | sw_if_index <if-idx> acl_index <acl-idx> [out] [del]
 
@@ -589,7 +596,8 @@
     S(mp);
 
     /* Wait for a reply... */
-    W;
+    W (ret);
+    return ret;
 }
 
 static int api_macip_acl_interface_add_del (vat_main_t * vam)
@@ -599,6 +607,7 @@
     u32 sw_if_index = ~0;
     u32 acl_index = ~0;
     u8 is_add = 0;
+    int ret;
 
     /* Parse args required to build the message */
     while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT) {
@@ -638,7 +647,8 @@
     S(mp);
 
     /* Wait for a reply... */
-    W;
+    W (ret);
+    return ret;
 }
 
 static int api_acl_interface_set_acl_list (vat_main_t * vam)
@@ -650,6 +660,7 @@
     u32 *inacls = 0;
     u32 *outacls = 0;
     u8 is_input = 0;
+    int ret;
 
 //  acl_interface_set_acl_list <intfc> | sw_if_index <if-idx> input [acl-idx list] output [acl-idx list]
 
@@ -694,7 +705,8 @@
     S(mp);
 
     /* Wait for a reply... */
-    W;
+    W (ret);
+    return ret;
 }
 
 
@@ -703,6 +715,7 @@
     unformat_input_t * i = vam->input;
     u32 sw_if_index = ~0;
     vl_api_acl_interface_list_dump_t * mp;
+    int ret;
 
     /* Parse args required to build the message */
     while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT) {
@@ -722,7 +735,8 @@
     S(mp);
 
     /* Wait for a reply... */
-    W;
+    W (ret);
+    return ret;
 }
 
 static int api_acl_dump (vat_main_t * vam)
@@ -730,6 +744,7 @@
     unformat_input_t * i = vam->input;
     u32 acl_index = ~0;
     vl_api_acl_dump_t * mp;
+    int ret;
 
     /* Parse args required to build the message */
     while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT) {
@@ -747,7 +762,8 @@
     S(mp);
 
     /* Wait for a reply... */
-    W;
+    W (ret);
+    return ret;
 }
 
 static int api_macip_acl_dump (vat_main_t * vam)
@@ -755,6 +771,7 @@
     unformat_input_t * i = vam->input;
     u32 acl_index = ~0;
     vl_api_acl_dump_t * mp;
+    int ret;
 
     /* Parse args required to build the message */
     while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT) {
@@ -772,7 +789,8 @@
     S(mp);
 
     /* Wait for a reply... */
-    W;
+    W (ret);
+    return ret;
 }
 
 #define vec_validate_macip_acl_rules(v, idx) \
@@ -801,6 +819,7 @@
     u8 src_mac[6];
     u8 *tag = 0;
     u8 mac_mask_all_1[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
+    int ret;
 
     while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
@@ -903,7 +922,8 @@
     S(mp);
 
     /* Wait for a reply... */
-    W;
+    W (ret);
+    return ret;
 }
 
 /*
diff --git a/src/plugins/flowperpkt/flowperpkt_test.c b/src/plugins/flowperpkt/flowperpkt_test.c
index 4cc1cfb..972a3b0 100644
--- a/src/plugins/flowperpkt/flowperpkt_test.c
+++ b/src/plugins/flowperpkt/flowperpkt_test.c
@@ -99,6 +99,7 @@
   u8 which = 0;			/* ipv4 by default */
   u32 sw_if_index = ~0;
   vl_api_flowperpkt_tx_interface_add_del_t *mp;
+  int ret;
 
   /* Parse args required to build the message */
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
@@ -131,7 +132,8 @@
   S (mp);
 
   /* Wait for a reply... */
-  W;
+  W (ret);
+  return ret;
 }
 
 /*
diff --git a/src/plugins/ioam/export-vxlan-gpe/vxlan_gpe_ioam_export_test.c b/src/plugins/ioam/export-vxlan-gpe/vxlan_gpe_ioam_export_test.c
index a793821..17d31c9 100644
--- a/src/plugins/ioam/export-vxlan-gpe/vxlan_gpe_ioam_export_test.c
+++ b/src/plugins/ioam/export-vxlan-gpe/vxlan_gpe_ioam_export_test.c
@@ -94,6 +94,7 @@
   unformat_input_t *i = vam->input;
   int is_disable = 0;
   vl_api_vxlan_gpe_ioam_export_enable_disable_t *mp;
+  int ret;
 
   /* Parse args required to build the message */
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
@@ -112,7 +113,8 @@
   S (mp);
 
   /* Wait for a reply... */
-  W;
+  W (ret);
+  return ret;
 }
 
 /*
diff --git a/src/plugins/ioam/export/ioam_export_test.c b/src/plugins/ioam/export/ioam_export_test.c
index 2cb036a..5023afd 100644
--- a/src/plugins/ioam/export/ioam_export_test.c
+++ b/src/plugins/ioam/export/ioam_export_test.c
@@ -96,6 +96,7 @@
   unformat_input_t *i = vam->input;
   int is_disable = 0;
   vl_api_ioam_export_ip6_enable_disable_t *mp;
+  int ret;
 
   /* Parse args required to build the message */
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
@@ -114,7 +115,8 @@
   S(mp);
 
   /* Wait for a reply... */
-  W;
+  W (ret);
+  return ret;
 }
 
 /*
diff --git a/src/plugins/ioam/lib-pot/pot_test.c b/src/plugins/ioam/lib-pot/pot_test.c
index d896eb2..1c6dd02 100644
--- a/src/plugins/ioam/lib-pot/pot_test.c
+++ b/src/plugins/ioam/lib-pot/pot_test.c
@@ -134,6 +134,7 @@
     u64 lpc = 0, poly2 = 0;
     u8 id = 0;
     int rv = 0;
+    int ret;
 
     while (unformat_check_input(input) != UNFORMAT_END_OF_INPUT)
       {
@@ -188,7 +189,8 @@
     mp->max_bits = bits;
       
     S(mp);
-    W;
+    W (ret);
+    return ret;
   
 OUT:
     vec_free(name);
@@ -203,6 +205,7 @@
     u8 *name = NULL;
     u8 id = 0;
     int rv = 0;
+    int ret;
     
     while (unformat_check_input(input) != UNFORMAT_END_OF_INPUT)
       {
@@ -228,7 +231,8 @@
     mp->id = id;
       
     S(mp);
-    W;
+    W (ret);
+    return ret;
   
 OUT:
     vec_free(name);
@@ -239,12 +243,13 @@
 static int api_pot_profile_del (vat_main_t *vam)
 {
     vl_api_pot_profile_del_t *mp;
+    int ret;
    
     M(POT_PROFILE_DEL, mp);
     mp->list_name_len = 0;
     S(mp);
-    W;
-    return 0;
+    W (ret);
+    return ret;
 }
 
 static int api_pot_profile_show_config_dump (vat_main_t *vam)
@@ -252,6 +257,7 @@
     unformat_input_t *input = vam->input;
     vl_api_pot_profile_show_config_dump_t *mp;
     u8 id = 0;
+    int ret;
 
     while(unformat_check_input(input) != UNFORMAT_END_OF_INPUT)
     {
@@ -264,8 +270,8 @@
     mp->id = id;
 
     S(mp);
-    W;
-    return 0;
+    W (ret);
+    return ret;
 }
 
 /* 
diff --git a/src/plugins/ioam/lib-trace/trace_test.c b/src/plugins/ioam/lib-trace/trace_test.c
index d1fb720..1e287de 100644
--- a/src/plugins/ioam/lib-trace/trace_test.c
+++ b/src/plugins/ioam/lib-trace/trace_test.c
@@ -125,10 +125,10 @@
   vl_api_trace_profile_add_t *mp;
   u8 trace_type = 0;
   u8 num_elts = 0;
-  int rv = 0;
   u32 node_id = 0;
   u32 app_data = 0;
   u8 trace_tsp = 0;
+  int ret;
 
   while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
     {
@@ -157,9 +157,8 @@
   mp->num_elts = num_elts;
 
   S (mp);
-  W;
-
-  return (rv);
+  W (ret);
+  return ret;
 }
 
 
@@ -168,22 +167,24 @@
 api_trace_profile_del (vat_main_t * vam)
 {
   vl_api_trace_profile_del_t *mp;
+  int ret;
 
   M (TRACE_PROFILE_DEL, mp);
   S (mp);
-  W;
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static int
 api_trace_profile_show_config (vat_main_t * vam)
 {
   vl_api_trace_profile_show_config_t *mp;
+  int ret;
 
   M (TRACE_PROFILE_SHOW_CONFIG, mp);
   S (mp);
-  W;
-  return 0;
+  W (ret);
+  return ret;
 }
 
 /*
diff --git a/src/plugins/ioam/lib-vxlan-gpe/vxlan_gpe_test.c b/src/plugins/ioam/lib-vxlan-gpe/vxlan_gpe_test.c
index 3e7300f..80e6564 100644
--- a/src/plugins/ioam/lib-vxlan-gpe/vxlan_gpe_test.c
+++ b/src/plugins/ioam/lib-vxlan-gpe/vxlan_gpe_test.c
@@ -108,6 +108,7 @@
   int has_trace_option = 0;
   int has_pow_option = 0;
   int has_ppc_option = 0;
+  int ret;
 
   while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
     {
@@ -132,9 +133,8 @@
 
 
   S (mp);
-  W;
-
-  return (0);
+  W (ret);
+  return ret;
 }
 
 
@@ -142,11 +142,12 @@
 api_vxlan_gpe_ioam_disable (vat_main_t * vam)
 {
   vl_api_vxlan_gpe_ioam_disable_t *mp;
+  int ret;
 
   M (VXLAN_GPE_IOAM_DISABLE, mp);
   S (mp);
-  W;
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -161,6 +162,7 @@
   u8 remote_set = 0;
   u32 vni;
   u8 vni_set = 0;
+  int ret;
 
 
   while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
@@ -238,9 +240,8 @@
   mp->is_ipv6 = ipv6_set;
 
   S (mp);
-  W;
-
-  return (0);
+  W (ret);
+  return ret;
 }
 
 static int
@@ -255,6 +256,7 @@
   u8 remote_set = 0;
   u32 vni;
   u8 vni_set = 0;
+  int ret;
 
 
   while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
@@ -332,9 +334,8 @@
   mp->is_ipv6 = ipv6_set;
 
   S (mp);
-  W;
-
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -347,6 +348,7 @@
   u8 ipv4_set = 0, ipv6_set = 0;
   u8 local_set = 0;
   u32 outer_fib_index = 0;
+  int ret;
 
 
   while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
@@ -401,9 +403,8 @@
   mp->is_ipv6 = ipv6_set;
 
   S (mp);
-  W;
-
-  return (0);
+  W (ret);
+  return ret;
 }
 
 static int
@@ -416,6 +417,7 @@
   u8 ipv4_set = 0, ipv6_set = 0;
   u8 local_set = 0;
   u32 outer_fib_index = 0;
+  int ret;
 
 
   while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
@@ -469,10 +471,8 @@
   mp->is_ipv6 = ipv6_set;
 
   S (mp);
-  W;
-
-
-  return (0);
+  W (ret);
+  return ret;
 }
 
 /*
diff --git a/src/plugins/lb/lb_test.c b/src/plugins/lb/lb_test.c
index a811079..9b30c18 100644
--- a/src/plugins/lb/lb_test.c
+++ b/src/plugins/lb/lb_test.c
@@ -134,6 +134,7 @@
 {
   unformat_input_t *i = vam->input;
   vl_api_lb_conf_t mps, *mp;
+  int ret;
 
   if (!unformat(i, "%U %U %u %u",
                unformat_ip4_address, &mps.ip4_src_address,
@@ -146,16 +147,15 @@
 
   M(LB_CONF, mp);
   S(mp);
-  W;
-
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static int api_lb_add_del_vip (vat_main_t * vam)
 {
   unformat_input_t * i = vam->input;
   vl_api_lb_add_del_vip_t mps, *mp;
+  int ret;
   mps.is_del = 0;
   mps.is_gre4 = 0;
 
@@ -185,15 +185,15 @@
 
   M(LB_ADD_DEL_VIP, mp);
   S(mp);
-  W;
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static int api_lb_add_del_as (vat_main_t * vam)
 {
   unformat_input_t * i = vam->input;
   vl_api_lb_add_del_as_t mps, *mp;
+  int ret;
   mps.is_del = 0;
 
   if (!unformat(i, "%U %U",
@@ -209,9 +209,8 @@
 
   M(LB_ADD_DEL_AS, mp);
   S(mp);
-  W;
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 /*
diff --git a/src/plugins/snat/snat_test.c b/src/plugins/snat/snat_test.c
index 8bab00c..086059a 100644
--- a/src/plugins/snat/snat_test.c
+++ b/src/plugins/snat/snat_test.c
@@ -114,6 +114,7 @@
   vl_api_snat_add_address_range_t * mp;
   u8 is_add = 1;
   int count;
+  int ret;
 
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
@@ -159,10 +160,8 @@
   mp->is_add = is_add;
 
   S(mp);
-  W;
-
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static int api_snat_interface_add_del_feature (vat_main_t * vam)
@@ -173,6 +172,7 @@
   u8 sw_if_index_set = 0;
   u8 is_inside = 1; 
   u8 is_add = 1;
+  int ret;
 
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
@@ -205,9 +205,8 @@
   mp->is_inside = is_inside;
   
   S(mp);
-  W;
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static int api_snat_add_static_mapping(vat_main_t * vam)
@@ -222,6 +221,7 @@
   u32 local_port = 0, external_port = 0, vrf_id = ~0;
   u32 sw_if_index = ~0;
   u8 sw_if_index_set = 0;
+  int ret;
 
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
@@ -273,9 +273,8 @@
   memcpy (mp->external_ip_address, &external_addr, 4);
 
   S(mp);
-  W;
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static void vl_api_snat_control_ping_reply_t_handler
@@ -318,6 +317,7 @@
 static int api_snat_static_mapping_dump(vat_main_t * vam)
 {
   vl_api_snat_static_mapping_dump_t * mp;
+  int ret;
 
   if (vam->json_output)
     {
@@ -337,9 +337,8 @@
     M(SNAT_CONTROL_PING, mp);
     S(mp);
   }
-  W;
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static void vl_api_snat_show_config_reply_t_handler
@@ -376,6 +375,7 @@
 static int api_snat_show_config(vat_main_t * vam)
 {
   vl_api_snat_show_config_t * mp;
+  int ret;
 
   if (vam->json_output)
     {
@@ -385,9 +385,8 @@
 
   M(SNAT_SHOW_CONFIG, mp);
   S(mp);
-  W;
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static void vl_api_snat_address_details_t_handler
@@ -402,6 +401,7 @@
 static int api_snat_address_dump(vat_main_t * vam)
 {
   vl_api_snat_address_dump_t * mp;
+  int ret;
 
   if (vam->json_output)
     {
@@ -417,9 +417,8 @@
     M(SNAT_CONTROL_PING, mp);
     S(mp);
   }
-  W;
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static void vl_api_snat_interface_details_t_handler
@@ -435,6 +434,7 @@
 static int api_snat_interface_dump(vat_main_t * vam)
 {
   vl_api_snat_interface_dump_t * mp;
+  int ret;
 
   if (vam->json_output)
     {
@@ -450,9 +450,8 @@
     M(SNAT_CONTROL_PING, mp);
     S(mp);
   }
-  W;
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static int api_snat_set_workers (vat_main_t * vam)
@@ -460,6 +459,7 @@
   unformat_input_t * i = vam->input;
   vl_api_snat_set_workers_t * mp;
   uword *bitmap;
+  int ret;
 
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
@@ -476,10 +476,8 @@
   mp->worker_mask = clib_host_to_net_u64 (bitmap[0]);
 
   S(mp);
-  W;
-
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static void vl_api_snat_worker_details_t_handler
@@ -495,6 +493,7 @@
 static int api_snat_worker_dump(vat_main_t * vam)
 {
   vl_api_snat_worker_dump_t * mp;
+  int ret;
 
   if (vam->json_output)
     {
@@ -510,9 +509,8 @@
     M(SNAT_CONTROL_PING, mp);
     S(mp);
   }
-  W;
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static int api_snat_ipfix_enable_disable (vat_main_t * vam)
@@ -522,6 +520,7 @@
   u32 sw_if_index;
   u8 sw_if_index_set = 0;
   u8 is_add = 1;
+  int ret;
 
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
@@ -549,9 +548,8 @@
   mp->is_add = is_add;
   
   S(mp);
-  W;
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static void vl_api_snat_interface_addr_details_t_handler
@@ -566,6 +564,7 @@
 static int api_snat_interface_addr_dump(vat_main_t * vam)
 {
   vl_api_snat_interface_addr_dump_t * mp;
+  int ret;
 
   if (vam->json_output)
     {
@@ -581,9 +580,8 @@
     M(SNAT_CONTROL_PING, mp);
     S(mp);
   }
-  W;
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static int api_snat_add_del_interface_addr (vat_main_t * vam)
@@ -593,6 +591,7 @@
   u32 domain_id = 0;
   u32 src_port = 0;
   u8 enable = 1;
+  int ret;
 
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
@@ -615,9 +614,8 @@
   mp->enable = enable;
 
   S(mp);
-  W;
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 /* 
diff --git a/src/vat/api_format.c b/src/vat/api_format.c
index 8caa94f..db5478c 100644
--- a/src/vat/api_format.c
+++ b/src/vat/api_format.c
@@ -4641,6 +4641,7 @@
 {
   vl_api_cli_inband_t *mp;
   unformat_input_t *i = vam->input;
+  int ret;
 
   if (vec_len (i->buffer) == 0)
     return -1;
@@ -4667,7 +4668,8 @@
   mp->length = htonl (len);
 
   S (mp);
-  W2 (print (vam->ofp, "%s", vam->cmd_reply));
+  W2 (ret, print (vam->ofp, "%s", vam->cmd_reply));
+  return ret;
 }
 
 static int
@@ -4677,6 +4679,7 @@
   vl_api_create_loopback_t *mp;
   u8 mac_address[6];
   u8 mac_set = 0;
+  int ret;
 
   memset (mac_address, 0, sizeof (mac_address));
 
@@ -4694,7 +4697,8 @@
     clib_memcpy (mp->mac_address, mac_address, sizeof (mac_address));
 
   S (mp);
-  W;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -4703,6 +4707,7 @@
   unformat_input_t *i = vam->input;
   vl_api_delete_loopback_t *mp;
   u32 sw_if_index = ~0;
+  int ret;
 
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
@@ -4723,7 +4728,8 @@
   mp->sw_if_index = ntohl (sw_if_index);
 
   S (mp);
-  W;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -4732,6 +4738,7 @@
   unformat_input_t *i = vam->input;
   vl_api_want_stats_t *mp;
   int enable = -1;
+  int ret;
 
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
@@ -4753,7 +4760,8 @@
   mp->enable_disable = enable;
 
   S (mp);
-  W;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -4762,6 +4770,7 @@
   unformat_input_t *i = vam->input;
   vl_api_want_interface_events_t *mp;
   int enable = -1;
+  int ret;
 
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
@@ -4785,7 +4794,8 @@
   vam->interface_event_display = enable;
 
   S (mp);
-  W;
+  W (ret);
+  return ret;
 }
 
 
@@ -4797,6 +4807,7 @@
   hash_pair_t *p;
   name_sort_t *nses = 0, *ns;
   sw_interface_subif_t *sub = NULL;
+  int ret;
 
   /* Toss the old name table */
   /* *INDENT-OFF* */
@@ -4892,7 +4903,8 @@
     M (CONTROL_PING, mp);
     S (mp);
   }
-  W;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -4903,6 +4915,7 @@
   u32 sw_if_index;
   u8 sw_if_index_set = 0;
   u8 admin_up = 0, link_up = 0;
+  int ret;
 
   /* Parse args required to build the message */
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
@@ -4940,7 +4953,8 @@
   S (mp);
 
   /* Wait for a reply, return the good/bad news... */
-  W;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -4950,6 +4964,7 @@
   vl_api_sw_interface_clear_stats_t *mp;
   u32 sw_if_index;
   u8 sw_if_index_set = 0;
+  int ret;
 
   /* Parse args required to build the message */
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
@@ -4974,7 +4989,8 @@
   S (mp);
 
   /* Wait for a reply, return the good/bad news... */
-  W;
+  W (ret);
+  return ret;
 }
 
 #if DPDK >0
@@ -4991,6 +5007,7 @@
   u8 pipe_set = 0;
   u32 profile;
   u8 profile_set = 0;
+  int ret;
 
   /* Parse args required to build the message */
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
@@ -5045,9 +5062,8 @@
 
 
   S (mp);
-  W;
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -5063,6 +5079,7 @@
   u32 tb_size = 1000000;
   u32 tc_rate[] = { 1250000000, 1250000000, 1250000000, 1250000000 };
   u32 tc_period = 10;
+  int ret;
 
   /* Parse args required to build the message */
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
@@ -5125,9 +5142,8 @@
   mp->tc_period = ntohl (tc_period);
 
   S (mp);
-  W;
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -5141,6 +5157,7 @@
   u8 tc_set = 0;
   u8 queue_set = 0;
   u32 entry, tc, queue;
+  int ret;
 
   /* Parse args required to build the message */
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
@@ -5191,9 +5208,8 @@
   mp->queue = ntohl (queue);
 
   S (mp);
-  W;
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 #endif
 
@@ -5210,6 +5226,7 @@
   u8 v6_address_set = 0;
   ip4_address_t v4address;
   ip6_address_t v6address;
+  int ret;
 
   /* Parse args required to build the message */
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
@@ -5270,7 +5287,8 @@
   S (mp);
 
   /* Wait for a reply, return good/bad news  */
-  W;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -5281,6 +5299,7 @@
   u32 sw_if_index;
   u8 sw_if_index_set = 0;
   u8 enable = 1;
+  int ret;
 
   /* Parse args required to build the message */
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
@@ -5313,7 +5332,8 @@
   S (mp);
 
   /* Wait for a reply... */
-  W;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -5324,6 +5344,7 @@
   u32 sw_if_index, vrf_id = 0;
   u8 sw_if_index_set = 0;
   u8 is_ipv6 = 0;
+  int ret;
 
   /* Parse args required to build the message */
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
@@ -5357,7 +5378,8 @@
   S (mp);
 
   /* Wait for a reply... */
-  W;
+  W (ret);
+  return ret;
 }
 
 static void vl_api_sw_interface_get_table_reply_t_handler
@@ -5397,6 +5419,7 @@
   u32 sw_if_index;
   u8 sw_if_index_set = 0;
   u8 is_ipv6 = 0;
+  int ret;
 
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
@@ -5421,7 +5444,8 @@
   mp->is_ipv6 = is_ipv6;
 
   S (mp);
-  W;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -5432,6 +5456,7 @@
   u32 sw_if_index = 0;
   u8 sw_if_index_set = 0;
   u8 is_enable = 0;
+  int ret;
 
   /* Parse args required to build the message */
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
@@ -5464,7 +5489,8 @@
   S (mp);
 
   /* Wait for a reply... */
-  W;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -5476,6 +5502,7 @@
   u8 sw_if_index_set = 0;
   u8 is_enable = 1;
   u8 is_ipv6 = 0;
+  int ret;
 
   /* Parse args required to build the message */
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
@@ -5513,7 +5540,8 @@
   S (mp);
 
   /* Wait for a reply... */
-  W;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -5526,6 +5554,7 @@
   u32 tx_sw_if_index;
   u8 tx_sw_if_index_set = 0;
   u8 enable = 1;
+  int ret;
 
   /* Parse args required to build the message */
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
@@ -5583,9 +5612,8 @@
   mp->enable = enable;
 
   S (mp);
-  W;
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -5600,6 +5628,7 @@
   u8 bvi = 0;
   u32 shg = 0;
   u8 enable = 1;
+  int ret;
 
   /* Parse args required to build the message */
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
@@ -5645,9 +5674,8 @@
   mp->enable = enable;
 
   S (mp);
-  W;
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -5656,6 +5684,7 @@
   unformat_input_t *i = vam->input;
   vl_api_bridge_domain_dump_t *mp;
   u32 bd_id = ~0;
+  int ret;
 
   /* Parse args required to build the message */
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
@@ -5677,9 +5706,8 @@
     S (mp);
   }
 
-  W;
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -5691,6 +5719,7 @@
   u8 is_add = 1;
   u32 flood = 1, forward = 1, learn = 1, uu_flood = 1, arp_term = 0;
   u32 mac_age = 0;
+  int ret;
 
   /* Parse args required to build the message */
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
@@ -5742,9 +5771,8 @@
   mp->mac_age = (u8) mac_age;
 
   S (mp);
-  W;
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -5887,8 +5915,11 @@
     }
   else
     {
+      int ret;
+
       /* Wait for a reply... */
-      W;
+      W (ret);
+      return ret;
     }
   /* Return the good/bad news */
   return (vam->retval);
@@ -5902,6 +5933,7 @@
   u32 sw_if_index;
   u32 feature_bitmap = 0;
   u8 sw_if_index_set = 0;
+  int ret;
 
   /* Parse args required to build the message */
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
@@ -5943,9 +5975,8 @@
   mp->feature_bitmap = ntohl (feature_bitmap);
 
   S (mp);
-  W;
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -5957,6 +5988,7 @@
   u8 bd_id_set = 0;
   u8 is_set = 1;
   u32 flags = 0;
+  int ret;
 
   /* Parse args required to build the message */
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
@@ -5994,9 +6026,8 @@
   mp->is_set = is_set;
 
   S (mp);
-  W;
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -6013,6 +6044,7 @@
   ip4_address_t v4addr;
   ip6_address_t v6addr;
   u8 macaddr[6];
+  int ret;
 
 
   /* Parse args required to build the message */
@@ -6068,9 +6100,8 @@
     clib_memcpy (mp->ip_address, &v4addr, sizeof (v4addr));
   clib_memcpy (mp->mac_address, macaddr, 6);
   S (mp);
-  W;
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -6089,6 +6120,7 @@
   ip6_address_t ip6_address;
   u32 ip6_mask_width;
   int ip6_address_set = 0;
+  int ret;
 
   memset (mac_address, 0, sizeof (mac_address));
 
@@ -6162,7 +6194,8 @@
   S (mp);
 
   /* Wait for a reply... */
-  W;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -6176,6 +6209,7 @@
   u8 *tap_name;
   u32 sw_if_index = ~0;
   u8 sw_if_index_set = 0;
+  int ret;
 
   memset (mac_address, 0, sizeof (mac_address));
 
@@ -6227,7 +6261,8 @@
   S (mp);
 
   /* Wait for a reply... */
-  W;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -6237,6 +6272,7 @@
   vl_api_tap_delete_t *mp;
   u32 sw_if_index = ~0;
   u8 sw_if_index_set = 0;
+  int ret;
 
   /* Parse args required to build the message */
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
@@ -6264,7 +6300,8 @@
   S (mp);
 
   /* Wait for a reply... */
-  W;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -6556,8 +6593,11 @@
     }
   else
     {
+      int ret;
+
       /* Wait for a reply... */
-      W;
+      W (ret);
+      return ret;
     }
 
   /* Return the good/bad news */
@@ -6580,6 +6620,7 @@
   ip6_address_t v6_grp_address, v6_src_address;
   mfib_itf_flags_t iflags = 0;
   mfib_entry_flags_t eflags = 0;
+  int ret;
 
   /* Parse args required to build the message */
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
@@ -6677,7 +6718,8 @@
   /* send it... */
   S (mp);
   /* Wait for a reply... */
-  W;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -6893,8 +6935,11 @@
     }
   else
     {
+      int ret;
+
       /* Wait for a reply... */
-      W;
+      W (ret);
+      return ret;
     }
 
   /* Return the good/bad news */
@@ -6915,6 +6960,7 @@
   u32 address_length;
   u8 address_set = 0;
   mpls_label_t local_label = MPLS_LABEL_INVALID;
+  int ret;
 
   /* Parse args required to build the message */
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
@@ -6980,7 +7026,8 @@
   S (mp);
 
   /* Wait for a reply... */
-  W;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -6992,6 +7039,7 @@
   u8 is_add = 1;
   ip4_address_t lo, hi;
   u8 range_set = 0;
+  int ret;
 
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
@@ -7023,9 +7071,8 @@
   clib_memcpy (mp->hi_address, &hi, sizeof (mp->hi_address));
 
   S (mp);
-  W;
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -7036,6 +7083,7 @@
   u32 sw_if_index;
   u8 enable = 1;
   u8 sw_if_index_set = 0;
+  int ret;
 
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
@@ -7066,9 +7114,8 @@
   mp->enable_disable = enable;
 
   S (mp);
-  W;
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -7089,6 +7136,7 @@
   };
   ip6_address_t v6_next_hop_address = { {0} };
   mpls_label_t next_hop_out_label = MPLS_LABEL_INVALID, *labels = NULL;
+  int ret;
 
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
@@ -7151,9 +7199,8 @@
     }
 
   S (mp);
-  W;
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -7165,6 +7212,7 @@
   u32 unnum_sw_index = ~0;
   u8 is_add = 1;
   u8 sw_if_index_set = 0;
+  int ret;
 
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
@@ -7196,9 +7244,8 @@
   mp->is_add = is_add;
 
   S (mp);
-  W;
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -7217,6 +7264,7 @@
   u8 v6_address_set = 0;
   ip4_address_t v4address;
   ip6_address_t v6address;
+  int ret;
 
   memset (mac_address, 0, sizeof (mac_address));
 
@@ -7289,10 +7337,8 @@
   S (mp);
 
   /* Wait for a reply, return good/bad news  */
-  W;
-
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -7303,6 +7349,7 @@
   u32 vrf_id = 0;
   u8 is_ipv6 = 0;
   u8 vrf_id_set = 0;
+  int ret;
 
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
@@ -7329,9 +7376,8 @@
   mp->is_ipv6 = is_ipv6;
 
   S (mp);
-  W;
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -7343,6 +7389,7 @@
   u8 sw_if_index_set = 0;
   u32 vlan_id;
   u8 vlan_id_set = 0;
+  int ret;
 
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
@@ -7377,9 +7424,8 @@
   mp->vlan_id = ntohl (vlan_id);
 
   S (mp);
-  W;
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 #define foreach_create_subif_bit                \
@@ -7412,6 +7458,7 @@
   u32 tmp;
   u16 outer_vlan_id = 0;
   u16 inner_vlan_id = 0;
+  int ret;
 
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
@@ -7461,9 +7508,8 @@
   mp->inner_vlan_id = ntohs (inner_vlan_id);
 
   S (mp);
-  W;
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -7476,6 +7522,7 @@
   ip4_address_t src, dst;
   u8 src_set = 0;
   u8 dst_set = 0;
+  int ret;
 
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
@@ -7514,9 +7561,8 @@
   clib_memcpy (mp->dst_address, &dst, sizeof (mp->dst_address));
 
   S (mp);
-  W;
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -7528,6 +7574,7 @@
   u8 is_ipv6 = 0;
   u8 vrf_id_set = 0;
 
+  int ret;
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
       if (unformat (i, "vrf %d", &vrf_id))
@@ -7553,9 +7600,8 @@
   mp->is_ipv6 = is_ipv6;
 
   S (mp);
-  W;
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -7574,6 +7620,7 @@
   u8 v6_src_address_set = 0;
   ip4_address_t v4srcaddress;
   ip6_address_t v6srcaddress;
+  int ret;
 
   /* Parse args required to build the message */
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
@@ -7647,9 +7694,8 @@
   S (mp);
 
   /* Wait for a reply, return good/bad news  */
-  W;
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -7669,6 +7715,7 @@
   u8 v6_src_address_set = 0;
   ip4_address_t v4srcaddress;
   ip6_address_t v6srcaddress;
+  int ret;
 
   /* Parse args required to build the message */
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
@@ -7745,9 +7792,8 @@
   S (mp);
 
   /* Wait for a reply, return good/bad news  */
-  W;
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -7763,6 +7809,7 @@
   u8 oui_set = 0;
   u32 fib_id;
   u8 fib_id_set = 0;
+  int ret;
 
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
@@ -7808,9 +7855,8 @@
   mp->is_add = is_add;
 
   S (mp);
-  W;
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -7823,6 +7869,7 @@
   u8 is_add = 1;
   u8 *hostname = 0;
   u8 disable_event = 0;
+  int ret;
 
   /* Parse args required to build the message */
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
@@ -7868,9 +7915,8 @@
   S (mp);
 
   /* Wait for a reply, return good/bad news  */
-  W;
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -7887,6 +7933,7 @@
   u8 dport = 0;
   u8 proto = 0;
   u8 reverse = 0;
+  int ret;
 
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
@@ -7931,9 +7978,8 @@
   mp->is_ipv6 = is_ipv6;
 
   S (mp);
-  W;
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -7944,6 +7990,7 @@
   u32 sw_if_index;
   u8 sw_if_index_set = 0;
   u8 enable = 0;
+  int ret;
 
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
@@ -7974,9 +8021,8 @@
   mp->enable = enable;
 
   S (mp);
-  W;
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -7988,6 +8034,7 @@
   u8 sw_if_index_set = 0;
   u8 v6_address_set = 0;
   ip6_address_t v6address;
+  int ret;
 
   /* Parse args required to build the message */
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
@@ -8023,10 +8070,8 @@
   S (mp);
 
   /* Wait for a reply, return good/bad news  */
-  W;
-
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 
@@ -8048,6 +8093,7 @@
   u8 is_no = 0;
   u32 val_lifetime = 0;
   u32 pref_lifetime = 0;
+  int ret;
 
   /* Parse args required to build the message */
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
@@ -8112,10 +8158,8 @@
   S (mp);
 
   /* Wait for a reply, return good/bad news  */
-  W;
-
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -8138,6 +8182,7 @@
   u32 lifetime = 0;
   u32 initial_count = 0;
   u32 initial_interval = 0;
+  int ret;
 
 
   /* Parse args required to build the message */
@@ -8208,10 +8253,8 @@
   S (mp);
 
   /* Wait for a reply, return good/bad news  */
-  W;
-
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -8222,6 +8265,7 @@
   u32 arp_nbr_limit;
   u8 limit_set = 0;
   u8 is_ipv6 = 0;
+  int ret;
 
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
@@ -8248,9 +8292,8 @@
   mp->is_ipv6 = is_ipv6;
 
   S (mp);
-  W;
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -8263,6 +8306,7 @@
   u32 tx_sw_if_index;
   u8 tx_sw_if_index_set = 0;
   u8 is_add = 1;
+  int ret;
 
   /* Parse args required to build the message */
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
@@ -8318,9 +8362,8 @@
   mp->is_add = is_add;
 
   S (mp);
-  W;
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -8333,6 +8376,7 @@
   int has_pot_option = 0;
   int has_seqno_option = 0;
   int has_analyse_option = 0;
+  int ret;
 
   while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
     {
@@ -8355,10 +8399,8 @@
   mp->trace_enable = has_trace_option;
 
   S (mp);
-  W;
-
-  return (0);
-
+  W (ret);
+  return ret;
 }
 
 
@@ -8366,11 +8408,12 @@
 api_ioam_disable (vat_main_t * vam)
 {
   vl_api_ioam_disable_t *mp;
+  int ret;
 
   M (IOAM_DISABLE, mp);
   S (mp);
-  W;
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -8395,6 +8438,7 @@
   ip6_address_t next_address, tag;
   u8 *name = 0;
   u8 *policy_name = 0;
+  int ret;
 
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
@@ -8501,8 +8545,8 @@
   vec_free (tags);
 
   S (mp);
-  W;
-  /* NOTREACHED */
+  W (ret);
+  return ret;
 }
 
 static int
@@ -8520,6 +8564,7 @@
   int j = 0;
   int tunnel_names_length = 1;	// Init to 1 to offset the #tunnel_names counter byte
   int tun_name_len = 0;		// Different naming convention used as confusing these would be "bad" (TM)
+  int ret;
 
   while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
     {
@@ -8584,8 +8629,8 @@
   vec_free (tunnel_name);
 
   S (mp);
-  W;
-  /* NOTREACHED */
+  W (ret);
+  return ret;
 }
 
 static int
@@ -8597,6 +8642,7 @@
   ip6_address_t multicast_address;
   u8 *policy_name = 0;
   int multicast_address_set = 0;
+  int ret;
 
   while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
     {
@@ -8636,8 +8682,8 @@
   vec_free (policy_name);
 
   S (mp);
-  W;
-  /* NOTREACHED */
+  W (ret);
+  return ret;
 }
 
 
@@ -9267,6 +9313,7 @@
   u8 *mask = 0;
   u32 current_data_flag = 0;
   int current_data_offset = 0;
+  int ret;
 
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
@@ -9351,8 +9398,8 @@
   vec_free (mask);
 
   S (mp);
-  W;
-  /* NOTREACHED */
+  W (ret);
+  return ret;
 }
 
 uword
@@ -9806,6 +9853,7 @@
   u32 match_n_vectors = 0;
   u32 action = 0;
   u32 metadata = 0;
+  int ret;
 
   /*
    * Warning: you have to supply skip_n and match_n
@@ -9880,8 +9928,8 @@
   vec_free (match);
 
   S (mp);
-  W;
-  /* NOTREACHED */
+  W (ret);
+  return ret;
 }
 
 static int
@@ -9893,6 +9941,7 @@
   int sw_if_index_set;
   u32 table_index = ~0;
   u8 is_ipv6 = 0;
+  int ret;
 
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
@@ -9923,9 +9972,8 @@
   mp->is_ipv6 = is_ipv6;
 
   S (mp);
-  W;
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -9939,6 +9987,7 @@
   u32 ip6_table_index = ~0;
   u32 other_table_index = ~0;
   u32 is_input = 1;
+  int ret;
 
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
@@ -9977,9 +10026,8 @@
   mp->is_input = (u8) is_input;
 
   S (mp);
-  W;
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -9996,6 +10044,7 @@
   u32 path_mtu = ~0;
   u32 template_interval = ~0;
   u8 udp_checksum = 0;
+  int ret;
 
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
@@ -10043,8 +10092,8 @@
   mp->udp_checksum = udp_checksum;
 
   S (mp);
-  W;
-  /* NOTREACHED */
+  W (ret);
+  return ret;
 }
 
 static int
@@ -10054,6 +10103,7 @@
   vl_api_set_ipfix_classify_stream_t *mp;
   u32 domain_id = 0;
   u32 src_port = UDP_DST_PORT_ipfix;
+  int ret;
 
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
@@ -10074,8 +10124,8 @@
   mp->src_port = htons ((u16) src_port);
 
   S (mp);
-  W;
-  /* NOTREACHED */
+  W (ret);
+  return ret;
 }
 
 static int
@@ -10087,6 +10137,7 @@
   u32 classify_table_index = ~0;
   u8 ip_version = 0;
   u8 transport_protocol = 255;
+  int ret;
 
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
@@ -10135,8 +10186,8 @@
   mp->transport_protocol = transport_protocol;
 
   S (mp);
-  W;
-  /* NOTREACHED */
+  W (ret);
+  return ret;
 }
 
 static int
@@ -10145,6 +10196,7 @@
   unformat_input_t *i = vam->input;
   vl_api_get_node_index_t *mp;
   u8 *name = 0;
+  int ret;
 
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
@@ -10169,9 +10221,8 @@
   vec_free (name);
 
   S (mp);
-  W;
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -10180,6 +10231,7 @@
   unformat_input_t *i = vam->input;
   vl_api_get_next_index_t *mp;
   u8 *node_name = 0, *next_node_name = 0;
+  int ret;
 
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
@@ -10218,9 +10270,8 @@
   vec_free (next_node_name);
 
   S (mp);
-  W;
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -10230,6 +10281,7 @@
   vl_api_add_node_next_t *mp;
   u8 *name = 0;
   u8 *next = 0;
+  int ret;
 
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
@@ -10268,9 +10320,8 @@
   vec_free (next);
 
   S (mp);
-  W;
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -10286,6 +10337,7 @@
   u64 remote_cookie = 0;
   u8 l2_sublayer_present = 0;
   vl_api_l2tpv3_create_tunnel_t *mp;
+  int ret;
 
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
@@ -10336,9 +10388,8 @@
   mp->is_ipv6 = 1;
 
   S (mp);
-  W;
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -10350,6 +10401,7 @@
   u64 new_local_cookie = 0;
   u64 new_remote_cookie = 0;
   vl_api_l2tpv3_set_tunnel_cookies_t *mp;
+  int ret;
 
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
@@ -10378,9 +10430,8 @@
   mp->new_remote_cookie = clib_host_to_net_u64 (new_remote_cookie);
 
   S (mp);
-  W;
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -10391,6 +10442,7 @@
   u32 sw_if_index;
   u8 sw_if_index_set = 0;
   u8 enable_disable = 1;
+  int ret;
 
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
@@ -10418,9 +10470,8 @@
   mp->enable_disable = enable_disable;
 
   S (mp);
-  W;
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -10429,6 +10480,7 @@
   unformat_input_t *i = vam->input;
   vl_api_l2tpv3_set_lookup_key_t *mp;
   u8 key = ~0;
+  int ret;
 
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
@@ -10453,9 +10505,8 @@
   mp->key = key;
 
   S (mp);
-  W;
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static void vl_api_sw_if_l2tpv3_tunnel_details_t_handler
@@ -10525,6 +10576,7 @@
 api_sw_if_l2tpv3_tunnel_dump (vat_main_t * vam)
 {
   vl_api_sw_if_l2tpv3_tunnel_dump_t *mp;
+  int ret;
 
   /* Get list of l2tpv3-tunnel interfaces */
   M (SW_IF_L2TPV3_TUNNEL_DUMP, mp);
@@ -10536,7 +10588,8 @@
     M (CONTROL_PING, mp);
     S (mp);
   }
-  W;
+  W (ret);
+  return ret;
 }
 
 
@@ -10571,6 +10624,7 @@
 api_sw_interface_tap_dump (vat_main_t * vam)
 {
   vl_api_sw_interface_tap_dump_t *mp;
+  int ret;
 
   print (vam->ofp, "\n%-16s %s", "dev_name", "sw_if_index");
   /* Get list of tap interfaces */
@@ -10583,7 +10637,8 @@
     M (CONTROL_PING, mp);
     S (mp);
   }
-  W;
+  W (ret);
+  return ret;
 }
 
 static uword unformat_vxlan_decap_next
@@ -10616,6 +10671,7 @@
   u32 encap_vrf_id = 0;
   u32 decap_next_index = ~0;
   u32 vni = 0;
+  int ret;
 
   /* Can't "universally zero init" (={0}) due to GCC bug 53119 */
   memset (&src, 0, sizeof src);
@@ -10752,9 +10808,8 @@
   mp->is_ipv6 = ipv6_set;
 
   S (mp);
-  W;
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static void vl_api_vxlan_tunnel_details_t_handler
@@ -10824,6 +10879,7 @@
   vl_api_vxlan_tunnel_dump_t *mp;
   u32 sw_if_index;
   u8 sw_if_index_set = 0;
+  int ret;
 
   /* Parse args required to build the message */
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
@@ -10859,7 +10915,8 @@
     M (CONTROL_PING, mp);
     S (mp);
   }
-  W;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -10873,6 +10930,7 @@
   u8 src_set = 0;
   u8 dst_set = 0;
   u32 outer_fib_id = 0;
+  int ret;
 
   while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
     {
@@ -10914,9 +10972,8 @@
   mp->teb = teb;
 
   S (mp);
-  W;
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static void vl_api_gre_tunnel_details_t_handler
@@ -10962,6 +11019,7 @@
   vl_api_gre_tunnel_dump_t *mp;
   u32 sw_if_index;
   u8 sw_if_index_set = 0;
+  int ret;
 
   /* Parse args required to build the message */
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
@@ -10997,7 +11055,8 @@
     M (CONTROL_PING, mp);
     S (mp);
   }
-  W;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -11005,13 +11064,13 @@
 {
 //  unformat_input_t * i = vam->input;
   vl_api_l2_fib_clear_table_t *mp;
+  int ret;
 
   M (L2_FIB_CLEAR_TABLE, mp);
 
   S (mp);
-  W;
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -11022,6 +11081,7 @@
   u32 sw_if_index;
   u8 enable = 1;
   u8 sw_if_index_set = 0;
+  int ret;
 
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
@@ -11052,9 +11112,8 @@
   mp->enable_disable = enable;
 
   S (mp);
-  W;
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 #define foreach_vtr_op                          \
@@ -11080,6 +11139,7 @@
   u32 push_dot1q = 1;
   u32 tag1 = ~0;
   u32 tag2 = ~0;
+  int ret;
 
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
@@ -11119,9 +11179,8 @@
   mp->tag2 = ntohl (tag2);
 
   S (mp);
-  W;
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -11136,6 +11195,7 @@
   u8 hwaddr[6];
   u8 use_custom_mac = 0;
   u8 *tag = 0;
+  int ret;
 
   /* Shut up coverity */
   memset (hwaddr, 0, sizeof (hwaddr));
@@ -11188,9 +11248,8 @@
   vec_free (tag);
 
   S (mp);
-  W;
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -11204,6 +11263,7 @@
   u32 custom_dev_instance = ~0;
   u8 sw_if_index_set = 0;
   u32 sw_if_index = (u32) ~ 0;
+  int ret;
 
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
@@ -11255,9 +11315,8 @@
     }
 
   S (mp);
-  W;
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -11267,6 +11326,7 @@
   vl_api_delete_vhost_user_if_t *mp;
   u32 sw_if_index = ~0;
   u8 sw_if_index_set = 0;
+  int ret;
 
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
@@ -11290,9 +11350,8 @@
   mp->sw_if_index = ntohl (sw_if_index);
 
   S (mp);
-  W;
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static void vl_api_sw_interface_vhost_user_details_t_handler
@@ -11339,6 +11398,7 @@
 api_sw_interface_vhost_user_dump (vat_main_t * vam)
 {
   vl_api_sw_interface_vhost_user_dump_t *mp;
+  int ret;
   print (vam->ofp,
 	 "Interface name           idx hdr_sz features server regions filename");
 
@@ -11352,20 +11412,21 @@
     M (CONTROL_PING, mp);
     S (mp);
   }
-  W;
+  W (ret);
+  return ret;
 }
 
 static int
 api_show_version (vat_main_t * vam)
 {
   vl_api_show_version_t *mp;
+  int ret;
 
   M (SHOW_VERSION, mp);
 
   S (mp);
-  W;
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 
@@ -11385,6 +11446,7 @@
   u8 protocol = ~0;
   u32 vni;
   u8 vni_set = 0;
+  int ret;
 
   while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
     {
@@ -11479,9 +11541,8 @@
   mp->is_ipv6 = ipv6_set;
 
   S (mp);
-  W;
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static void vl_api_vxlan_gpe_tunnel_details_t_handler
@@ -11543,6 +11604,7 @@
   vl_api_vxlan_gpe_tunnel_dump_t *mp;
   u32 sw_if_index;
   u8 sw_if_index_set = 0;
+  int ret;
 
   /* Parse args required to build the message */
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
@@ -11578,7 +11640,8 @@
     M (CONTROL_PING, mp);
     S (mp);
   }
-  W;
+  W (ret);
+  return ret;
 }
 
 u8 *
@@ -11631,6 +11694,7 @@
   vl_api_l2_fib_table_dump_t *mp;
   u32 bd_id;
   u8 bd_id_set = 0;
+  int ret;
 
   /* Parse args required to build the message */
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
@@ -11661,7 +11725,8 @@
     M (CONTROL_PING, mp);
     S (mp);
   }
-  W;
+  W (ret);
+  return ret;
 }
 
 
@@ -11672,6 +11737,7 @@
   vl_api_interface_name_renumber_t *mp;
   u32 sw_if_index = ~0;
   u32 new_show_dev_instance = ~0;
+  int ret;
 
   while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
     {
@@ -11705,7 +11771,8 @@
   mp->new_show_dev_instance = ntohl (new_show_dev_instance);
 
   S (mp);
-  W;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -11716,6 +11783,7 @@
   ip4_address_t address;
   int address_set = 0;
   u32 enable_disable = 1;
+  int ret;
 
   while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
     {
@@ -11739,7 +11807,8 @@
   mp->address = address.as_u32;
 
   S (mp);
-  W;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -11750,6 +11819,7 @@
   ip6_address_t address;
   int address_set = 0;
   u32 enable_disable = 1;
+  int ret;
 
   while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
     {
@@ -11773,7 +11843,8 @@
   clib_memcpy (mp->address, &address, sizeof (ip6_address_t));
 
   S (mp);
-  W;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -11787,6 +11858,7 @@
   u32 ip6_table_index = ~0;
   u32 l2_table_index = ~0;
   u8 is_add = 1;
+  int ret;
 
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
@@ -11824,9 +11896,8 @@
   mp->is_add = is_add;
 
   S (mp);
-  W;
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -11838,6 +11909,7 @@
   u8 sw_if_index_set = 0;
   u8 ipv4_set = 0;
   u8 ipv6_set = 0;
+  int ret;
 
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
@@ -11886,7 +11958,8 @@
     M (CONTROL_PING, mp);
     S (mp);
   }
-  W;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -11898,6 +11971,7 @@
   int ipv6_set = 0;
   int is_ipv6;
   int i;
+  int ret;
 
   while (unformat_check_input (in) != UNFORMAT_END_OF_INPUT)
     {
@@ -11941,7 +12015,8 @@
     M (CONTROL_PING, mp);
     S (mp);
   }
-  W;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -11951,6 +12026,7 @@
   vl_api_ipsec_spd_add_del_t *mp;
   u32 spd_id = ~0;
   u8 is_add = 1;
+  int ret;
 
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
@@ -11976,9 +12052,8 @@
   mp->is_add = is_add;
 
   S (mp);
-  W;
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -11990,6 +12065,7 @@
   u8 sw_if_index_set = 0;
   u32 spd_id = (u32) ~ 0;
   u8 is_add = 1;
+  int ret;
 
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
@@ -12029,9 +12105,8 @@
   mp->is_add = is_add;
 
   S (mp);
-  W;
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -12046,6 +12121,7 @@
   u32 lport_start = 0, lport_stop = (u32) ~ 0;
   ip4_address_t laddr4_start, laddr4_stop, raddr4_start, raddr4_stop;
   ip6_address_t laddr6_start, laddr6_stop, raddr6_start, raddr6_stop;
+  int ret;
 
   laddr4_start.as_u32 = raddr4_start.as_u32 = 0;
   laddr4_stop.as_u32 = raddr4_stop.as_u32 = (u32) ~ 0;
@@ -12186,9 +12262,8 @@
   mp->is_add = is_add;
   mp->is_ip_any = is_ip_any;
   S (mp);
-  W;
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -12207,6 +12282,7 @@
   ip4_address_t tun_dst4;
   ip6_address_t tun_src6;
   ip6_address_t tun_dst6;
+  int ret;
 
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
@@ -12317,9 +12393,8 @@
     }
 
   S (mp);
-  W;
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -12329,6 +12404,7 @@
   vl_api_ipsec_sa_set_key_t *mp;
   u32 sa_id;
   u8 *ck = 0, *ik = 0;
+  int ret;
 
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
@@ -12363,9 +12439,8 @@
     clib_memcpy (mp->integrity_key, ik, mp->integrity_key_length);
 
   S (mp);
-  W;
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -12375,6 +12450,7 @@
   vl_api_ikev2_profile_add_del_t *mp;
   u8 is_add = 1;
   u8 *name = 0;
+  int ret;
 
   const char *valid_chars = "a-zA-Z0-9_";
 
@@ -12410,9 +12486,8 @@
   vec_free (name);
 
   S (mp);
-  W;
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -12424,6 +12499,7 @@
   u8 *data = 0;
   u32 auth_method = 0;
   u8 is_hex = 0;
+  int ret;
 
   const char *valid_chars = "a-zA-Z0-9_";
 
@@ -12480,9 +12556,8 @@
   vec_free (data);
 
   S (mp);
-  W;
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -12495,6 +12570,7 @@
   u8 is_local = 0;
   u32 id_type = 0;
   ip4_address_t ip4;
+  int ret;
 
   const char *valid_chars = "a-zA-Z0-9_";
 
@@ -12559,9 +12635,8 @@
   vec_free (data);
 
   S (mp);
-  W;
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -12575,6 +12650,7 @@
   ip4_address_t start_addr, end_addr;
 
   const char *valid_chars = "a-zA-Z0-9_";
+  int ret;
 
   start_addr.as_u32 = 0;
   end_addr.as_u32 = (u32) ~ 0;
@@ -12629,9 +12705,8 @@
   vec_free (name);
 
   S (mp);
-  W;
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -12640,6 +12715,7 @@
   unformat_input_t *i = vam->input;
   vl_api_ikev2_set_local_key_t *mp;
   u8 *file = 0;
+  int ret;
 
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
@@ -12670,9 +12746,8 @@
   vec_free (file);
 
   S (mp);
-  W;
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 /*
@@ -12693,6 +12768,7 @@
   u8 is_translation = 0;
   u32 mtu = 0;
   u32 ip6_src_len = 128;
+  int ret;
 
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
@@ -12754,7 +12830,8 @@
   S (mp);
 
   /* Wait for a reply, return good/bad news  */
-  W;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -12765,6 +12842,7 @@
 
   u32 num_m_args = 0;
   u32 index;
+  int ret;
 
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
@@ -12792,7 +12870,8 @@
   S (mp);
 
   /* Wait for a reply, return good/bad news  */
-  W;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -12803,6 +12882,7 @@
   u8 is_add = 1;
   ip6_address_t ip6_dst;
   u32 num_m_args = 0, index, psid = 0;
+  int ret;
 
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
@@ -12835,13 +12915,15 @@
   S (mp);
 
   /* Wait for a reply, return good/bad news  */
-  W;
+  W (ret);
+  return ret;
 }
 
 static int
 api_map_domain_dump (vat_main_t * vam)
 {
   vl_api_map_domain_dump_t *mp;
+  int ret;
 
   /* Construct the API message */
   M (MAP_DOMAIN_DUMP, mp);
@@ -12855,7 +12937,8 @@
     M (CONTROL_PING, mp);
     S (mp);
   }
-  W;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -12864,6 +12947,7 @@
   unformat_input_t *i = vam->input;
   vl_api_map_rule_dump_t *mp;
   u32 domain_index = ~0;
+  int ret;
 
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
@@ -12893,7 +12977,8 @@
     M (CONTROL_PING, mp);
     S (mp);
   }
-  W;
+  W (ret);
+  return ret;
 }
 
 static void vl_api_map_add_domain_reply_t_handler
@@ -12937,6 +13022,7 @@
   unformat_input_t *i = vam->input;
   u8 *name;
   u8 name_set = 0;
+  int ret;
 
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
@@ -12962,9 +13048,8 @@
   M (GET_FIRST_MSG_ID, mp);
   clib_memcpy (mp->name, name, vec_len (name));
   S (mp);
-  W;
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -12974,6 +13059,7 @@
   vl_api_cop_interface_enable_disable_t *mp;
   u32 sw_if_index = ~0;
   u8 enable_disable = 1;
+  int ret;
 
   while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
     {
@@ -13004,7 +13090,8 @@
   /* send it... */
   S (mp);
   /* Wait for the reply */
-  W;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -13015,6 +13102,7 @@
   u32 sw_if_index = ~0;
   u8 ip4 = 0, ip6 = 0, default_cop = 0;
   u32 fib_id = 0;
+  int ret;
 
   while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
     {
@@ -13052,20 +13140,23 @@
   /* send it... */
   S (mp);
   /* Wait for the reply */
-  W;
+  W (ret);
+  return ret;
 }
 
 static int
 api_get_node_graph (vat_main_t * vam)
 {
   vl_api_get_node_graph_t *mp;
+  int ret;
 
   M (GET_NODE_GRAPH, mp);
 
   /* send it... */
   S (mp);
   /* Wait for the reply */
-  W;
+  W (ret);
+  return ret;
 }
 
 /* *INDENT-OFF* */
@@ -13142,6 +13233,7 @@
   u32 sw_if_index, priority, weight;
   u32 data_len = 0;
 
+  int ret;
   /* Parse args required to build the message */
   while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
     {
@@ -13210,10 +13302,8 @@
   S (mp);
 
   /* Wait for a reply... */
-  W;
-
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -13232,6 +13322,7 @@
   u8 is_add = 1;
   u8 *locator_set_name = NULL;
   u8 locator_set_name_set = 0;
+  int ret;
 
   /* Parse args required to build the message */
   while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
@@ -13324,10 +13415,8 @@
   S (mp);
 
   /* Wait for a reply... */
-  W;
-
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 uword
@@ -13368,6 +13457,7 @@
   u32 vni = 0;
   u16 key_id = 0;
   u8 *key = 0;
+  int ret;
 
   /* Parse args required to build the message */
   while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
@@ -13450,10 +13540,8 @@
   S (mp);
 
   /* Wait for a reply... */
-  W;
-
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 /* *INDENT-OFF* */
@@ -13482,6 +13570,7 @@
   ip6_address_t rmt_rloc6, lcl_rloc6;
   vl_api_lisp_gpe_locator_t *rmt_locs = 0, *lcl_locs = 0, rloc, *curr_rloc =
     0;
+  int ret;
 
   memset (&rloc, 0, sizeof (rloc));
 
@@ -13602,10 +13691,8 @@
   S (mp);
 
   /* Wait for a reply... */
-  W;
-
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -13618,6 +13705,7 @@
   u8 ipv6_set = 0;
   ip4_address_t ipv4;
   ip6_address_t ipv6;
+  int ret;
 
   /* Parse args required to build the message */
   while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
@@ -13669,10 +13757,8 @@
   S (mp);
 
   /* Wait for a reply... */
-  W;
-
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -13685,6 +13771,7 @@
   u8 ipv6_set = 0;
   ip4_address_t ipv4;
   ip6_address_t ipv6;
+  int ret;
 
   /* Parse args required to build the message */
   while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
@@ -13736,10 +13823,8 @@
   S (mp);
 
   /* Wait for a reply... */
-  W;
-
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -13749,6 +13834,7 @@
   vl_api_lisp_gpe_enable_disable_t *mp;
   u8 is_set = 0;
   u8 is_en = 1;
+  int ret;
 
   /* Parse args required to build the message */
   while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
@@ -13782,10 +13868,8 @@
   S (mp);
 
   /* Wait for a reply... */
-  W;
-
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -13795,6 +13879,7 @@
   vl_api_lisp_rloc_probe_enable_disable_t *mp;
   u8 is_set = 0;
   u8 is_en = 0;
+  int ret;
 
   /* Parse args required to build the message */
   while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
@@ -13825,10 +13910,8 @@
   S (mp);
 
   /* Wait for a reply... */
-  W;
-
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -13838,6 +13921,7 @@
   vl_api_lisp_map_register_enable_disable_t *mp;
   u8 is_set = 0;
   u8 is_en = 0;
+  int ret;
 
   /* Parse args required to build the message */
   while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
@@ -13868,10 +13952,8 @@
   S (mp);
 
   /* Wait for a reply... */
-  W;
-
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -13881,6 +13963,7 @@
   vl_api_lisp_enable_disable_t *mp;
   u8 is_set = 0;
   u8 is_en = 0;
+  int ret;
 
   /* Parse args required to build the message */
   while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
@@ -13913,16 +13996,15 @@
   S (mp);
 
   /* Wait for a reply... */
-  W;
-
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static int
 api_show_lisp_map_register_state (vat_main_t * vam)
 {
   vl_api_show_lisp_map_register_state_t *mp;
+  int ret;
 
   M (SHOW_LISP_MAP_REGISTER_STATE, mp);
 
@@ -13930,15 +14012,15 @@
   S (mp);
 
   /* wait for reply */
-  W;
-
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static int
 api_show_lisp_rloc_probe_state (vat_main_t * vam)
 {
   vl_api_show_lisp_rloc_probe_state_t *mp;
+  int ret;
 
   M (SHOW_LISP_RLOC_PROBE_STATE, mp);
 
@@ -13946,15 +14028,15 @@
   S (mp);
 
   /* wait for reply */
-  W;
-
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static int
 api_show_lisp_map_request_mode (vat_main_t * vam)
 {
   vl_api_show_lisp_map_request_mode_t *mp;
+  int ret;
 
   M (SHOW_LISP_MAP_REQUEST_MODE, mp);
 
@@ -13962,9 +14044,8 @@
   S (mp);
 
   /* wait for reply */
-  W;
-
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -13973,6 +14054,7 @@
   unformat_input_t *input = vam->input;
   vl_api_lisp_map_request_mode_t *mp;
   u8 mode = 0;
+  int ret;
 
   /* Parse args required to build the message */
   while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
@@ -13996,10 +14078,8 @@
   S (mp);
 
   /* wait for reply */
-  W;
-
-  /* notreached */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 /**
@@ -14016,6 +14096,7 @@
   vl_api_lisp_pitr_set_locator_set_t *mp;
   u8 is_add = 1;
   u8 *ls_name = 0;
+  int ret;
 
   /* Parse args required to build the message */
   while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
@@ -14047,16 +14128,15 @@
   S (mp);
 
   /* wait for reply */
-  W;
-
-  /* notreached */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static int
 api_show_lisp_pitr (vat_main_t * vam)
 {
   vl_api_show_lisp_pitr_t *mp;
+  int ret;
 
   if (!vam->json_output)
     {
@@ -14068,10 +14148,8 @@
   S (mp);
 
   /* Wait for a reply... */
-  W;
-
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 /**
@@ -14084,6 +14162,7 @@
   vl_api_lisp_eid_table_add_del_map_t *mp;
   u8 is_add = 1, vni_set = 0, vrf_set = 0, bd_index_set = 0;
   u32 vni, vrf, bd_index;
+  int ret;
 
   /* Parse args required to build the message */
   while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
@@ -14123,10 +14202,8 @@
   S (mp);
 
   /* wait for reply */
-  W;
-
-  /* notreached */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 uword
@@ -14177,6 +14254,7 @@
   ip4_address_t rloc4;
   ip6_address_t rloc6;
   vl_api_remote_locator_t *rlocs = 0, rloc, *curr_rloc = 0;
+  int ret;
 
   memset (&rloc, 0, sizeof (rloc));
 
@@ -14277,10 +14355,8 @@
   S (mp);
 
   /* Wait for a reply... */
-  W;
-
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 /**
@@ -14303,6 +14379,7 @@
   u8 reid_type, leid_type;
   u32 leid_len = 0, reid_len = 0, len;
   u8 is_add = 1;
+  int ret;
 
   leid_type = reid_type = (u8) ~ 0;
 
@@ -14404,10 +14481,8 @@
   S (mp);
 
   /* Wait for a reply... */
-  W;
-
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -14417,6 +14492,7 @@
   vl_api_lisp_gpe_add_del_iface_t *mp;
   u8 action_set = 0, is_add = 1, is_l2 = 0, dp_table_set = 0, vni_set = 0;
   u32 dp_table = 0, vni = 0;
+  int ret;
 
   /* Parse args required to build the message */
   while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
@@ -14471,10 +14547,8 @@
   S (mp);
 
   /* Wait for a reply... */
-  W;
-
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 /**
@@ -14491,6 +14565,7 @@
   u8 *locator_set_name = 0;
   u8 locator_set_name_set = 0;
   u8 is_add = 1;
+  int ret;
 
   /* Parse args required to build the message */
   while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
@@ -14540,10 +14615,8 @@
   S (mp);
 
   /* Wait for a reply... */
-  W;
-
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -14554,6 +14627,7 @@
   u8 is_index_set = 0, is_name_set = 0;
   u8 *ls_name = 0;
   u32 ls_index = ~0;
+  int ret;
 
   /* Parse args required to build the message */
   while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
@@ -14618,10 +14692,8 @@
     S (mp);
   }
   /* Wait for a reply... */
-  W;
-
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -14630,6 +14702,7 @@
   vl_api_lisp_locator_set_dump_t *mp;
   unformat_input_t *input = vam->input;
   u8 filter = 0;
+  int ret;
 
   /* Parse args required to build the message */
   while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
@@ -14668,10 +14741,8 @@
     S (mp);
   }
   /* Wait for a reply... */
-  W;
-
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -14681,6 +14752,7 @@
   u8 mode_set = 0;
   unformat_input_t *input = vam->input;
   vl_api_lisp_eid_table_map_dump_t *mp;
+  int ret;
 
   /* Parse args required to build the message */
   while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
@@ -14726,16 +14798,15 @@
     S (mp);
   }
   /* Wait for a reply... */
-  W;
-
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static int
 api_lisp_eid_table_vni_dump (vat_main_t * vam)
 {
   vl_api_lisp_eid_table_vni_dump_t *mp;
+  int ret;
 
   if (!vam->json_output)
     {
@@ -14754,10 +14825,8 @@
     S (mp);
   }
   /* Wait for a reply... */
-  W;
-
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -14771,6 +14840,7 @@
   u8 eid_type = ~0, eid_set = 0;
   u32 prefix_length = ~0, t, vni = 0;
   u8 filter = 0;
+  int ret;
 
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
@@ -14854,10 +14924,8 @@
   }
 
   /* Wait for a reply... */
-  W;
-
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -14867,6 +14935,7 @@
   vl_api_lisp_gpe_fwd_entries_get_t *mp;
   u8 vni_set = 0;
   u32 vni = ~0;
+  int ret;
 
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
@@ -14900,10 +14969,8 @@
   S (mp);
 
   /* Wait for a reply... */
-  W;
-
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 #define vl_api_lisp_gpe_fwd_entries_get_reply_t_endian vl_noop_handler
@@ -14918,6 +14985,7 @@
   vl_api_lisp_adjacencies_get_t *mp;
   u8 vni_set = 0;
   u32 vni = ~0;
+  int ret;
 
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
@@ -14950,16 +15018,15 @@
   S (mp);
 
   /* Wait for a reply... */
-  W;
-
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static int
 api_lisp_map_server_dump (vat_main_t * vam)
 {
   vl_api_lisp_map_server_dump_t *mp;
+  int ret;
 
   if (!vam->json_output)
     {
@@ -14977,16 +15044,15 @@
     S (mp);
   }
   /* Wait for a reply... */
-  W;
-
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static int
 api_lisp_map_resolver_dump (vat_main_t * vam)
 {
   vl_api_lisp_map_resolver_dump_t *mp;
+  int ret;
 
   if (!vam->json_output)
     {
@@ -15004,16 +15070,15 @@
     S (mp);
   }
   /* Wait for a reply... */
-  W;
-
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static int
 api_show_lisp_status (vat_main_t * vam)
 {
   vl_api_show_lisp_status_t *mp;
+  int ret;
 
   if (!vam->json_output)
     {
@@ -15024,10 +15089,8 @@
   /* send it... */
   S (mp);
   /* Wait for a reply... */
-  W;
-
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -15036,6 +15099,7 @@
   vl_api_lisp_gpe_fwd_entry_path_dump_t *mp;
   unformat_input_t *i = vam->input;
   u32 fwd_entry_index = ~0;
+  int ret;
 
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
@@ -15067,16 +15131,15 @@
     S (mp);
   }
   /* Wait for a reply... */
-  W;
-
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static int
 api_lisp_get_map_request_itr_rlocs (vat_main_t * vam)
 {
   vl_api_lisp_get_map_request_itr_rlocs_t *mp;
+  int ret;
 
   if (!vam->json_output)
     {
@@ -15087,10 +15150,8 @@
   /* send it... */
   S (mp);
   /* Wait for a reply... */
-  W;
-
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -15101,6 +15162,7 @@
   u8 *host_if_name = 0;
   u8 hw_addr[6];
   u8 random_hw_addr = 1;
+  int ret;
 
   memset (hw_addr, 0, sizeof (hw_addr));
 
@@ -15134,9 +15196,8 @@
   vec_free (host_if_name);
 
   S (mp);
-  W2 (fprintf (vam->ofp, " new sw_if_index = %d ", vam->sw_if_index));
-  /* NOTREACHED */
-  return 0;
+  W2 (ret, fprintf (vam->ofp, " new sw_if_index = %d ", vam->sw_if_index));
+  return ret;
 }
 
 static int
@@ -15145,6 +15206,7 @@
   unformat_input_t *i = vam->input;
   vl_api_af_packet_delete_t *mp;
   u8 *host_if_name = 0;
+  int ret;
 
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
@@ -15172,9 +15234,8 @@
   vec_free (host_if_name);
 
   S (mp);
-  W;
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -15193,6 +15254,7 @@
   u8 type = 0;
   u8 color_aware = 0;
   sse2_qos_pol_action_params_st conform_action, exceed_action, violate_action;
+  int ret;
 
   conform_action.action_type = SSE2_QOS_ACTION_TRANSMIT;
   conform_action.dscp = 0;
@@ -15271,9 +15333,8 @@
   mp->color_aware = color_aware;
 
   S (mp);
-  W;
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -15283,6 +15344,7 @@
   vl_api_policer_dump_t *mp;
   u8 *match_name = 0;
   u8 match_name_valid = 0;
+  int ret;
 
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
@@ -15309,10 +15371,8 @@
     S (mp);
   }
   /* Wait for a reply... */
-  W;
-
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -15326,6 +15386,7 @@
   u32 ip6_table_index = ~0;
   u32 l2_table_index = ~0;
   u8 is_add = 1;
+  int ret;
 
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
@@ -15363,9 +15424,8 @@
   mp->is_add = is_add;
 
   S (mp);
-  W;
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -15374,6 +15434,7 @@
   unformat_input_t *i = vam->input;
   vl_api_policer_classify_dump_t *mp;
   u8 type = POLICER_CLASSIFY_N_TABLES;
+  int ret;
 
   if (unformat (i, "type %U", unformat_policer_classify_table_type, &type))
     ;
@@ -15400,10 +15461,8 @@
     S (mp);
   }
   /* Wait for a reply... */
-  W;
-
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -15416,6 +15475,7 @@
   u8 random_hw_addr = 1;
   u8 is_pipe = 0;
   u8 is_master = 0;
+  int ret;
 
   memset (hw_addr, 0, sizeof (hw_addr));
 
@@ -15457,9 +15517,8 @@
   vec_free (if_name);
 
   S (mp);
-  W;
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -15468,6 +15527,7 @@
   unformat_input_t *i = vam->input;
   vl_api_netmap_delete_t *mp;
   u8 *if_name = 0;
+  int ret;
 
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
@@ -15495,9 +15555,8 @@
   vec_free (if_name);
 
   S (mp);
-  W;
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static void vl_api_mpls_tunnel_details_t_handler
@@ -15554,6 +15613,7 @@
 {
   vl_api_mpls_tunnel_dump_t *mp;
   i32 index = -1;
+  int ret;
 
   /* Parse args required to build the message */
   while (unformat_check_input (vam->input) != UNFORMAT_END_OF_INPUT)
@@ -15577,7 +15637,8 @@
     M (CONTROL_PING, mp);
     S (mp);
   }
-  W;
+  W (ret);
+  return ret;
 }
 
 #define vl_api_mpls_fib_details_t_endian vl_noop_handler
@@ -15665,6 +15726,7 @@
 api_mpls_fib_dump (vat_main_t * vam)
 {
   vl_api_mpls_fib_dump_t *mp;
+  int ret;
 
   M (MPLS_FIB_DUMP, mp);
   S (mp);
@@ -15675,7 +15737,8 @@
     M (CONTROL_PING, mp);
     S (mp);
   }
-  W;
+  W (ret);
+  return ret;
 }
 
 #define vl_api_ip_fib_details_t_endian vl_noop_handler
@@ -15765,6 +15828,7 @@
 api_ip_fib_dump (vat_main_t * vam)
 {
   vl_api_ip_fib_dump_t *mp;
+  int ret;
 
   M (IP_FIB_DUMP, mp);
   S (mp);
@@ -15775,7 +15839,8 @@
     M (CONTROL_PING, mp);
     S (mp);
   }
-  W;
+  W (ret);
+  return ret;
 }
 
 static void vl_api_ip_neighbor_details_t_handler
@@ -15834,6 +15899,7 @@
   vl_api_ip_neighbor_dump_t *mp;
   u8 is_ipv6 = 0;
   u32 sw_if_index = ~0;
+  int ret;
 
   /* Parse args required to build the message */
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
@@ -15865,7 +15931,8 @@
     M (CONTROL_PING, mp);
     S (mp);
   }
-  W;
+  W (ret);
+  return ret;
 }
 
 #define vl_api_ip6_fib_details_t_endian vl_noop_handler
@@ -15955,6 +16022,7 @@
 api_ip6_fib_dump (vat_main_t * vam)
 {
   vl_api_ip6_fib_dump_t *mp;
+  int ret;
 
   M (IP6_FIB_DUMP, mp);
   S (mp);
@@ -15965,22 +16033,23 @@
     M (CONTROL_PING, mp);
     S (mp);
   }
-  W;
+  W (ret);
+  return ret;
 }
 
 int
 api_classify_table_ids (vat_main_t * vam)
 {
   vl_api_classify_table_ids_t *mp;
+  int ret;
 
   /* Construct the API message */
   M (CLASSIFY_TABLE_IDS, mp);
   mp->context = 0;
 
   S (mp);
-  W;
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 int
@@ -15990,6 +16059,7 @@
   vl_api_classify_table_by_interface_t *mp;
 
   u32 sw_if_index = ~0;
+  int ret;
   while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
     {
       if (unformat (input, "%U", api_unformat_sw_if_index, vam, &sw_if_index))
@@ -16011,9 +16081,8 @@
   mp->sw_if_index = ntohl (sw_if_index);
 
   S (mp);
-  W;
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 int
@@ -16023,6 +16092,7 @@
   vl_api_classify_table_info_t *mp;
 
   u32 table_id = ~0;
+  int ret;
   while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
     {
       if (unformat (input, "table_id %d", &table_id))
@@ -16042,9 +16112,8 @@
   mp->table_id = ntohl (table_id);
 
   S (mp);
-  W;
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 int
@@ -16054,6 +16123,7 @@
   vl_api_classify_session_dump_t *mp;
 
   u32 table_id = ~0;
+  int ret;
   while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
     {
       if (unformat (input, "table_id %d", &table_id))
@@ -16079,9 +16149,8 @@
     M (CONTROL_PING, mp);
     S (mp);
   }
-  W;
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static void
@@ -16135,28 +16204,30 @@
 api_ipfix_exporter_dump (vat_main_t * vam)
 {
   vl_api_ipfix_exporter_dump_t *mp;
+  int ret;
 
   /* Construct the API message */
   M (IPFIX_EXPORTER_DUMP, mp);
   mp->context = 0;
 
   S (mp);
-  W;
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static int
 api_ipfix_classify_stream_dump (vat_main_t * vam)
 {
   vl_api_ipfix_classify_stream_dump_t *mp;
+  int ret;
 
   /* Construct the API message */
   M (IPFIX_CLASSIFY_STREAM_DUMP, mp);
   mp->context = 0;
 
   S (mp);
-  W;
+  W (ret);
+  return ret;
   /* NOTREACHED */
   return 0;
 }
@@ -16193,6 +16264,7 @@
 api_ipfix_classify_table_dump (vat_main_t * vam)
 {
   vl_api_ipfix_classify_table_dump_t *mp;
+  int ret;
 
   if (!vam->json_output)
     {
@@ -16212,7 +16284,8 @@
     M (CONTROL_PING, mp);
     S (mp);
   }
-  W;
+  W (ret);
+  return ret;
 }
 
 static void
@@ -16254,6 +16327,7 @@
   u32 src_sw_if_index = ~0;
   u32 dst_sw_if_index = ~0;
   u8 state = 3;
+  int ret;
 
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
@@ -16287,9 +16361,8 @@
   mp->state = state;
 
   S (mp);
-  W;
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static void
@@ -16377,6 +16450,7 @@
 api_sw_interface_span_dump (vat_main_t * vam)
 {
   vl_api_sw_interface_span_dump_t *mp;
+  int ret;
 
   M (SW_INTERFACE_SPAN_DUMP, mp);
   S (mp);
@@ -16387,7 +16461,8 @@
     M (CONTROL_PING, mp);
     S (mp);
   }
-  W;
+  W (ret);
+  return ret;
 }
 
 int
@@ -16397,6 +16472,7 @@
   vl_api_pg_create_interface_t *mp;
 
   u32 if_id = ~0;
+  int ret;
   while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
     {
       if (unformat (input, "if_id %d", &if_id))
@@ -16416,9 +16492,8 @@
   mp->interface_id = ntohl (if_id);
 
   S (mp);
-  W;
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 int
@@ -16432,6 +16507,7 @@
   u32 count = 1;
   u8 pcap_file_set = 0;
   u8 *pcap_file = 0;
+  int ret;
   while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
     {
       if (unformat (input, "if_id %d", &if_id))
@@ -16474,9 +16550,8 @@
   vec_free (pcap_file);
 
   S (mp);
-  W;
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 int
@@ -16488,6 +16563,7 @@
   u8 enable = 1;
   u8 stream_name_set = 0;
   u8 *stream_name = 0;
+  int ret;
   while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
     {
       if (unformat (input, "stream %s", &stream_name))
@@ -16520,9 +16596,8 @@
   vec_free (stream_name);
 
   S (mp);
-  W;
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 int
@@ -16543,6 +16618,7 @@
   u32 vrf_id = ~0;
   u8 is_add = 1;
   u8 is_ipv6 = 0;
+  int ret;
 
   while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
     {
@@ -16650,9 +16726,8 @@
   mp->vrf_id = ntohl (vrf_id);
 
   S (mp);
-  W;
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 int
@@ -16665,6 +16740,7 @@
   u32 tcp_out_vrf_id = ~0, udp_out_vrf_id = ~0;
   u32 tcp_in_vrf_id = ~0, udp_in_vrf_id = ~0;
   u8 is_add = 1;
+  int ret;
 
   while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
     {
@@ -16720,7 +16796,8 @@
   S (mp);
 
   /* Wait for a reply... */
-  W;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -16733,6 +16810,7 @@
   ip4_address_t src_address;
   ip4_address_t dst_address;
   u8 is_add = 1;
+  int ret;
 
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
@@ -16762,9 +16840,8 @@
   mp->is_add = is_add;
 
   S (mp);
-  W;
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -16776,6 +16853,7 @@
   u32 protocol = ~0;
   u32 port = ~0;
   int is_add = 1;
+  int ret;
 
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
@@ -16802,9 +16880,8 @@
   mp->l4_port = htons ((u16) port);
 
   S (mp);
-  W;
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static void vl_api_ipsec_gre_tunnel_details_t_handler
@@ -16850,6 +16927,7 @@
   vl_api_ipsec_gre_tunnel_dump_t *mp;
   u32 sw_if_index;
   u8 sw_if_index_set = 0;
+  int ret;
 
   /* Parse args required to build the message */
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
@@ -16885,7 +16963,8 @@
     M (CONTROL_PING, mp);
     S (mp);
   }
-  W;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -16894,6 +16973,7 @@
   unformat_input_t *i = vam->input;
   vl_api_delete_subif_t *mp;
   u32 sw_if_index = ~0;
+  int ret;
 
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
@@ -16916,7 +16996,8 @@
   mp->sw_if_index = ntohl (sw_if_index);
 
   S (mp);
-  W;
+  W (ret);
+  return ret;
 }
 
 #define foreach_pbb_vtr_op      \
@@ -16936,6 +17017,7 @@
   u16 vlanid = 0;
   u32 sid = ~0;
   u32 tmp;
+  int ret;
 
   /* Shut up coverity */
   memset (dmac, 0, sizeof (dmac));
@@ -17004,9 +17086,8 @@
   mp->i_sid = ntohl (sid);
 
   S (mp);
-  W;
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -17019,6 +17100,7 @@
   u32 ip4_table_index = ~0;
   u32 ip6_table_index = ~0;
   u8 is_add = 1;
+  int ret;
 
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
@@ -17053,9 +17135,8 @@
   mp->is_add = is_add;
 
   S (mp);
-  W;
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -17064,6 +17145,7 @@
   unformat_input_t *i = vam->input;
   vl_api_flow_classify_dump_t *mp;
   u8 type = FLOW_CLASSIFY_N_TABLES;
+  int ret;
 
   if (unformat (i, "type %U", unformat_flow_classify_table_type, &type))
     ;
@@ -17090,10 +17172,8 @@
     S (mp);
   }
   /* Wait for a reply... */
-  W;
-
-  /* NOTREACHED */
-  return 0;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -17105,6 +17185,7 @@
   u8 *feature_name = 0;
   u32 sw_if_index = ~0;
   u8 enable = 1;
+  int ret;
 
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
@@ -17159,7 +17240,8 @@
   vec_free (feature_name);
 
   S (mp);
-  W;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -17170,6 +17252,7 @@
   u32 sw_if_index = ~0;
   u8 *tag = 0;
   u8 enable = 1;
+  int ret;
 
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
@@ -17206,7 +17289,8 @@
   vec_free (tag);
 
   S (mp);
-  W;
+  W (ret);
+  return ret;
 }
 
 static void vl_api_l2_xconnect_details_t_handler
@@ -17242,6 +17326,7 @@
 api_l2_xconnect_dump (vat_main_t * vam)
 {
   vl_api_l2_xconnect_dump_t *mp;
+  int ret;
 
   if (!vam->json_output)
     {
@@ -17258,7 +17343,8 @@
     M (CONTROL_PING, mp);
     S (mp);
   }
-  W;
+  W (ret);
+  return ret;
 }
 
 static int
@@ -17268,6 +17354,7 @@
   vl_api_sw_interface_set_mtu_t *mp;
   u32 sw_if_index = ~0;
   u32 mtu = 0;
+  int ret;
 
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
@@ -17299,7 +17386,8 @@
   mp->mtu = ntohs ((u16) mtu);
 
   S (mp);
-  W;
+  W (ret);
+  return ret;
 }
 
 
diff --git a/src/vlibapi/vat_helper_macros.h b/src/vlibapi/vat_helper_macros.h
index ffb74fe..5772233 100644
--- a/src/vlibapi/vat_helper_macros.h
+++ b/src/vlibapi/vat_helper_macros.h
@@ -42,32 +42,32 @@
 #define S(mp) (vl_msg_api_send_shmem (vam->vl_input_queue, (u8 *)&mp))
 
 /* W: wait for results, with timeout */
-#define W                                       \
+#define W(ret)					\
 do {                                            \
     f64 timeout = vat_time_now (vam) + 1.0;     \
                                                 \
     while (vat_time_now (vam) < timeout) {      \
         if (vam->result_ready == 1) {           \
-            return (vam->retval);               \
+            ret = vam->retval;                  \
         }                                       \
         vat_suspend (vam->vlib_main, 1e-5);     \
     }                                           \
-    return -99;                                 \
+    ret = -99;                                  \
 } while(0);
 
 /* W2: wait for results, with timeout */
-#define W2(body)                                \
+#define W2(ret, body)				\
 do {                                            \
     f64 timeout = vat_time_now (vam) + 1.0;     \
                                                 \
     while (vat_time_now (vam) < timeout) {      \
         if (vam->result_ready == 1) {           \
 	  (body);                               \
-	  return (vam->retval);                 \
+	  ret = vam->retval;                    \
         }                                       \
         vat_suspend (vam->vlib_main, 1e-5);     \
     }                                           \
-    return -99;                                 \
+    ret = -99;                                 \
 } while(0);
 
 
