diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/vnet/ipsec/ipsec_api.c | 13 | ||||
-rw-r--r-- | src/vnet/ipsec/ipsec_cli.c | 7 |
2 files changed, 12 insertions, 8 deletions
diff --git a/src/vnet/ipsec/ipsec_api.c b/src/vnet/ipsec/ipsec_api.c index b1b6db7e290..a959ac643ec 100644 --- a/src/vnet/ipsec/ipsec_api.c +++ b/src/vnet/ipsec/ipsec_api.c @@ -842,17 +842,24 @@ vl_api_ipsec_tunnel_if_add_del_t_handler (vl_api_ipsec_tunnel_if_add_del_t * } else { - + /* *INDENT-OFF* */ ipip_tunnel_key_t key = { .transport = transport, .fib_index = fib_index, .src = local_ip, .dst = remote_ip }; + /* *INDENT-ON* */ + ipip_tunnel_t *t = ipip_tunnel_db_find (&key); - rv = ipsec_tun_protect_del (t->sw_if_index); - ipip_del_tunnel (t->sw_if_index); + if (NULL != t) + { + rv = ipsec_tun_protect_del (t->sw_if_index); + ipip_del_tunnel (t->sw_if_index); + } + else + rv = VNET_API_ERROR_NO_SUCH_ENTRY; } #else diff --git a/src/vnet/ipsec/ipsec_cli.c b/src/vnet/ipsec/ipsec_cli.c index 630e60a43ec..5385a0f15c8 100644 --- a/src/vnet/ipsec/ipsec_cli.c +++ b/src/vnet/ipsec/ipsec_cli.c @@ -869,11 +869,8 @@ create_ipsec_tunnel_command_fn (vlib_main_t * vm, case 0: break; case VNET_API_ERROR_INVALID_VALUE: - if (is_add) - error = clib_error_return (0, - "IPSec tunnel interface already exists..."); - else - error = clib_error_return (0, "IPSec tunnel interface not exists..."); + error = clib_error_return (0, + "IPSec tunnel interface already exists..."); goto done; default: error = clib_error_return (0, "ipsec_register_interface returned %d", |