diff options
author | Gabriel Oginski <gabrielx.oginski@intel.com> | 2023-07-14 07:22:12 +0000 |
---|---|---|
committer | Fan Zhang <fanzhang.oss@gmail.com> | 2023-07-19 02:38:00 +0000 |
commit | 0e1fe7ba86ccb0ab43a9a7452fe601abc23f16ce (patch) | |
tree | b10dc9d8ea17f15398148f558ff20c9d10d3b723 /extras/strongswan/vpp_sswan/kernel_vpp_net.c | |
parent | efd2350d65f6d344c0dc5134a208fd8b57f14c33 (diff) |
vpp-swan: change flow in function for add route
This patch addresses the issue when the list of available interfaces
is not up to date. Due to this issue adding a new route fails
and finally the connection is not established.
Type: fix
Signed-off-by: Gabriel Oginski <gabrielx.oginski@intel.com>
Change-Id: I3a63c0dd99ebc28ea149b4b23867440937682761
Diffstat (limited to 'extras/strongswan/vpp_sswan/kernel_vpp_net.c')
-rw-r--r-- | extras/strongswan/vpp_sswan/kernel_vpp_net.c | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/extras/strongswan/vpp_sswan/kernel_vpp_net.c b/extras/strongswan/vpp_sswan/kernel_vpp_net.c index 85e2768450d..82eea1794f6 100644 --- a/extras/strongswan/vpp_sswan/kernel_vpp_net.c +++ b/extras/strongswan/vpp_sswan/kernel_vpp_net.c @@ -159,18 +159,29 @@ manage_route (private_kernel_vpp_net_t *this, bool add, chunk_t dst, vl_api_fib_path_t *apath; bool exists = FALSE; - this->mutex->lock (this->mutex); - enumerator = this->ifaces->create_enumerator (this->ifaces); - while (enumerator->enumerate (enumerator, &entry)) + for (int i = 0; i < N_RETRY_GET_IF; i++) { - if (streq (name, entry->if_name)) + this->mutex->lock (this->mutex); + enumerator = this->ifaces->create_enumerator (this->ifaces); + while (enumerator->enumerate (enumerator, &entry)) { - exists = TRUE; - break; + if (streq (name, entry->if_name)) + { + exists = TRUE; + break; + } } + enumerator->destroy (enumerator); + this->mutex->unlock (this->mutex); + + if (!exists) + { + DBG1 (DBG_NET, "if_name %s not found", name); + sleep (1); + } + else + break; } - enumerator->destroy (enumerator); - this->mutex->unlock (this->mutex); if (!exists) { |