From 860dacc3bdda67d493a5f248c28bd193f7870d23 Mon Sep 17 00:00:00 2001 From: Matus Fabian Date: Tue, 25 Oct 2016 04:19:26 -0700 Subject: VPP-478: SNAT address range overlapping Ignore adding duplicate address. Change-Id: Icbb76bbcb3a78a18acb1a50d5d8ab777e9f9bd36 Signed-off-by: Matus Fabian --- plugins/snat-plugin/snat/snat.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'plugins') diff --git a/plugins/snat-plugin/snat/snat.c b/plugins/snat-plugin/snat/snat.c index 505f501d..1a8c93dc 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; -- cgit 1.2.3-korg