summaryrefslogtreecommitdiffstats
path: root/src/plugins/nsh
diff options
context:
space:
mode:
authorDave Barach <dave@barachs.net>2018-10-17 10:38:51 -0400
committerDamjan Marion <dmarion@me.com>2018-10-23 13:06:46 +0000
commitb7b929931a07fbb27b43d5cd105f366c3e29807e (patch)
tree438681c89738802dbb5d339715b96ea2c31bafb4 /src/plugins/nsh
parentb9a4c445c1d4e9cdab476a8e1fb8a46ff0fc6080 (diff)
c11 safe string handling support
Change-Id: Ied34720ca5a6e6e717eea4e86003e854031b6eab Signed-off-by: Dave Barach <dave@barachs.net>
Diffstat (limited to 'src/plugins/nsh')
-rw-r--r--src/plugins/nsh/nsh-md2-ioam/md2_ioam_transit.c2
-rw-r--r--src/plugins/nsh/nsh-md2-ioam/nsh_md2_ioam.c10
-rw-r--r--src/plugins/nsh/nsh-md2-ioam/nsh_md2_ioam_trace.c2
-rw-r--r--src/plugins/nsh/nsh.c26
-rw-r--r--src/plugins/nsh/nsh_test.c4
5 files changed, 22 insertions, 22 deletions
diff --git a/src/plugins/nsh/nsh-md2-ioam/md2_ioam_transit.c b/src/plugins/nsh/nsh-md2-ioam/md2_ioam_transit.c
index 9ea5447eba8..f409aa6f2d0 100644
--- a/src/plugins/nsh/nsh-md2-ioam/md2_ioam_transit.c
+++ b/src/plugins/nsh/nsh-md2-ioam/md2_ioam_transit.c
@@ -128,7 +128,7 @@ nsh_md2_ioam_encap_transit (vlib_main_t * vm,
uword *t = NULL;
nsh_md2_ioam_main_t *hm = &nsh_md2_ioam_main;
fib_prefix_t key4;
- memset (&key4, 0, sizeof (key4));
+ clib_memset (&key4, 0, sizeof (key4));
key4.fp_proto = FIB_PROTOCOL_IP4;
key4.fp_addr.ip4.as_u32 = ip0->dst_address.as_u32;
t = hash_get_mem (hm->dst_by_ip4, &key4);
diff --git a/src/plugins/nsh/nsh-md2-ioam/nsh_md2_ioam.c b/src/plugins/nsh/nsh-md2-ioam/nsh_md2_ioam.c
index 1fa1c55b00f..73b57f64e90 100644
--- a/src/plugins/nsh/nsh-md2-ioam/nsh_md2_ioam.c
+++ b/src/plugins/nsh/nsh-md2-ioam/nsh_md2_ioam.c
@@ -100,12 +100,12 @@ nsh_md2_ioam_enable_disable_for_dest (vlib_main_t * vm,
if (is_ipv4)
{
- memset (&fib_prefix, 0, sizeof (fib_prefix_t));
+ clib_memset (&fib_prefix, 0, sizeof (fib_prefix_t));
fib_prefix.fp_len = 32;
fib_prefix.fp_proto = FIB_PROTOCOL_IP4;
#define TRANSIT_UNIT_TEST_HACK 1
#ifdef TRANSIT_UNIT_TEST_HACK
- memset(&dst_addr, 0, sizeof(dst_addr));
+ clib_memset(&dst_addr, 0, sizeof(dst_addr));
dst_addr.ip4.as_u32 = clib_net_to_host_u32(0x14020102);
#endif
fib_prefix.fp_addr = dst_addr;
@@ -226,7 +226,7 @@ u32 fib_path_get_resolving_interface (fib_node_index_t path_index);
nsh_md2_ioam_dest_tunnels_t *t1;
fib_prefix_t key4, *key4_copy;
hash_pair_t *hp;
- memset (&key4, 0, sizeof (key4));
+ clib_memset (&key4, 0, sizeof (key4));
key4.fp_proto = FIB_PROTOCOL_IP4;
key4.fp_addr.ip4.as_u32 = fib_prefix.fp_addr.ip4.as_u32;
t = hash_get_mem (hm->dst_by_ip4, &key4);
@@ -237,11 +237,11 @@ u32 fib_path_get_resolving_interface (fib_node_index_t path_index);
return 0;
}
pool_get_aligned (hm->dst_tunnels, t1, CLIB_CACHE_LINE_BYTES);
- memset (t1, 0, sizeof (*t1));
+ clib_memset (t1, 0, sizeof (*t1));
t1->fp_proto = FIB_PROTOCOL_IP4;
t1->dst_addr.ip4.as_u32 = fib_prefix.fp_addr.ip4.as_u32;
key4_copy = clib_mem_alloc (sizeof (*key4_copy));
- memset(key4_copy, 0, sizeof(*key4_copy));
+ clib_memset(key4_copy, 0, sizeof(*key4_copy));
clib_memcpy (key4_copy, &key4, sizeof (*key4_copy));
hash_set_mem (hm->dst_by_ip4, key4_copy, t1 - hm->dst_tunnels);
/*
diff --git a/src/plugins/nsh/nsh-md2-ioam/nsh_md2_ioam_trace.c b/src/plugins/nsh/nsh-md2-ioam/nsh_md2_ioam_trace.c
index 1baa2365b15..495bb16aab2 100644
--- a/src/plugins/nsh/nsh-md2-ioam/nsh_md2_ioam_trace.c
+++ b/src/plugins/nsh/nsh-md2-ioam/nsh_md2_ioam_trace.c
@@ -366,7 +366,7 @@ nsh_md2_ioam_trace_init (vlib_main_t * vm)
gm->unix_time_0 = (u32) time (0); /* Store starting time */
gm->vlib_time_0 = vlib_time_now (vm);
- memset (hm->counters, 0, sizeof (hm->counters));
+ clib_memset (hm->counters, 0, sizeof (hm->counters));
if (nsh_md2_register_option
(clib_host_to_net_u16 (0x9),
diff --git a/src/plugins/nsh/nsh.c b/src/plugins/nsh/nsh.c
index ced898c04df..d9b625cda04 100644
--- a/src/plugins/nsh/nsh.c
+++ b/src/plugins/nsh/nsh.c
@@ -154,7 +154,7 @@ nsh_md2_register_option (u16 class,
pool_get_aligned (nm->nsh_option_mappings, nsh_option,
CLIB_CACHE_LINE_BYTES);
- memset (nsh_option, 0, sizeof (*nsh_option));
+ clib_memset (nsh_option, 0, sizeof (*nsh_option));
nsh_option->option_id = nsh_option - nm->nsh_option_mappings;
key_copy = clib_mem_alloc (sizeof (*key_copy));
@@ -527,7 +527,7 @@ nsh_add_del_map (nsh_add_del_map_args_t * a, u32 * map_indexp)
return -1; //TODO API_ERROR_INVALID_VALUE;
pool_get_aligned (nm->nsh_mappings, map, CLIB_CACHE_LINE_BYTES);
- memset (map, 0, sizeof (*map));
+ clib_memset (map, 0, sizeof (*map));
/* copy from arg structure */
map->nsp_nsi = a->map.nsp_nsi;
@@ -614,7 +614,7 @@ nsh_add_del_proxy_session (nsh_add_del_map_args_t * a)
hash_pair_t *hp;
u32 nsp = 0, nsi = 0;
- memset (&key, 0, sizeof (key));
+ clib_memset (&key, 0, sizeof (key));
key.transport_type = a->map.next_node;
key.transport_index = a->map.sw_if_index;
@@ -627,7 +627,7 @@ nsh_add_del_proxy_session (nsh_add_del_map_args_t * a)
return -1; //TODO API_ERROR_INVALID_VALUE;
pool_get_aligned (nm->nsh_proxy_sessions, proxy, CLIB_CACHE_LINE_BYTES);
- memset (proxy, 0, sizeof (*proxy));
+ clib_memset (proxy, 0, sizeof (*proxy));
/* Nsi needs to minus 1 within NSH-Proxy */
nsp = (a->map.nsp_nsi >> NSH_NSP_SHIFT) & NSH_NSP_MASK;
@@ -783,7 +783,7 @@ nsh_add_del_map_command_fn (vlib_main_t * vm,
return clib_error_return (0,
"must specific action: [encap-gre-intf <nn> | encap-vxlan-gpe-intf <nn> | encap-lisp-gpe-intf <nn> | encap-none <tx_sw_if_index> <rx_sw_if_index>]");
- memset (a, 0, sizeof (*a));
+ clib_memset (a, 0, sizeof (*a));
/* set args structure */
a->is_add = is_add;
@@ -933,7 +933,7 @@ nsh_header_rewrite (nsh_entry_t * nsh_entry)
len = MAX_NSH_HEADER_LEN;
}
vec_validate_aligned (rw, len - 1, CLIB_CACHE_LINE_BYTES);
- memset (rw, 0, len);
+ clib_memset (rw, 0, len);
nsh_base = (nsh_base_header_t *) rw;
nsh_base->ver_o_c = nsh_entry->nsh_base.ver_o_c;
@@ -1033,7 +1033,7 @@ nsh_add_del_entry (nsh_add_del_entry_args_t * a, u32 * entry_indexp)
return -1; // TODO VNET_API_ERROR_INVALID_VALUE;
pool_get_aligned (nm->nsh_entries, nsh_entry, CLIB_CACHE_LINE_BYTES);
- memset (nsh_entry, 0, sizeof (*nsh_entry));
+ clib_memset (nsh_entry, 0, sizeof (*nsh_entry));
/* copy from arg structure */
#define _(x) nsh_entry->nsh_base.x = a->nsh_entry.nsh_base.x;
@@ -1185,7 +1185,7 @@ nsh_add_del_entry_command_fn (vlib_main_t * vm,
nsp_nsi = (nsp << 8) | nsi;
- memset (a, 0, sizeof (*a));
+ clib_memset (a, 0, sizeof (*a));
a->is_add = is_add;
if (md_type == 1)
@@ -1318,7 +1318,7 @@ static void send_nsh_entry_details
nsh_main_t *nm = &nsh_main;
rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id = ntohs ((VL_API_NSH_ENTRY_DETAILS) + nm->msg_id_base);
rmp->ver_o_c = t->nsh_base.ver_o_c;
@@ -1391,7 +1391,7 @@ static void send_nsh_map_details
nsh_main_t *nm = &nsh_main;
rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id = ntohs ((VL_API_NSH_MAP_DETAILS) + nm->msg_id_base);
rmp->nsp_nsi = htonl (t->nsp_nsi);
@@ -1784,7 +1784,7 @@ nsh_input_map (vlib_main_t * vm,
}
else
{
- memset (&key0, 0, sizeof (key0));
+ clib_memset (&key0, 0, sizeof (key0));
key0.transport_type = NSH_NODE_NEXT_ENCAP_VXLAN4;
key0.transport_index = vnet_buffer (b0)->sw_if_index[VLIB_RX];
@@ -1949,7 +1949,7 @@ nsh_input_map (vlib_main_t * vm,
}
else
{
- memset (&key1, 0, sizeof (key1));
+ clib_memset (&key1, 0, sizeof (key1));
key1.transport_type = NSH_NODE_NEXT_ENCAP_VXLAN4;
key1.transport_index = vnet_buffer (b1)->sw_if_index[VLIB_RX];
@@ -2151,7 +2151,7 @@ nsh_input_map (vlib_main_t * vm,
}
else
{
- memset (&key0, 0, sizeof (key0));
+ clib_memset (&key0, 0, sizeof (key0));
key0.transport_type = NSH_NODE_NEXT_ENCAP_VXLAN4;
key0.transport_index = vnet_buffer (b0)->sw_if_index[VLIB_RX];
diff --git a/src/plugins/nsh/nsh_test.c b/src/plugins/nsh/nsh_test.c
index 3867289f737..0852956dc3e 100644
--- a/src/plugins/nsh/nsh_test.c
+++ b/src/plugins/nsh/nsh_test.c
@@ -102,7 +102,7 @@ _(NSH_MAP_DETAILS, nsh_map_details)
do { \
vam->result_ready = 0; \
mp = vl_msg_api_alloc(sizeof(*mp)); \
- memset (mp, 0, sizeof (*mp)); \
+ clib_memset (mp, 0, sizeof (*mp)); \
mp->_vl_msg_id = ntohs (VL_API_##T + sm->msg_id_base); \
mp->client_index = vam->my_client_index; \
} while(0);
@@ -111,7 +111,7 @@ do { \
do { \
vam->result_ready = 0; \
mp = vl_msg_api_alloc(sizeof(*mp)+(n)); \
- memset (mp, 0, sizeof (*mp)); \
+ clib_memset (mp, 0, sizeof (*mp)); \
mp->_vl_msg_id = ntohs (VL_API_##T + sm->msg_id_base); \
mp->client_index = vam->my_client_index; \
} while(0);