summaryrefslogtreecommitdiffstats
path: root/tun.c
diff options
context:
space:
mode:
authorJames Yonan <james@openvpn.net>2011-04-12 05:14:34 +0000
committerDavid Sommerseth <dazo@users.sourceforge.net>2011-04-26 22:29:11 +0200
commite51935df0ee3984a0464bfd72afc58836cb79d99 (patch)
tree5393d868485b37c5bedec4960725b3e4aa4d7714 /tun.c
parent28c8776b65c2300b758cd2b707283a43b4a582e8 (diff)
downloadopenvpn-e51935df0ee3984a0464bfd72afc58836cb79d99.tar.gz
openvpn-e51935df0ee3984a0464bfd72afc58836cb79d99.tar.xz
openvpn-e51935df0ee3984a0464bfd72afc58836cb79d99.zip
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
Diffstat (limited to 'tun.c')
-rw-r--r--tun.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/tun.c b/tun.c
index 8c94f89..f2dec25 100644
--- a/tun.c
+++ b/tun.c
@@ -801,7 +801,17 @@ do_ifconfig (struct tuntap *tt,
);
}
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;
#else
/*