VPP-478: SNAT address range overlapping

Ignore adding duplicate address.

Change-Id: Icbb76bbcb3a78a18acb1a50d5d8ab777e9f9bd36
Signed-off-by: Matus Fabian <matfabia@cisco.com>
This commit is contained in:
Matus Fabian
2016-10-25 04:19:26 -07:00
committed by Ole Trøan
parent 588144ab45
commit 860dacc3bd

View File

@ -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;