Commit a58ecb38 authored by Dmitry Safonov's avatar Dmitry Safonov Committed by Pavel Emelyanov

tun/kerndat: Keep going with CONFIG_TUN=n

check_tun_netns_cr() should return 0 on CONFIG_TUN=n kernels.
That is, when we fail to open tun device.

Fixes: #496
Signed-off-by: 's avatarDmitry Safonov <dima@arista.com>
Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
parent 9462f2ae
...@@ -74,17 +74,18 @@ int check_tun_cr(int no_tun_err) ...@@ -74,17 +74,18 @@ int check_tun_cr(int no_tun_err)
int check_tun_netns_cr(bool *result) int check_tun_netns_cr(bool *result)
{ {
bool val; bool val = false;
int tun; int tun;
tun = open(TUN_DEV_GEN_PATH, O_RDONLY); tun = open(TUN_DEV_GEN_PATH, O_RDONLY);
if (tun < 0) { if (tun < 0) {
pr_perror("Unable to create tun"); pr_perror("Unable to create tun");
return -1; goto out;
} }
check_has_netns_ioc(tun, &val, "tun"); check_has_netns_ioc(tun, &val, "tun");
close(tun); close(tun);
out:
if (result) if (result)
*result = val; *result = val;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment