summaryrefslogtreecommitdiffstats
path: root/src/plugins/nat
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/nat
parentb9a4c445c1d4e9cdab476a8e1fb8a46ff0fc6080 (diff)
c11 safe string handling support
Change-Id: Ied34720ca5a6e6e717eea4e86003e854031b6eab Signed-off-by: Dave Barach <dave@barachs.net>
Diffstat (limited to 'src/plugins/nat')
-rw-r--r--src/plugins/nat/dslite_in2out.c4
-rwxr-xr-xsrc/plugins/nat/nat.c10
-rw-r--r--src/plugins/nat/nat44_cli.c4
-rw-r--r--src/plugins/nat/nat64.c4
-rw-r--r--src/plugins/nat/nat64_db.c18
-rw-r--r--src/plugins/nat/nat64_in2out.c18
-rw-r--r--src/plugins/nat/nat64_out2in.c20
-rw-r--r--src/plugins/nat/nat66.c2
-rw-r--r--src/plugins/nat/nat_api.c56
-rw-r--r--src/plugins/nat/nat_det.c2
-rw-r--r--src/plugins/nat/nat_ipfix_logging.c2
-rw-r--r--src/plugins/nat/nat_test.c2
12 files changed, 71 insertions, 71 deletions
diff --git a/src/plugins/nat/dslite_in2out.c b/src/plugins/nat/dslite_in2out.c
index 4eec5958da9..e7a3028f28a 100644
--- a/src/plugins/nat/dslite_in2out.c
+++ b/src/plugins/nat/dslite_in2out.c
@@ -56,7 +56,7 @@ slow_path (dslite_main_t * dm, dslite_session_key_t * in2out_key,
(&dm->per_thread_data[thread_index].b4_hash, &b4_kv, &b4_value))
{
pool_get (dm->per_thread_data[thread_index].b4s, b4);
- memset (b4, 0, sizeof (*b4));
+ clib_memset (b4, 0, sizeof (*b4));
b4->addr.as_u64[0] = in2out_key->softwire_id.as_u64[0];
b4->addr.as_u64[1] = in2out_key->softwire_id.as_u64[1];
@@ -119,7 +119,7 @@ slow_path (dslite_main_t * dm, dslite_session_key_t * in2out_key,
return DSLITE_IN2OUT_NEXT_DROP;
}
pool_get (dm->per_thread_data[thread_index].sessions, s);
- memset (s, 0, sizeof (*s));
+ clib_memset (s, 0, sizeof (*s));
b4->nsessions++;
pool_get (dm->per_thread_data[thread_index].list_pool, elt);
diff --git a/src/plugins/nat/nat.c b/src/plugins/nat/nat.c
index 2ebd6834d92..8115a578e52 100755
--- a/src/plugins/nat/nat.c
+++ b/src/plugins/nat/nat.c
@@ -293,7 +293,7 @@ nat_user_get_or_create (snat_main_t * sm, ip4_address_t * addr, u32 fib_index,
{
/* no, make a new one */
pool_get (tsm->users, u);
- memset (u, 0, sizeof (*u));
+ clib_memset (u, 0, sizeof (*u));
u->addr.as_u32 = addr->as_u32;
u->fib_index = fib_index;
@@ -368,7 +368,7 @@ nat_session_alloc_or_recycle (snat_main_t * sm, snat_user_t * u,
else
{
pool_get (tsm->sessions, s);
- memset (s, 0, sizeof (*s));
+ clib_memset (s, 0, sizeof (*s));
/* Create list elts */
pool_get (tsm->list_pool, per_user_translation_list_elt);
@@ -440,7 +440,7 @@ nat_ed_session_alloc (snat_main_t * sm, snat_user_t * u, u32 thread_index,
else
{
pool_get (tsm->sessions, s);
- memset (s, 0, sizeof (*s));
+ clib_memset (s, 0, sizeof (*s));
/* Create list elts */
pool_get (tsm->list_pool, per_user_translation_list_elt);
@@ -845,7 +845,7 @@ snat_add_static_mapping (ip4_address_t l_addr, ip4_address_t e_addr,
}
pool_get (sm->static_mappings, m);
- memset (m, 0, sizeof (*m));
+ clib_memset (m, 0, sizeof (*m));
m->tag = vec_dup (tag);
m->local_addr = l_addr;
m->external_addr = e_addr;
@@ -1186,7 +1186,7 @@ nat44_add_del_lb_static_mapping (ip4_address_t e_addr, u16 e_port,
}
pool_get (sm->static_mappings, m);
- memset (m, 0, sizeof (*m));
+ clib_memset (m, 0, sizeof (*m));
m->tag = vec_dup (tag);
m->external_addr = e_addr;
m->external_port = e_port;
diff --git a/src/plugins/nat/nat44_cli.c b/src/plugins/nat/nat44_cli.c
index 0a3379acb32..0c5b80c394e 100644
--- a/src/plugins/nat/nat44_cli.c
+++ b/src/plugins/nat/nat44_cli.c
@@ -861,7 +861,7 @@ add_lb_static_mapping_command_fn (vlib_main_t * vm,
if (unformat (line_input, "local %U:%u probability %u",
unformat_ip4_address, &l_addr, &l_port, &probability))
{
- memset (&local, 0, sizeof (local));
+ clib_memset (&local, 0, sizeof (local));
local.addr = l_addr;
local.port = (u16) l_port;
local.probability = (u8) probability;
@@ -871,7 +871,7 @@ add_lb_static_mapping_command_fn (vlib_main_t * vm,
unformat_ip4_address, &l_addr, &l_port, &vrf_id,
&probability))
{
- memset (&local, 0, sizeof (local));
+ clib_memset (&local, 0, sizeof (local));
local.addr = l_addr;
local.port = (u16) l_port;
local.probability = (u8) probability;
diff --git a/src/plugins/nat/nat64.c b/src/plugins/nat/nat64.c
index 8396bd1b76b..86c65edfbee 100644
--- a/src/plugins/nat/nat64.c
+++ b/src/plugins/nat/nat64.c
@@ -157,7 +157,7 @@ nat64_get_worker_out2in (ip4_header_t * ip)
ip46_address_t daddr;
nat64_db_bib_entry_t *bibe;
- memset (&daddr, 0, sizeof (daddr));
+ clib_memset (&daddr, 0, sizeof (daddr));
daddr.ip4.as_u32 = ip->dst_address.as_u32;
/* *INDENT-OFF* */
@@ -687,7 +687,7 @@ nat64_add_del_static_bib_entry (ip6_address_t * in_addr,
foreach_snat_protocol
#undef _
default:
- memset (&addr, 0, sizeof (addr));
+ clib_memset (&addr, 0, sizeof (addr));
addr.ip4.as_u32 = out_addr->as_u32;
if (nat64_db_bib_entry_find (db, &addr, 0, proto, fib_index, 0))
return VNET_API_ERROR_INVALID_VALUE;
diff --git a/src/plugins/nat/nat64_db.c b/src/plugins/nat/nat64_db.c
index 9ff68c80282..bb327a57152 100644
--- a/src/plugins/nat/nat64_db.c
+++ b/src/plugins/nat/nat64_db.c
@@ -86,7 +86,7 @@ nat64_db_bib_entry_create (nat64_db_t * db, ip6_address_t * in_addr,
db->bib.bib_entries_num++;
- memset (bibe, 0, sizeof (*bibe));
+ clib_memset (bibe, 0, sizeof (*bibe));
bibe->in_addr.as_u64[0] = in_addr->as_u64[0];
bibe->in_addr.as_u64[1] = in_addr->as_u64[1];
bibe->in_port = in_port;
@@ -108,7 +108,7 @@ nat64_db_bib_entry_create (nat64_db_t * db, ip6_address_t * in_addr,
kv.key[2] = bibe_key.as_u64[2];
clib_bihash_add_del_24_8 (&db->bib.in2out, &kv, 1);
- memset (&bibe_key.addr, 0, sizeof (bibe_key.addr));
+ clib_memset (&bibe_key.addr, 0, sizeof (bibe_key.addr));
bibe_key.addr.ip4.as_u32 = bibe->out_addr.as_u32;
bibe_key.fib_index = 0;
bibe_key.port = bibe->out_port;
@@ -179,7 +179,7 @@ nat64_db_bib_entry_free (nat64_db_t * db, nat64_db_bib_entry_t * bibe)
kv.key[2] = bibe_key.as_u64[2];
clib_bihash_add_del_24_8 (&db->bib.in2out, &kv, 0);
- memset (&bibe_key.addr, 0, sizeof (bibe_key.addr));
+ clib_memset (&bibe_key.addr, 0, sizeof (bibe_key.addr));
bibe_key.addr.ip4.as_u32 = bibe->out_addr.as_u32;
bibe_key.fib_index = 0;
bibe_key.port = bibe->out_port;
@@ -407,7 +407,7 @@ nat64_db_st_entry_create (nat64_db_t * db, nat64_db_bib_entry_t * bibe,
db->st.st_entries_num++;
- memset (ste, 0, sizeof (*ste));
+ clib_memset (ste, 0, sizeof (*ste));
ste->in_r_addr.as_u64[0] = in_r_addr->as_u64[0];
ste->in_r_addr.as_u64[1] = in_r_addr->as_u64[1];
ste->out_r_addr.as_u32 = out_r_addr->as_u32;
@@ -419,7 +419,7 @@ nat64_db_st_entry_create (nat64_db_t * db, nat64_db_bib_entry_t * bibe,
bibe->ses_num++;
/* create hash lookup */
- memset (&ste_key, 0, sizeof (ste_key));
+ clib_memset (&ste_key, 0, sizeof (ste_key));
ste_key.l_addr.as_u64[0] = bibe->in_addr.as_u64[0];
ste_key.l_addr.as_u64[1] = bibe->in_addr.as_u64[1];
ste_key.r_addr.as_u64[0] = ste->in_r_addr.as_u64[0];
@@ -436,7 +436,7 @@ nat64_db_st_entry_create (nat64_db_t * db, nat64_db_bib_entry_t * bibe,
kv.key[5] = ste_key.as_u64[5];
clib_bihash_add_del_48_8 (&db->st.in2out, &kv, 1);
- memset (&ste_key, 0, sizeof (ste_key));
+ clib_memset (&ste_key, 0, sizeof (ste_key));
ste_key.l_addr.ip4.as_u32 = bibe->out_addr.as_u32;
ste_key.r_addr.ip4.as_u32 = ste->out_r_addr.as_u32;
ste_key.l_port = bibe->out_port;
@@ -491,7 +491,7 @@ nat64_db_st_entry_free (nat64_db_t * db, nat64_db_st_entry_t * ste)
db->st.st_entries_num--;
/* delete hash lookup */
- memset (&ste_key, 0, sizeof (ste_key));
+ clib_memset (&ste_key, 0, sizeof (ste_key));
ste_key.l_addr.as_u64[0] = bibe->in_addr.as_u64[0];
ste_key.l_addr.as_u64[1] = bibe->in_addr.as_u64[1];
ste_key.r_addr.as_u64[0] = ste->in_r_addr.as_u64[0];
@@ -508,7 +508,7 @@ nat64_db_st_entry_free (nat64_db_t * db, nat64_db_st_entry_t * ste)
kv.key[5] = ste_key.as_u64[5];
clib_bihash_add_del_48_8 (&db->st.in2out, &kv, 0);
- memset (&ste_key, 0, sizeof (ste_key));
+ clib_memset (&ste_key, 0, sizeof (ste_key));
ste_key.l_addr.ip4.as_u32 = bibe->out_addr.as_u32;
ste_key.r_addr.ip4.as_u32 = ste->out_r_addr.as_u32;
ste_key.l_port = bibe->out_port;
@@ -565,7 +565,7 @@ nat64_db_st_entry_find (nat64_db_t * db, ip46_address_t * l_addr,
break;
}
- memset (&ste_key, 0, sizeof (ste_key));
+ clib_memset (&ste_key, 0, sizeof (ste_key));
ste_key.l_addr.as_u64[0] = l_addr->as_u64[0];
ste_key.l_addr.as_u64[1] = l_addr->as_u64[1];
ste_key.r_addr.as_u64[0] = r_addr->as_u64[0];
diff --git a/src/plugins/nat/nat64_in2out.c b/src/plugins/nat/nat64_in2out.c
index dc5cc005fd7..d19aab87983 100644
--- a/src/plugins/nat/nat64_in2out.c
+++ b/src/plugins/nat/nat64_in2out.c
@@ -445,9 +445,9 @@ unk_proto_st_walk (nat64_db_st_entry_t * ste, void *arg)
if (ip46_address_is_equal (&bibe->in_addr, &ctx->src_addr)
&& bibe->fib_index == ctx->fib_index)
{
- memset (&saddr, 0, sizeof (saddr));
+ clib_memset (&saddr, 0, sizeof (saddr));
saddr.ip4.as_u32 = bibe->out_addr.as_u32;
- memset (&daddr, 0, sizeof (daddr));
+ clib_memset (&daddr, 0, sizeof (daddr));
nat64_extract_ip4 (&ctx->dst_addr, &daddr.ip4, ctx->fib_index);
if (nat64_db_st_entry_find
@@ -518,7 +518,7 @@ nat64_in2out_unk_proto_set_cb (ip6_header_t * ip6, ip4_header_t * ip4,
nat64_db_st_walk (db, IP_PROTOCOL_UDP, unk_proto_st_walk, &ctx);
/* Verify if out address is not already in use for protocol */
- memset (&addr, 0, sizeof (addr));
+ clib_memset (&addr, 0, sizeof (addr));
addr.ip4.as_u32 = ctx.out_addr.as_u32;
if (nat64_db_bib_entry_find (db, &addr, 0, proto, 0, 0))
ctx.out_addr.as_u32 = 0;
@@ -646,7 +646,7 @@ nat64_in2out_tcp_udp_hairpinning (vlib_main_t * vm, vlib_buffer_t * b,
sport = udp->src_port = bibe->out_port;
nat64_compose_ip6 (&ip6->src_address, &bibe->out_addr, fib_index);
- memset (&daddr, 0, sizeof (daddr));
+ clib_memset (&daddr, 0, sizeof (daddr));
daddr.ip4.as_u32 = ste->out_r_addr.as_u32;
bibe = 0;
@@ -746,8 +746,8 @@ nat64_in2out_icmp_hairpinning (vlib_main_t * vm, vlib_buffer_t * b,
dport = udp->dst_port = bibe->out_port;
nat64_compose_ip6 (&inner_ip6->dst_address, &bibe->out_addr, fib_index);
- memset (&saddr, 0, sizeof (saddr));
- memset (&daddr, 0, sizeof (daddr));
+ clib_memset (&saddr, 0, sizeof (saddr));
+ clib_memset (&daddr, 0, sizeof (daddr));
saddr.ip4.as_u32 = ste->out_r_addr.as_u32;
daddr.ip4.as_u32 = bibe->out_addr.as_u32;
@@ -859,7 +859,7 @@ nat64_in2out_unk_proto_hairpinning (vlib_main_t * vm, vlib_buffer_t * b,
nat64_db_st_walk (db, IP_PROTOCOL_UDP, unk_proto_st_walk, &ctx);
/* Verify if out address is not already in use for protocol */
- memset (&addr, 0, sizeof (addr));
+ clib_memset (&addr, 0, sizeof (addr));
addr.ip4.as_u32 = ctx.out_addr.as_u32;
if (nat64_db_bib_entry_find (db, &addr, 0, proto, 0, 0))
ctx.out_addr.as_u32 = 0;
@@ -896,7 +896,7 @@ nat64_in2out_unk_proto_hairpinning (vlib_main_t * vm, vlib_buffer_t * b,
nat64_compose_ip6 (&ip6->src_address, &bibe->out_addr, fib_index);
- memset (&daddr, 0, sizeof (daddr));
+ clib_memset (&daddr, 0, sizeof (daddr));
daddr.ip4.as_u32 = ste->out_r_addr.as_u32;
bibe = 0;
@@ -1279,7 +1279,7 @@ nat64_in2out_frag_hairpinning (vlib_buffer_t * b, ip6_header_t * ip6,
nat64_compose_ip6 (&ip6->src_address, &bibe->out_addr, bibe->fib_index);
- memset (&daddr, 0, sizeof (daddr));
+ clib_memset (&daddr, 0, sizeof (daddr));
daddr.ip4.as_u32 = ste->out_r_addr.as_u32;
bibe = 0;
diff --git a/src/plugins/nat/nat64_out2in.c b/src/plugins/nat/nat64_out2in.c
index 89bb71c8960..79ff161b326 100644
--- a/src/plugins/nat/nat64_out2in.c
+++ b/src/plugins/nat/nat64_out2in.c
@@ -134,9 +134,9 @@ nat64_out2in_tcp_udp_set_cb (ip4_header_t * ip4, ip6_header_t * ip6,
sw_if_index = vnet_buffer (ctx->b)->sw_if_index[VLIB_RX];
fib_index = ip4_fib_table_get_index_for_sw_if_index (sw_if_index);
- memset (&saddr, 0, sizeof (saddr));
+ clib_memset (&saddr, 0, sizeof (saddr));
saddr.ip4.as_u32 = ip4->src_address.as_u32;
- memset (&daddr, 0, sizeof (daddr));
+ clib_memset (&daddr, 0, sizeof (daddr));
daddr.ip4.as_u32 = ip4->dst_address.as_u32;
ste =
@@ -202,9 +202,9 @@ nat64_out2in_icmp_set_cb (ip4_header_t * ip4, ip6_header_t * ip6, void *arg)
sw_if_index = vnet_buffer (ctx->b)->sw_if_index[VLIB_RX];
fib_index = ip4_fib_table_get_index_for_sw_if_index (sw_if_index);
- memset (&saddr, 0, sizeof (saddr));
+ clib_memset (&saddr, 0, sizeof (saddr));
saddr.ip4.as_u32 = ip4->src_address.as_u32;
- memset (&daddr, 0, sizeof (daddr));
+ clib_memset (&daddr, 0, sizeof (daddr));
daddr.ip4.as_u32 = ip4->dst_address.as_u32;
if (icmp->type == ICMP6_echo_request || icmp->type == ICMP6_echo_reply)
@@ -276,9 +276,9 @@ nat64_out2in_inner_icmp_set_cb (ip4_header_t * ip4, ip6_header_t * ip6,
fib_index =
fib_table_get_index_for_sw_if_index (FIB_PROTOCOL_IP6, sw_if_index);
- memset (&saddr, 0, sizeof (saddr));
+ clib_memset (&saddr, 0, sizeof (saddr));
saddr.ip4.as_u32 = ip4->src_address.as_u32;
- memset (&daddr, 0, sizeof (daddr));
+ clib_memset (&daddr, 0, sizeof (daddr));
daddr.ip4.as_u32 = ip4->dst_address.as_u32;
if (proto == IP_PROTOCOL_ICMP6)
@@ -368,9 +368,9 @@ nat64_out2in_unk_proto_set_cb (ip4_header_t * ip4, ip6_header_t * ip6,
sw_if_index = vnet_buffer (ctx->b)->sw_if_index[VLIB_RX];
fib_index = ip4_fib_table_get_index_for_sw_if_index (sw_if_index);
- memset (&saddr, 0, sizeof (saddr));
+ clib_memset (&saddr, 0, sizeof (saddr));
saddr.ip4.as_u32 = ip4->src_address.as_u32;
- memset (&daddr, 0, sizeof (daddr));
+ clib_memset (&daddr, 0, sizeof (daddr));
daddr.ip4.as_u32 = ip4->dst_address.as_u32;
ste =
@@ -738,9 +738,9 @@ nat64_out2in_reass_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
{
ctx0.first_frag = 1;
- memset (&saddr0, 0, sizeof (saddr0));
+ clib_memset (&saddr0, 0, sizeof (saddr0));
saddr0.ip4.as_u32 = ip40->src_address.as_u32;
- memset (&daddr0, 0, sizeof (daddr0));
+ clib_memset (&daddr0, 0, sizeof (daddr0));
daddr0.ip4.as_u32 = ip40->dst_address.as_u32;
ste0 =
diff --git a/src/plugins/nat/nat66.c b/src/plugins/nat/nat66.c
index 729674171d7..a0f6ec7929a 100644
--- a/src/plugins/nat/nat66.c
+++ b/src/plugins/nat/nat66.c
@@ -165,7 +165,7 @@ nat66_static_mapping_add_del (ip6_address_t * l_addr, ip6_address_t * e_addr,
fib_index = fib_table_find_or_create_and_lock (FIB_PROTOCOL_IP6, vrf_id,
FIB_SOURCE_PLUGIN_HI);
pool_get (nm->sm, sm);
- memset (sm, 0, sizeof (*sm));
+ clib_memset (sm, 0, sizeof (*sm));
sm->l_addr.as_u64[0] = l_addr->as_u64[0];
sm->l_addr.as_u64[1] = l_addr->as_u64[1];
sm->e_addr.as_u64[0] = e_addr->as_u64[0];
diff --git a/src/plugins/nat/nat_api.c b/src/plugins/nat/nat_api.c
index 4727826049b..378e7abe871 100644
--- a/src/plugins/nat/nat_api.c
+++ b/src/plugins/nat/nat_api.c
@@ -202,7 +202,7 @@ send_nat_worker_details (u32 worker_index, vl_api_registration_t * reg,
vlib_worker_threads + worker_index + sm->first_worker_index;
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_NAT_WORKER_DETAILS + sm->msg_id_base);
rmp->context = context;
rmp->worker_index = htonl (worker_index);
@@ -350,7 +350,7 @@ nat_ip4_reass_walk_api (nat_reass_ip4_t * reass, void *arg)
nat_api_walk_ctx_t *ctx = arg;
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_NAT_REASS_DETAILS + sm->msg_id_base);
rmp->context = ctx->context;
clib_memcpy (rmp->src_addr, &(reass->key.src), 4);
@@ -373,7 +373,7 @@ nat_ip6_reass_walk_api (nat_reass_ip6_t * reass, void *arg)
nat_api_walk_ctx_t *ctx = arg;
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_NAT_REASS_DETAILS + sm->msg_id_base);
rmp->context = ctx->context;
clib_memcpy (rmp->src_addr, &(reass->key.src), 16);
@@ -718,7 +718,7 @@ send_nat44_address_details (snat_address_t * a,
snat_main_t *sm = &snat_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_NAT44_ADDRESS_DETAILS + sm->msg_id_base);
clib_memcpy (rmp->ip_address, &(a->addr), 4);
if (a->fib_index != ~0)
@@ -807,7 +807,7 @@ send_nat44_interface_details (snat_interface_t * i,
snat_main_t *sm = &snat_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_NAT44_INTERFACE_DETAILS + sm->msg_id_base);
rmp->sw_if_index = ntohl (i->sw_if_index);
rmp->is_inside = (nat_interface_is_inside (i)
@@ -896,7 +896,7 @@ send_nat44_interface_output_feature_details (snat_interface_t * i,
snat_main_t *sm = &snat_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_NAT44_INTERFACE_OUTPUT_FEATURE_DETAILS + sm->msg_id_base);
rmp->sw_if_index = ntohl (i->sw_if_index);
@@ -1024,7 +1024,7 @@ send_nat44_static_mapping_details (snat_static_mapping_t * m,
snat_main_t *sm = &snat_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_NAT44_STATIC_MAPPING_DETAILS + sm->msg_id_base);
rmp->addr_only = is_addr_only_static_mapping (m);
@@ -1059,7 +1059,7 @@ send_nat44_static_map_resolve_details (snat_static_map_resolve_t * m,
snat_main_t *sm = &snat_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_NAT44_STATIC_MAPPING_DETAILS + sm->msg_id_base);
rmp->addr_only = m->addr_only;
@@ -1198,7 +1198,7 @@ send_nat44_identity_mapping_details (snat_static_mapping_t * m, int index,
snat_main_t *sm = &snat_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_NAT44_IDENTITY_MAPPING_DETAILS + sm->msg_id_base);
rmp->addr_only = is_addr_only_static_mapping (m);
@@ -1223,7 +1223,7 @@ send_nat44_identity_map_resolve_details (snat_static_map_resolve_t * m,
snat_main_t *sm = &snat_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_NAT44_IDENTITY_MAPPING_DETAILS + sm->msg_id_base);
rmp->addr_only = m->addr_only;
@@ -1331,7 +1331,7 @@ send_nat44_interface_addr_details (u32 sw_if_index,
snat_main_t *sm = &snat_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_NAT44_INTERFACE_ADDR_DETAILS + sm->msg_id_base);
rmp->sw_if_index = ntohl (sw_if_index);
@@ -1384,7 +1384,7 @@ send_nat44_user_details (snat_user_t * u, vl_api_registration_t * reg,
ip4_main_t *im = &ip4_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_NAT44_USER_DETAILS + sm->msg_id_base);
if (!pool_is_free_index (im->fibs, u->fib_index))
@@ -1445,7 +1445,7 @@ send_nat44_user_session_details (snat_session_t * s,
snat_main_t *sm = &snat_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_NAT44_USER_SESSION_DETAILS + sm->msg_id_base);
clib_memcpy (rmp->outside_ip_address, (&s->out2in.addr), 4);
@@ -1564,7 +1564,7 @@ unformat_nat44_lb_addr_port (vl_api_nat44_lb_addr_port_t * addr_port_pairs,
for (i = 0; i < addr_port_pair_num; i++)
{
ap = &addr_port_pairs[i];
- memset (&lb_addr_port, 0, sizeof (lb_addr_port));
+ clib_memset (&lb_addr_port, 0, sizeof (lb_addr_port));
clib_memcpy (&lb_addr_port.addr, ap->addr, 4);
lb_addr_port.port = clib_net_to_host_u16 (ap->port);
lb_addr_port.probability = ap->probability;
@@ -1644,7 +1644,7 @@ send_nat44_lb_static_mapping_details (snat_static_mapping_t * m,
rmp =
vl_msg_api_alloc (sizeof (*rmp) +
(vec_len (m->locals) * sizeof (nat44_lb_addr_port_t)));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id =
ntohs (VL_API_NAT44_LB_STATIC_MAPPING_DETAILS + sm->msg_id_base);
@@ -1825,7 +1825,7 @@ static void
return;
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_NAT44_FORWARDING_IS_ENABLED_REPLY + sm->msg_id_base);
rmp->context = mp->context;
@@ -1982,7 +1982,7 @@ send_reply:
REPLY_MACRO2 (VL_API_NAT_DET_REVERSE_REPLY,
({
rmp->is_nat44 = 1;
- memset (rmp->in_addr, 0, 16);
+ clib_memset (rmp->in_addr, 0, 16);
clib_memcpy (rmp->in_addr, &in_addr, 4);
}))
/* *INDENT-ON* */
@@ -2008,7 +2008,7 @@ sent_nat_det_map_details (snat_det_map_t * m, vl_api_registration_t * reg,
snat_main_t *sm = &snat_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_NAT_DET_MAP_DETAILS + sm->msg_id_base);
rmp->is_nat44 = 1;
clib_memcpy (rmp->in_addr, &m->in_addr, 4);
@@ -2179,7 +2179,7 @@ send_nat_det_session_details (snat_det_session_t * s,
snat_main_t *sm = &snat_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_NAT_DET_SESSION_DETAILS + sm->msg_id_base);
rmp->in_port = s->in_port;
clib_memcpy (rmp->ext_addr, &s->out.ext_host_addr, 4);
@@ -2211,7 +2211,7 @@ vl_api_nat_det_session_dump_t_handler (vl_api_nat_det_session_dump_t * mp)
if (!mp->is_nat44)
return;
- memset (&empty_ses, 0, sizeof (empty_ses));
+ clib_memset (&empty_ses, 0, sizeof (empty_ses));
clib_memcpy (&user_addr, mp->user_addr, 4);
dm = snat_det_map_by_user (sm, &user_addr);
if (!dm)
@@ -2307,7 +2307,7 @@ nat64_api_pool_walk (snat_address_t * a, void *arg)
nat64_api_walk_ctx_t *ctx = arg;
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_NAT64_POOL_ADDR_DETAILS + sm->msg_id_base);
clib_memcpy (rmp->address, &(a->addr), 4);
if (a->fib_index != ~0)
@@ -2395,7 +2395,7 @@ nat64_api_interface_walk (snat_interface_t * i, void *arg)
nat64_api_walk_ctx_t *ctx = arg;
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_NAT64_INTERFACE_DETAILS + sm->msg_id_base);
rmp->sw_if_index = ntohl (i->sw_if_index);
rmp->is_inside = (nat_interface_is_inside (i)
@@ -2489,7 +2489,7 @@ nat64_api_bib_walk (nat64_db_bib_entry_t * bibe, void *arg)
return -1;
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_NAT64_BIB_DETAILS + sm->msg_id_base);
rmp->context = ctx->context;
clib_memcpy (rmp->i_addr, &(bibe->in_addr), 16);
@@ -2556,7 +2556,7 @@ nat64_api_st_walk (nat64_db_st_entry_t * ste, void *arg)
return -1;
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_NAT64_ST_DETAILS + sm->msg_id_base);
rmp->context = ctx->context;
clib_memcpy (rmp->il_addr, &(bibe->in_addr), 16);
@@ -2646,7 +2646,7 @@ nat64_api_prefix_walk (nat64_prefix_t * p, void *arg)
nat64_api_walk_ctx_t *ctx = arg;
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_NAT64_PREFIX_DETAILS + sm->msg_id_base);
clib_memcpy (rmp->prefix, &(p->prefix), 16);
rmp->prefix_len = p->plen;
@@ -2887,7 +2887,7 @@ send_dslite_address_details (snat_address_t * ap,
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_DSLITE_ADDRESS_DETAILS + sm->msg_id_base);
clib_memcpy (rmp->ip_address, &(ap->addr), 4);
@@ -3025,7 +3025,7 @@ nat66_api_interface_walk (snat_interface_t * i, void *arg)
nat66_api_walk_ctx_t *ctx = arg;
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_NAT66_INTERFACE_DETAILS + sm->msg_id_base);
rmp->sw_if_index = ntohl (i->sw_if_index);
rmp->is_inside = nat_interface_is_inside (i);
@@ -3081,7 +3081,7 @@ nat66_api_static_mapping_walk (nat66_static_mapping_t * m, void *arg)
vlib_get_combined_counter (&nm->session_counters, m - nm->sm, &vc);
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_NAT66_STATIC_MAPPING_DETAILS + sm->msg_id_base);
clib_memcpy (rmp->local_ip_address, &m->l_addr, 16);
diff --git a/src/plugins/nat/nat_det.c b/src/plugins/nat/nat_det.c
index 1b00d40b4ae..0ab96dc1026 100644
--- a/src/plugins/nat/nat_det.c
+++ b/src/plugins/nat/nat_det.c
@@ -72,7 +72,7 @@ snat_det_add_map (snat_main_t * sm, ip4_address_t * in_addr, u8 in_plen,
if (is_add)
{
pool_get (sm->det_maps, det_map);
- memset (det_map, 0, sizeof (*det_map));
+ clib_memset (det_map, 0, sizeof (*det_map));
det_map->in_addr.as_u32 = in_cmp.as_u32;
det_map->in_plen = in_plen;
det_map->out_addr.as_u32 = out_cmp.as_u32;
diff --git a/src/plugins/nat/nat_ipfix_logging.c b/src/plugins/nat/nat_ipfix_logging.c
index b2c167096aa..8a3668e2759 100644
--- a/src/plugins/nat/nat_ipfix_logging.c
+++ b/src/plugins/nat/nat_ipfix_logging.c
@@ -1929,7 +1929,7 @@ snat_ipfix_logging_enable_disable (int enable, u32 domain_id, u16 src_port)
silm->enabled = e;
- memset (&a, 0, sizeof (a));
+ clib_memset (&a, 0, sizeof (a));
a.is_add = enable;
a.domain_id = domain_id ? domain_id : 1;
a.src_port = src_port ? src_port : UDP_DST_PORT_ipfix;
diff --git a/src/plugins/nat/nat_test.c b/src/plugins/nat/nat_test.c
index 0a2896b9848..b1de5340b9d 100644
--- a/src/plugins/nat/nat_test.c
+++ b/src/plugins/nat/nat_test.c
@@ -707,7 +707,7 @@ static int api_nat44_user_session_dump(vat_main_t * vam)
/* Use a control ping for synchronization */
M(NAT_CONTROL_PING, mp_ping);
- memset(mp->ip_address, 0, 16);
+ clib_memset(mp->ip_address, 0, 16);
clib_memcpy(mp->ip_address, &addr, 4);
mp->vrf_id = htonl(vrf_id);
S(mp_ping);