aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorJon Loeliger <jdl@netgate.com>2017-02-01 12:31:41 -0600
committerDave Barach <openvpp@barachs.net>2017-02-02 17:32:27 +0000
commit56c7b01e163c233030359781d7e60f4553e90c51 (patch)
tree6d6ce1f179fdbfa2c2919ac082984fd0bf426f7f /src/plugins
parent1f9191f6efa5f2e0284c194f920093201b27ef81 (diff)
Refactor fragile msg macro W and W2 to not burry return control flow.
Instead, have them accept and assign a return paramter leaving the return control flow up to the caller. Clean up otherwise misleading returns present even after "NOT REACHED" comments. Change-Id: I0861921f73ab65d55b95eabd27514f0129152723 Signed-off-by: Jon Loeliger <jdl@netgate.com>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/acl/acl_test.c52
-rw-r--r--src/plugins/flowperpkt/flowperpkt_test.c4
-rw-r--r--src/plugins/ioam/export-vxlan-gpe/vxlan_gpe_ioam_export_test.c4
-rw-r--r--src/plugins/ioam/export/ioam_export_test.c4
-rw-r--r--src/plugins/ioam/lib-pot/pot_test.c18
-rw-r--r--src/plugins/ioam/lib-trace/trace_test.c17
-rw-r--r--src/plugins/ioam/lib-vxlan-gpe/vxlan_gpe_test.c36
-rw-r--r--src/plugins/lb/lb_test.c19
-rw-r--r--src/plugins/snat/snat_test.c74
9 files changed, 129 insertions, 99 deletions
diff --git a/src/plugins/acl/acl_test.c b/src/plugins/acl/acl_test.c
index 39d7e1c4..23dc6bc0 100644
--- a/src/plugins/acl/acl_test.c
+++ b/src/plugins/acl/acl_test.c
@@ -267,6 +267,7 @@ static int api_acl_plugin_get_version (vat_main_t * vam)
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 @@ static int api_acl_plugin_get_version (vat_main_t * vam)
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 @@ static int api_macip_acl_interface_get (vat_main_t * vam)
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 @@ static int api_macip_acl_interface_get (vat_main_t * vam)
S(mp);
/* Wait for a reply... */
- W;
-
- return 0;
+ W (ret);
+ return ret;
}
#define vec_validate_acl_rules(v, idx) \
@@ -335,6 +335,7 @@ static int api_acl_add_replace (vat_main_t * vam)
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 @@ static int api_acl_add_replace (vat_main_t * vam)
S(mp);
/* Wait for a reply... */
- W;
+ W (ret);
+ return ret;
}
static int api_acl_del (vat_main_t * vam)
@@ -487,6 +489,7 @@ static int api_acl_del (vat_main_t * vam)
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 @@ static int api_acl_del (vat_main_t * vam)
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 @@ static int api_macip_acl_del (vat_main_t * vam)
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 @@ static int api_macip_acl_del (vat_main_t * vam)
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 @@ static int api_acl_interface_add_del (vat_main_t * vam)
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 @@ static int api_acl_interface_add_del (vat_main_t * vam)
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 @@ static int api_macip_acl_interface_add_del (vat_main_t * vam)
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 @@ static int api_macip_acl_interface_add_del (vat_main_t * vam)
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 @@ static int api_acl_interface_set_acl_list (vat_main_t * vam)
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 @@ static int api_acl_interface_set_acl_list (vat_main_t * vam)
S(mp);
/* Wait for a reply... */
- W;
+ W (ret);
+ return ret;
}
@@ -703,6 +715,7 @@ static int api_acl_interface_list_dump (vat_main_t * vam)
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 @@ static int api_acl_interface_list_dump (vat_main_t * vam)
S(mp);
/* Wait for a reply... */
- W;
+ W (ret);
+ return ret;
}
static int api_acl_dump (vat_main_t * vam)
@@ -730,6 +744,7 @@ static int api_acl_dump (vat_main_t * vam)
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 @@ static int api_acl_dump (vat_main_t * vam)
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 @@ static int api_macip_acl_dump (vat_main_t * vam)
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 @@ static int api_macip_acl_dump (vat_main_t * vam)
S(mp);
/* Wait for a reply... */
- W;
+ W (ret);
+ return ret;
}
#define vec_validate_macip_acl_rules(v, idx) \
@@ -801,6 +819,7 @@ static int api_macip_acl_add (vat_main_t * vam)
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 @@ static int api_macip_acl_add (vat_main_t * vam)
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 4cc1cfb7..972a3b07 100644
--- a/src/plugins/flowperpkt/flowperpkt_test.c
+++ b/src/plugins/flowperpkt/flowperpkt_test.c
@@ -99,6 +99,7 @@ api_flowperpkt_tx_interface_add_del (vat_main_t * vam)
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 @@ api_flowperpkt_tx_interface_add_del (vat_main_t * vam)
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 a7938219..17d31c95 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 @@ api_vxlan_gpe_ioam_export_enable_disable (vat_main_t * vam)
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 @@ api_vxlan_gpe_ioam_export_enable_disable (vat_main_t * vam)
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 2cb036a5..5023afd7 100644
--- a/src/plugins/ioam/export/ioam_export_test.c
+++ b/src/plugins/ioam/export/ioam_export_test.c
@@ -96,6 +96,7 @@ api_ioam_export_ip6_enable_disable (vat_main_t * vam)
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 @@ api_ioam_export_ip6_enable_disable (vat_main_t * vam)
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 d896eb2f..1c6dd02d 100644
--- a/src/plugins/ioam/lib-pot/pot_test.c
+++ b/src/plugins/ioam/lib-pot/pot_test.c
@@ -134,6 +134,7 @@ static int api_pot_profile_add (vat_main_t *vam)
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 @@ static int api_pot_profile_add (vat_main_t *vam)
mp->max_bits = bits;
S(mp);
- W;
+ W (ret);
+ return ret;
OUT:
vec_free(name);
@@ -203,6 +205,7 @@ static int api_pot_profile_activate (vat_main_t *vam)
u8 *name = NULL;
u8 id = 0;
int rv = 0;
+ int ret;
while (unformat_check_input(input) != UNFORMAT_END_OF_INPUT)
{
@@ -228,7 +231,8 @@ static int api_pot_profile_activate (vat_main_t *vam)
mp->id = id;
S(mp);
- W;
+ W (ret);
+ return ret;
OUT:
vec_free(name);
@@ -239,12 +243,13 @@ OUT:
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 @@ static int api_pot_profile_show_config_dump (vat_main_t *vam)
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 @@ static int api_pot_profile_show_config_dump (vat_main_t *vam)
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 d1fb7205..1e287dee 100644
--- a/src/plugins/ioam/lib-trace/trace_test.c
+++ b/src/plugins/ioam/lib-trace/trace_test.c
@@ -125,10 +125,10 @@ api_trace_profile_add (vat_main_t * vam)
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 @@ api_trace_profile_add (vat_main_t * vam)
mp->num_elts = num_elts;
S (mp);
- W;
-
- return (rv);
+ W (ret);
+ return ret;
}
@@ -168,22 +167,24 @@ static int
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 3e7300f5..80e65644 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 @@ api_vxlan_gpe_ioam_enable (vat_main_t * vam)
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 @@ api_vxlan_gpe_ioam_enable (vat_main_t * vam)
S (mp);
- W;
-
- return (0);
+ W (ret);
+ return ret;
}
@@ -142,11 +142,12 @@ static int
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 @@ api_vxlan_gpe_ioam_vni_enable (vat_main_t * vam)
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 @@ api_vxlan_gpe_ioam_vni_enable (vat_main_t * vam)
mp->is_ipv6 = ipv6_set;
S (mp);
- W;
-
- return (0);
+ W (ret);
+ return ret;
}
static int
@@ -255,6 +256,7 @@ api_vxlan_gpe_ioam_vni_disable (vat_main_t * vam)
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 @@ api_vxlan_gpe_ioam_vni_disable (vat_main_t * vam)
mp->is_ipv6 = ipv6_set;
S (mp);
- W;
-
- return 0;
+ W (ret);
+ return ret;
}
static int
@@ -347,6 +348,7 @@ api_vxlan_gpe_ioam_transit_enable (vat_main_t * vam)
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 @@ api_vxlan_gpe_ioam_transit_enable (vat_main_t * vam)
mp->is_ipv6 = ipv6_set;
S (mp);
- W;
-
- return (0);
+ W (ret);
+ return ret;
}
static int
@@ -416,6 +417,7 @@ api_vxlan_gpe_ioam_transit_disable (vat_main_t * vam)
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 @@ api_vxlan_gpe_ioam_transit_disable (vat_main_t * vam)
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 a811079e..9b30c18d 100644
--- a/src/plugins/lb/lb_test.c
+++ b/src/plugins/lb/lb_test.c
@@ -134,6 +134,7 @@ static int api_lb_conf (vat_main_t * vam)
{
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 @@ static int api_lb_conf (vat_main_t * vam)
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 @@ static int api_lb_add_del_vip (vat_main_t * vam)
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 @@ static int api_lb_add_del_as (vat_main_t * vam)
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 8bab00c1..086059a3 100644
--- a/src/plugins/snat/snat_test.c
+++ b/src/plugins/snat/snat_test.c
@@ -114,6 +114,7 @@ static int api_snat_add_address_range (vat_main_t * vam)
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 @@ static int api_snat_add_address_range (vat_main_t * vam)
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 @@ static int api_snat_interface_add_del_feature (vat_main_t * vam)
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 @@ static int api_snat_interface_add_del_feature (vat_main_t * vam)
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 @@ static int api_snat_add_static_mapping(vat_main_t * vam)
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 @@ static int api_snat_add_static_mapping(vat_main_t * vam)
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 void vl_api_snat_static_mapping_details_t_handler
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 @@ static int api_snat_static_mapping_dump(vat_main_t * vam)
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 void vl_api_snat_show_config_reply_t_handler
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 @@ static int api_snat_show_config(vat_main_t * vam)
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 void vl_api_snat_address_details_t_handler
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 @@ static int api_snat_address_dump(vat_main_t * vam)
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 void vl_api_snat_interface_details_t_handler
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 @@ static int api_snat_interface_dump(vat_main_t * vam)
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 @@ static int api_snat_set_workers (vat_main_t * vam)
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 @@ static int api_snat_set_workers (vat_main_t * vam)
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 void vl_api_snat_worker_details_t_handler
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 @@ static int api_snat_worker_dump(vat_main_t * vam)
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 @@ static int api_snat_ipfix_enable_disable (vat_main_t * vam)
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 @@ static int api_snat_ipfix_enable_disable (vat_main_t * vam)
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 void vl_api_snat_interface_addr_details_t_handler
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 @@ static int api_snat_interface_addr_dump(vat_main_t * vam)
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 @@ static int api_snat_add_del_interface_addr (vat_main_t * vam)
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 @@ static int api_snat_add_del_interface_addr (vat_main_t * vam)
mp->enable = enable;
S(mp);
- W;
- /* NOTREACHED */
- return 0;
+ W (ret);
+ return ret;
}
/*