From 35ffa3e8f6b032f6e324234d495f769049d8feea Mon Sep 17 00:00:00 2001 From: Jon Loeliger Date: Thu, 28 Sep 2017 13:54:16 -0500 Subject: Propagate duplicate IF addr add/del error up to API. Identify and complain when the same IP prefix is assigned to two different SW interfaces: vpp# set int ip address TenGigabitEthernet6/0/0 1.2.3.4/32 vpp# set int ip address TenGigabitEthernet6/0/1 1.2.3.4/32 set interface ip address: Prefix 1.2.3.4/32 already found on interface TenGigabitEthernet6/0/0 Change-Id: I1aee1b6a7ddd00d3109a53d8e1b6ce97bf45e372 Signed-off-by: Jon Loeliger --- src/vnet/ip/lookup.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) mode change 100755 => 100644 src/vnet/ip/lookup.c (limited to 'src/vnet/ip/lookup.c') diff --git a/src/vnet/ip/lookup.c b/src/vnet/ip/lookup.c old mode 100755 new mode 100644 index d9922f46453..856c4942ea4 --- a/src/vnet/ip/lookup.c +++ b/src/vnet/ip/lookup.c @@ -165,11 +165,21 @@ ip_interface_address_add_del (ip_lookup_main_t * lm, } else { + if (sw_if_index != a->sw_if_index) + { + if (result_if_address_index) + *result_if_address_index = ~0; + vnm->api_errno = VNET_API_ERROR_DUPLICATE_IF_ADDRESS; + return clib_error_create + ("Prefix %U already found on interface %U", + lm->format_address_and_length, addr_fib, address_length, + format_vnet_sw_if_index_name, vnm, a->sw_if_index); + } + if (result_if_address_index) *result_if_address_index = a - lm->if_address_pool; } - return /* no error */ 0; } -- cgit 1.2.3-korg