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
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 New Issue