Commit c2b78007 authored by Pavel Emelyanov's avatar Pavel Emelyanov

check: Add tun support

Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent ed5f82c7
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include "tty.h" #include "tty.h"
#include "ptrace.h" #include "ptrace.h"
#include "kerndat.h" #include "kerndat.h"
#include "tun.h"
static int check_tty(void) static int check_tty(void)
{ {
...@@ -559,6 +560,7 @@ int cr_check(void) ...@@ -559,6 +560,7 @@ int cr_check(void)
ret |= check_ptrace_peeksiginfo(); ret |= check_ptrace_peeksiginfo();
ret |= check_mem_dirty_track(); ret |= check_mem_dirty_track();
ret |= check_posix_timers(); ret |= check_posix_timers();
ret |= check_tun();
if (!ret) if (!ret)
pr_msg("Looks good.\n"); pr_msg("Looks good.\n");
......
...@@ -10,4 +10,5 @@ extern const struct fdtype_ops tunfile_dump_ops; ...@@ -10,4 +10,5 @@ extern const struct fdtype_ops tunfile_dump_ops;
int dump_tun_link(NetDeviceEntry *nde, struct cr_fdset *fds); int dump_tun_link(NetDeviceEntry *nde, struct cr_fdset *fds);
int restore_one_tun(NetDeviceEntry *nde, int nlsk); int restore_one_tun(NetDeviceEntry *nde, int nlsk);
extern struct collect_image_info tunfile_cinfo; extern struct collect_image_info tunfile_cinfo;
int check_tun(void);
#endif #endif
...@@ -44,6 +44,29 @@ ...@@ -44,6 +44,29 @@
#define TUN_DEV_GEN_PATH "/dev/net/tun" #define TUN_DEV_GEN_PATH "/dev/net/tun"
int check_tun(void)
{
int fd, idx = 13, ret;
if (opts.check_ms_kernel) {
pr_warn("Skipping tun support check\n");
return 0;
}
fd = open(TUN_DEV_GEN_PATH, O_RDWR);
if (fd < 0) {
pr_perror("Can't check tun support");
return 0;
}
ret = ioctl(fd, TUNSETIFINDEX, &idx);
if (ret < 0)
pr_perror("No proper support for tun dump/restore");
close(fd);
return ret;
}
static LIST_HEAD(tun_links); static LIST_HEAD(tun_links);
struct tun_link { struct tun_link {
......
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