summaryrefslogtreecommitdiffstats
path: root/src/plugins/snat/snat_api.c
diff options
context:
space:
mode:
authorMatus Fabian <matfabia@cisco.com>2017-06-19 05:28:27 -0700
committerOle Trøan <otroan@employees.org>2017-06-19 19:21:15 +0000
commit08ce432ce9727c7e099ea6c4630e4e6ebbecc92a (patch)
tree98f77344c4a82d6471243072cd3c9b72d9186b9e /src/plugins/snat/snat_api.c
parent45ca2c7a9c0835e1b5d5641ca230f720b49e8cf4 (diff)
NAT64: change not supported multi threading behaviour
Disable CLI/API commands instead of error message on startup. Change-Id: I313ed6e2ea009f573afb5e08b0e85ed1f9091dc3 Signed-off-by: Matus Fabian <matfabia@cisco.com>
Diffstat (limited to 'src/plugins/snat/snat_api.c')
-rw-r--r--src/plugins/snat/snat_api.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/src/plugins/snat/snat_api.c b/src/plugins/snat/snat_api.c
index 383df39958b..aa0b59ac4a0 100644
--- a/src/plugins/snat/snat_api.c
+++ b/src/plugins/snat/snat_api.c
@@ -1210,6 +1210,7 @@ static void
{
vl_api_nat64_add_del_pool_addr_range_reply_t *rmp;
snat_main_t *sm = &snat_main;
+ nat64_main_t *nm = &nat64_main;
int rv = 0;
ip4_address_t this_addr;
u32 start_host_order, end_host_order;
@@ -1217,6 +1218,12 @@ static void
int i, count;
u32 *tmp;
+ if (nm->is_disabled)
+ {
+ rv = VNET_API_ERROR_FEATURE_DISABLED;
+ goto send_reply;
+ }
+
tmp = (u32 *) mp->start_addr;
start_host_order = clib_host_to_net_u32 (tmp[0]);
tmp = (u32 *) mp->end_addr;
@@ -1291,6 +1298,10 @@ static void
vl_api_nat64_pool_addr_dump_t_handler (vl_api_nat64_pool_addr_dump_t * mp)
{
unix_shared_memory_queue_t *q;
+ nat64_main_t *nm = &nat64_main;
+
+ if (nm->is_disabled)
+ return;
q = vl_api_client_index_to_input_queue (mp->client_index);
if (q == 0)
@@ -1320,9 +1331,16 @@ vl_api_nat64_add_del_interface_t_handler (vl_api_nat64_add_del_interface_t *
mp)
{
snat_main_t *sm = &snat_main;
+ nat64_main_t *nm = &nat64_main;
vl_api_nat64_add_del_interface_reply_t *rmp;
int rv = 0;
+ if (nm->is_disabled)
+ {
+ rv = VNET_API_ERROR_FEATURE_DISABLED;
+ goto send_reply;
+ }
+
VALIDATE_SW_IF_INDEX (mp);
rv =
@@ -1331,6 +1349,7 @@ vl_api_nat64_add_del_interface_t_handler (vl_api_nat64_add_del_interface_t *
BAD_SW_IF_INDEX_LABEL;
+send_reply:
REPLY_MACRO (VL_API_NAT64_ADD_DEL_INTERFACE_REPLY);
}
@@ -1371,6 +1390,10 @@ static void
vl_api_nat64_interface_dump_t_handler (vl_api_nat64_interface_dump_t * mp)
{
unix_shared_memory_queue_t *q;
+ nat64_main_t *nm = &nat64_main;
+
+ if (nm->is_disabled)
+ return;
q = vl_api_client_index_to_input_queue (mp->client_index);
if (q == 0)
@@ -1400,11 +1423,18 @@ static void
(vl_api_nat64_add_del_static_bib_t * mp)
{
snat_main_t *sm = &snat_main;
+ nat64_main_t *nm = &nat64_main;
vl_api_nat64_add_del_static_bib_reply_t *rmp;
ip6_address_t in_addr;
ip4_address_t out_addr;
int rv = 0;
+ if (nm->is_disabled)
+ {
+ rv = VNET_API_ERROR_FEATURE_DISABLED;
+ goto send_reply;
+ }
+
memcpy (&in_addr.as_u8, mp->i_addr, 16);
memcpy (&out_addr.as_u8, mp->o_addr, 4);
@@ -1416,6 +1446,7 @@ static void
clib_net_to_host_u32 (mp->vrf_id),
mp->is_add);
+send_reply:
REPLY_MACRO (VL_API_NAT64_ADD_DEL_STATIC_BIB_REPLY);
}
@@ -1472,6 +1503,9 @@ vl_api_nat64_bib_dump_t_handler (vl_api_nat64_bib_dump_t * mp)
nat64_main_t *nm = &nat64_main;
snat_protocol_t proto;
+ if (nm->is_disabled)
+ return;
+
q = vl_api_client_index_to_input_queue (mp->client_index);
if (q == 0)
return;
@@ -1500,9 +1534,16 @@ static void
vl_api_nat64_set_timeouts_t_handler (vl_api_nat64_set_timeouts_t * mp)
{
snat_main_t *sm = &snat_main;
+ nat64_main_t *nm = &nat64_main;
vl_api_nat64_set_timeouts_reply_t *rmp;
int rv = 0;
+ if (nm->is_disabled)
+ {
+ rv = VNET_API_ERROR_FEATURE_DISABLED;
+ goto send_reply;
+ }
+
rv = nat64_set_icmp_timeout (ntohl (mp->icmp));
if (rv)
goto send_reply;
@@ -1536,9 +1577,13 @@ static void
vl_api_nat64_get_timeouts_t_handler (vl_api_nat64_get_timeouts_t * mp)
{
snat_main_t *sm = &snat_main;
+ nat64_main_t *nm = &nat64_main;
vl_api_nat64_get_timeouts_reply_t *rmp;
int rv = 0;
+ if (nm->is_disabled)
+ return;
+
/* *INDENT-OFF* */
REPLY_MACRO2 (VL_API_NAT64_GET_TIMEOUTS_REPLY,
({
@@ -1605,6 +1650,9 @@ vl_api_nat64_st_dump_t_handler (vl_api_nat64_st_dump_t * mp)
nat64_main_t *nm = &nat64_main;
snat_protocol_t proto;
+ if (nm->is_disabled)
+ return;
+
q = vl_api_client_index_to_input_queue (mp->client_index);
if (q == 0)
return;