0
0
mirror of https://github.com/OpenVPN/openvpn.git synced 2024-09-20 12:02:28 +02:00

For Mac OSX, when DARWIN_USE_IPCONFIG is defined, retry ipconfig

command on failure once every second for up to 15 seconds.  This
is necessary to work around an issue observed on OSX 10.5 where
the ipconfig command sometimes fails if executed immediately after
the tun device open.


git-svn-id: http://svn.openvpn.net/projects/openvpn/branches/BETA21/openvpn@7151 e7ae566f-a301-0410-adde-c780ea21d3b5
This commit is contained in:
James Yonan 2011-04-12 05:14:34 +00:00 committed by David Sommerseth
parent 28c8776b65
commit e51935df0e

12
tun.c
View File

@ -801,7 +801,17 @@ do_ifconfig (struct tuntap *tt,
); );
} }
argv_msg (M_INFO, &argv); argv_msg (M_INFO, &argv);
openvpn_execve_check (&argv, es, S_FATAL, "Mac OS X ipconfig failed"); {
int i;
const int n = 15;
for (i = 1; i <= n; ++i) /* OSX 10.5 needs retry */
{
if (openvpn_execve_check (&argv, es, (i == n) ? S_FATAL : 0, "Mac OS X ipconfig failed"))
break;
msg (M_INFO, "Retry #%d", i);
openvpn_sleep(1);
}
}
tt->did_ifconfig = true; tt->did_ifconfig = true;
#else #else
/* /*