aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Brunner <tobias@strongswan.org>2017-08-28 19:12:16 +0200
committerTobias Brunner <tobias@strongswan.org>2017-09-26 09:33:46 +0200
commit039b85dd43b56e9a07958fc0e269a7182143b408 (patch)
tree8105b9f41c6d61c89f558abf81b2284d165c8741
parentab7d5e32d3f7fb1138f6eacec87081a886fc0c16 (diff)
downloadstrongswan-039b85dd43b56e9a07958fc0e269a7182143b408.tar.bz2
strongswan-039b85dd43b56e9a07958fc0e269a7182143b408.tar.xz
kernel-pfroute: Delay call to if_indextoname(3) when handling RTM_IFINFO
It seems that there is a race, at least in 10.13, that lets if_indextoname() fail for the new TUN device. So we delay the call a bit, which seems to "fix" the issue. It's strange anyway that the previous delay was only applied when an iface entry was already found.
-rw-r--r--src/libcharon/plugins/kernel_pfroute/kernel_pfroute_net.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/libcharon/plugins/kernel_pfroute/kernel_pfroute_net.c b/src/libcharon/plugins/kernel_pfroute/kernel_pfroute_net.c
index da7ae472d..e1f10e93f 100644
--- a/src/libcharon/plugins/kernel_pfroute/kernel_pfroute_net.c
+++ b/src/libcharon/plugins/kernel_pfroute/kernel_pfroute_net.c
@@ -864,6 +864,11 @@ static void process_link(private_kernel_pfroute_net_t *this,
.flags = msg->ifm_flags,
.addrs = linked_list_create(),
);
+#ifdef __APPLE__
+ /* Similar to the issue described above, on 10.13 we need this delay as
+ * we might otherwise not be able to convert the index to a name yet. */
+ usleep(50000);
+#endif
if (if_indextoname(iface->ifindex, iface->ifname))
{
DBG1(DBG_KNL, "interface %s appeared", iface->ifname);