Skip to content

Commit

Permalink
tun: Automatically attempt to use utun on mac
Browse files Browse the repository at this point in the history
Once /dev/tunX has been tried without success
  • Loading branch information
yarrick committed Jan 21, 2021
1 parent 3935616 commit a904570
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/tun.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}

Expand Down

0 comments on commit a904570

Please sign in to comment.