summaryrefslogtreecommitdiffstats
path: root/extras/strongswan
diff options
context:
space:
mode:
Diffstat (limited to 'extras/strongswan')
-rw-r--r--extras/strongswan/vpp_sswan/kernel_vpp_ipsec.c8
-rw-r--r--extras/strongswan/vpp_sswan/kernel_vpp_net.c27
-rw-r--r--extras/strongswan/vpp_sswan/kernel_vpp_shared.h8
3 files changed, 27 insertions, 16 deletions
diff --git a/extras/strongswan/vpp_sswan/kernel_vpp_ipsec.c b/extras/strongswan/vpp_sswan/kernel_vpp_ipsec.c
index a48bd573938..325a3d13c91 100644
--- a/extras/strongswan/vpp_sswan/kernel_vpp_ipsec.c
+++ b/extras/strongswan/vpp_sswan/kernel_vpp_ipsec.c
@@ -62,14 +62,6 @@
#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;
/**
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)
{
diff --git a/extras/strongswan/vpp_sswan/kernel_vpp_shared.h b/extras/strongswan/vpp_sswan/kernel_vpp_shared.h
index c699d4925f3..7e8d2035c56 100644
--- a/extras/strongswan/vpp_sswan/kernel_vpp_shared.h
+++ b/extras/strongswan/vpp_sswan/kernel_vpp_shared.h
@@ -15,6 +15,14 @@
* 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;
/**