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
This commit is contained in:

committed by
Fan Zhang

parent
efd2350d65
commit
0e1fe7ba86
@ -62,14 +62,6 @@
|
|||||||
|
|
||||||
#define PRIO_BASE 384
|
#define PRIO_BASE 384
|
||||||
|
|
||||||
/**
|
|
||||||
* Every 2 seconds, the thread responsible for collecting the available
|
|
||||||
* interfaces will be executed.
|
|
||||||
* Retrying 5 times every 1 second ensures that there is enough time to check
|
|
||||||
* if the interface will be available.
|
|
||||||
*/
|
|
||||||
#define N_RETRY_GET_IF 5
|
|
||||||
|
|
||||||
u32 natt_port;
|
u32 natt_port;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -159,6 +159,8 @@ manage_route (private_kernel_vpp_net_t *this, bool add, chunk_t dst,
|
|||||||
vl_api_fib_path_t *apath;
|
vl_api_fib_path_t *apath;
|
||||||
bool exists = FALSE;
|
bool exists = FALSE;
|
||||||
|
|
||||||
|
for (int i = 0; i < N_RETRY_GET_IF; i++)
|
||||||
|
{
|
||||||
this->mutex->lock (this->mutex);
|
this->mutex->lock (this->mutex);
|
||||||
enumerator = this->ifaces->create_enumerator (this->ifaces);
|
enumerator = this->ifaces->create_enumerator (this->ifaces);
|
||||||
while (enumerator->enumerate (enumerator, &entry))
|
while (enumerator->enumerate (enumerator, &entry))
|
||||||
@ -172,6 +174,15 @@ manage_route (private_kernel_vpp_net_t *this, bool add, chunk_t dst,
|
|||||||
enumerator->destroy (enumerator);
|
enumerator->destroy (enumerator);
|
||||||
this->mutex->unlock (this->mutex);
|
this->mutex->unlock (this->mutex);
|
||||||
|
|
||||||
|
if (!exists)
|
||||||
|
{
|
||||||
|
DBG1 (DBG_NET, "if_name %s not found", name);
|
||||||
|
sleep (1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (!exists)
|
if (!exists)
|
||||||
{
|
{
|
||||||
DBG1 (DBG_NET, "if_name %s not found", name);
|
DBG1 (DBG_NET, "if_name %s not found", name);
|
||||||
|
@ -15,6 +15,14 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Every 2 seconds, the thread responsible for collecting the available
|
||||||
|
* interfaces will be executed.
|
||||||
|
* Retrying 5 times every 1 second ensures that there is enough time to check
|
||||||
|
* if the interface will be available.
|
||||||
|
*/
|
||||||
|
#define N_RETRY_GET_IF 5
|
||||||
|
|
||||||
typedef struct vac_t vac_t;
|
typedef struct vac_t vac_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user