aboutsummaryrefslogtreecommitdiffstats
path: root/src/vlibapi/api_shared.c
diff options
context:
space:
mode:
authorDave Barach <dave@barachs.net>2019-07-01 09:42:41 -0400
committerFlorin Coras <florin.coras@gmail.com>2019-07-02 15:29:36 +0000
commit9683c1eceb8529ef5133670efd4a465eb5a740c8 (patch)
tree084eaa6660dbb3c02b48a910dbecc5e56824065e /src/vlibapi/api_shared.c
parent3c0d84c989e9928d5ca9ffe3aceb826864bd525a (diff)
api: fix coverity warnings
New coverity toolset, new set of squawks to fix Ticket: VPP-1649 Type: fix Change-Id: I2a7e4c42b101c6c79c01b150b2523ce3d5d62354 Signed-off-by: Dave Barach <dave@barachs.net>
Diffstat (limited to 'src/vlibapi/api_shared.c')
-rw-r--r--src/vlibapi/api_shared.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/vlibapi/api_shared.c b/src/vlibapi/api_shared.c
index a9e037c8365..9579fe1c60f 100644
--- a/src/vlibapi/api_shared.c
+++ b/src/vlibapi/api_shared.c
@@ -70,7 +70,7 @@ vl_msg_api_trace (api_main_t * am, vl_api_trace_t * tp, void *msg)
u8 *msg_copy;
u32 length;
trace_cfg_t *cfgp;
- u16 msg_id = ntohs (*((u16 *) msg));
+ u16 msg_id = clib_net_to_host_u16 (*((u16 *) msg));
msgbuf_t *header = (msgbuf_t *) (((u8 *) msg) - offsetof (msgbuf_t, data));
cfgp = am->api_trace_cfg + msg_id;
@@ -395,7 +395,7 @@ always_inline void
msg_handler_internal (api_main_t * am,
void *the_msg, int trace_it, int do_it, int free_it)
{
- u16 id = ntohs (*((u16 *) the_msg));
+ u16 id = clib_net_to_host_u16 (*((u16 *) the_msg));
u8 *(*print_fp) (void *, void *);
if (id < vec_len (am->msg_handlers) && am->msg_handlers[id])
@@ -466,7 +466,7 @@ vl_msg_api_handler_with_vm_node (api_main_t * am,
void *the_msg, vlib_main_t * vm,
vlib_node_runtime_t * node)
{
- u16 id = ntohs (*((u16 *) the_msg));
+ u16 id = clib_net_to_host_u16 (*((u16 *) the_msg));
u8 *(*handler) (void *, void *, void *);
u8 *(*print_fp) (void *, void *);
int is_mp_safe = 1;
@@ -617,7 +617,7 @@ void
vl_msg_api_cleanup_handler (void *the_msg)
{
api_main_t *am = &api_main;
- u16 id = ntohs (*((u16 *) the_msg));
+ u16 id = clib_net_to_host_u16 (*((u16 *) the_msg));
if (PREDICT_FALSE (id >= vec_len (am->msg_cleanup_handlers)))
{
@@ -638,7 +638,7 @@ vl_msg_api_replay_handler (void *the_msg)
{
api_main_t *am = &api_main;
- u16 id = ntohs (*((u16 *) the_msg));
+ u16 id = clib_net_to_host_u16 (*((u16 *) the_msg));
if (PREDICT_FALSE (id >= vec_len (am->msg_handlers)))
{
@@ -1019,7 +1019,7 @@ vl_api_from_api_string (vl_api_string_t * astr)
u32
vl_api_string_len (vl_api_string_t * astr)
{
- return ntohl (astr->length);
+ return clib_net_to_host_u32 (astr->length);
}
/*
@@ -1029,7 +1029,7 @@ u8 *
vl_api_from_api_to_vec (vl_api_string_t * astr)
{
u8 *v = 0;
- vec_add (v, astr->buf, ntohl (astr->length));
+ vec_add (v, astr->buf, clib_net_to_host_u32 (astr->length));
return v;
}