aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatus Fabian <matfabia@cisco.com>2018-03-07 03:17:57 -0800
committerDamjan Marion <dmarion.lists@gmail.com>2018-03-14 16:41:24 +0000
commit9449a8acbabf47a7e12fcf63fbfab026866e3eef (patch)
tree2839a9d3a0a2ad1b1396e46a8062b2fbd00208cd
parent308ed5c9e3aea3f4d0689ad293952c3978d296ce (diff)
NAT44: allow to configure one interface only as output or input feature (VPP-1192)
following is not possible: set interface nat44 out GigabitEthernet0/3/0 output-feature set interface nat44 out GigabitEthernet0/3/0 Change-Id: I1592cc18390881fda66f98316700886b8f5295f0 Signed-off-by: Matus Fabian <matfabia@cisco.com> (cherry picked from commit e4e34c23fe7050c26967997fdb8f555c51fd3961)
-rw-r--r--src/plugins/nat/nat.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/plugins/nat/nat.c b/src/plugins/nat/nat.c
index 1ba3b378785..a3a104f6ae7 100644
--- a/src/plugins/nat/nat.c
+++ b/src/plugins/nat/nat.c
@@ -1351,6 +1351,12 @@ int snat_interface_add_del (u32 sw_if_index, u8 is_inside, int is_del)
snat_static_mapping_t * m;
snat_det_map_t * dm;
+ pool_foreach (i, sm->output_feature_interfaces,
+ ({
+ if (i->sw_if_index == sw_if_index)
+ return VNET_API_ERROR_VALUE_EXIST;
+ }));
+
if (sm->static_mapping_only && !(sm->static_mapping_connection_tracking))
feature_name = is_inside ? "nat44-in2out-fast" : "nat44-out2in-fast";
else
@@ -1491,6 +1497,12 @@ int snat_interface_add_del_output_feature (u32 sw_if_index,
(sm->static_mapping_only && !(sm->static_mapping_connection_tracking)))
return VNET_API_ERROR_UNSUPPORTED;
+ pool_foreach (i, sm->interfaces,
+ ({
+ if (i->sw_if_index == sw_if_index)
+ return VNET_API_ERROR_VALUE_EXIST;
+ }));
+
if (is_inside)
{
vnet_feature_enable_disable ("ip4-unicast", "nat44-hairpin-dst",