root@ac15b50ac370:/# /usr/local/vpp20/bin/vppctl _______ _ _ _____ ___ __/ __/ _ \ (_)__ | | / / _ \/ _ \ _/ _// // / / / _ \ | |/ / ___/ ___/ /_/ /____(_)_/\___/ |___/_/ /_/
DBGvpp# create tap tap0 DBGvpp# create tap tap1 DBGvpp# set interface ip addr tap0 1.1.1.1/24 DBGvpp# set interface ip addr del tap1 1.1.1.1/24 /usr/local/vpp20/bin/vpp[17762]: /work/vpp/src/vnet/ip/ip4_forward.c:656 (ip4_sw_interface_enable_disable) assertion `im->ip_enabled_by_sw_if_index[sw_if_index] > 0' fails /usr/local/vpp20/bin/vpp[17762]: received signal SIGWINCH, PC 0x7f9c3421899d /usr/local/vpp20/bin/vpp[17762]: #0 0x00007f9c34ad7ca8 unix_signal_handler + 0x26f /usr/local/vpp20/bin/vpp[17762]: #1 0x00007f9c347fd890 0x7f9c347fd890 /usr/local/vpp20/bin/vpp[17762]: #2 0x00007f9c34135e97 gsignal + 0xc7 /usr/local/vpp20/bin/vpp[17762]: #3 0x00007f9c34137801 abort + 0x141 /usr/local/vpp20/bin/vpp[17762]: #4 0x0000556ba0b8641a 0x556ba0b8641a /usr/local/vpp20/bin/vpp[17762]: #5 0x00007f9c3451ae02 debugger + 0x9 /usr/local/vpp20/bin/vpp[17762]: #6 0x00007f9c3451b1e5 _clib_error + 0x2d4 /usr/local/vpp20/bin/vpp[17762]: #7 0x00007f9c3526bf3b ip4_sw_interface_enable_disable + 0x1ad /usr/local/vpp20/bin/vpp[17762]: #8 0x00007f9c3526cda7 ip4_add_del_interface_address_internal + 0xd6c /usr/local/vpp20/bin/vpp[17762]: #9 0x00007f9c3526d077 ip4_add_del_interface_address + 0x36 /usr/local/vpp20/bin/vpp[17762]: #10 0x00007f9c352555ba add_del_ip_address + 0x157 /usr/local/vpp20/bin/vpp[17762]: #11 0x00007f9c34a2ad2e vlib_cli_dispatch_sub_commands + 0xc41 /usr/local/vpp20/bin/vpp[17762]: #12 0x00007f9c34a2abac vlib_cli_dispatch_sub_commands + 0xabf /usr/local/vpp20/bin/vpp[17762]: #13 0x00007f9c34a2abac vlib_cli_dispatch_sub_commands + 0xabf /usr/local/vpp20/bin/vpp[17762]: #14 0x00007f9c34a2abac vlib_cli_dispatch_sub_commands + 0xabf git diff 1d61c2 diff --git a/src/vnet/ip/ip4_forward.c b/src/vnet/ip/ip4_forward.c index ea78d5507..5d8be3621 100644 --- a/src/vnet/ip/ip4_forward.c +++ b/src/vnet/ip/ip4_forward.c @@ -779,7 +779,10 @@ ip4_add_del_interface_address_internal (vlib_main_t * vm, goto done; } - ip_interface_address_del (lm, if_address_index, addr_fib); + error = ip_interface_address_del (lm, if_address_index, addr_fib, + address_length, sw_if_index); + if (error) + goto done; } else { diff --git a/src/vnet/ip/ip6_forward.c b/src/vnet/ip/ip6_forward.c index 1d6c1b7f1..6b596dc69 100644 --- a/src/vnet/ip/ip6_forward.c +++ b/src/vnet/ip/ip6_forward.c @@ -428,7 +428,10 @@ ip6_add_del_interface_address (vlib_main_t * vm, goto done; } - ip_interface_address_del (lm, if_address_index, addr_fib); + error = ip_interface_address_del (lm, if_address_index, addr_fib, + address_length, sw_if_index); + if (error) + goto done; } else { diff --git a/src/vnet/ip/ip_interface.c b/src/vnet/ip/ip_interface.c index 23c3df816..c6181ec68 100644 --- a/src/vnet/ip/ip_interface.c +++ b/src/vnet/ip/ip_interface.c @@ -90,14 +90,22 @@ ip_interface_address_add (ip_lookup_main_t * lm, return (NULL); } -void +clib_error_t * ip_interface_address_del (ip_lookup_main_t * lm, - u32 address_index, void *addr_fib) + u32 address_index, void *addr_fib, u32 address_length, + u32 sw_if_index) { ip_interface_address_t *a, *prev, *next; a = pool_elt_at_index (lm->if_address_pool, address_index); + if (a->sw_if_index != sw_if_index) { + return clib_error_create ("%U not found for interface %U", + lm->format_address_and_length, + addr_fib, address_length, + format_vnet_sw_if_index_name, + vnet_get_main (), sw_if_index); + } if (a->prev_this_sw_interface != ~0) { prev = pool_elt_at_index (lm->if_address_pool, @@ -121,6 +129,7 @@ ip_interface_address_del (ip_lookup_main_t * lm, mhash_unset (&lm->address_to_if_address_index, addr_fib, /* old_value */ 0); pool_put (lm->if_address_pool, a); + return NULL; } u8 diff --git a/src/vnet/ip/ip_interface.h b/src/vnet/ip/ip_interface.h index f95b8deb0..95393381c 100644 --- a/src/vnet/ip/ip_interface.h +++ b/src/vnet/ip/ip_interface.h @@ -28,8 +28,9 @@ clib_error_t *ip_interface_address_add (ip_lookup_main_t * lm, void *address, u32 address_length, u32 * result_index); -void ip_interface_address_del (ip_lookup_main_t * lm, - u32 addr_index, void *address); +clib_error_t *ip_interface_address_del (ip_lookup_main_t * lm, + u32 addr_index, void *address, u32 address_len, + u32 sw_if_index); void *ip_interface_get_first_ip (u32 sw_if_index, u8 is_ip4); void ip_interface_address_mark (void); void ip_interface_address_sweep (void); Best, Ye Donggang y...@wangsu.com +86-15345978478
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#16357): https://lists.fd.io/g/vpp-dev/message/16357 Mute This Topic: https://lists.fd.io/mt/74182356/21656 Group Owner: vpp-dev+ow...@lists.fd.io Unsubscribe: https://lists.fd.io/g/vpp-dev/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-