Skip to content
Snippets Groups Projects
Commit f04d3a91 authored by Michael Tüxen's avatar Michael Tüxen
Browse files

Load if_tun module on FreeBSD if needed.

parent 69360ddd
No related branches found
No related tags found
No related merge requests found
......@@ -112,10 +112,20 @@ static void check_remote_address(struct config *config,
static void create_device(struct config *config, struct local_netdev *netdev)
{
/* Open the tun device, which "clones" it for our purposes. */
int tun_fd = open(TUN_PATH, O_RDWR);
if (tun_fd < 0)
die_perror("open tun device");
int tun_fd;
tun_fd = open(TUN_PATH, O_RDWR);
#if defined(__FreeBSD__)
if ((tun_fd < 0) && (errno == ENOENT)) {
if (system("kldload -q if_tun") < 0) {
die_perror("kldload -q if_tun");
}
tun_fd = open(TUN_PATH, O_RDWR);
}
#endif
if (tun_fd < 0) {
die_perror("open tun device");
}
netdev->tun_fd = tun_fd;
#ifdef linux
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment