mirror of
https://github.com/yarrick/iodine.git
synced 2024-12-22 13:23:32 +02:00
tun: Automatically attempt to use utun on mac
Once /dev/tunX has been tried without success
This commit is contained in:
parent
39356163d9
commit
a9045705ba
1 changed files with 11 additions and 0 deletions
11
src/tun.c
11
src/tun.c
|
@ -453,6 +453,17 @@ open_tun(const char *tun_device)
|
|||
break;
|
||||
}
|
||||
|
||||
#ifdef DARWIN
|
||||
fprintf(stderr, "No tun devices found, trying utun\n");
|
||||
for (i = 0; i < TUN_MAX_TRY; i++) {
|
||||
snprintf(tun_name, sizeof(tun_name), "utun%d", i);
|
||||
tun_fd = open_utun(tun_device);
|
||||
if (tun_fd >= 0) {
|
||||
return tun_fd;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
warn("open_tun: Failed to open tunneling device");
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue