aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/snat-plugin
diff options
context:
space:
mode:
authorMatus Fabian <matfabia@cisco.com>2016-10-25 04:19:26 -0700
committerOle Trøan <otroan@employees.org>2016-10-31 08:28:39 +0000
commit860dacc3bdda67d493a5f248c28bd193f7870d23 (patch)
treefc4f921fcdc2d9efdd6200a7e4c35a122592bbe5 /plugins/snat-plugin
parent588144ab4552a5f54b692016ff0543decc28d1ea (diff)
VPP-478: SNAT address range overlapping
Ignore adding duplicate address. Change-Id: Icbb76bbcb3a78a18acb1a50d5d8ab777e9f9bd36 Signed-off-by: Matus Fabian <matfabia@cisco.com>
Diffstat (limited to 'plugins/snat-plugin')
-rw-r--r--plugins/snat-plugin/snat/snat.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/plugins/snat-plugin/snat/snat.c b/plugins/snat-plugin/snat/snat.c
index 505f501d250..1a8c93dcf72 100644
--- a/plugins/snat-plugin/snat/snat.c
+++ b/plugins/snat-plugin/snat/snat.c
@@ -202,6 +202,13 @@ void snat_add_address (snat_main_t *sm, ip4_address_t *addr)
{
snat_address_t * ap;
+ /* Check if address already exists */
+ vec_foreach (ap, sm->addresses)
+ {
+ if (ap->addr.as_u32 == addr->as_u32)
+ return;
+ }
+
vec_add2 (sm->addresses, ap, 1);
ap->addr = *addr;