mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-08-02 06:43:00 +00:00
check: Add tun support
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
parent
ed5f82c7e6
commit
c2b7800740
3 changed files with 26 additions and 0 deletions
|
|
@ -26,6 +26,7 @@
|
|||
#include "tty.h"
|
||||
#include "ptrace.h"
|
||||
#include "kerndat.h"
|
||||
#include "tun.h"
|
||||
|
||||
static int check_tty(void)
|
||||
{
|
||||
|
|
@ -559,6 +560,7 @@ int cr_check(void)
|
|||
ret |= check_ptrace_peeksiginfo();
|
||||
ret |= check_mem_dirty_track();
|
||||
ret |= check_posix_timers();
|
||||
ret |= check_tun();
|
||||
|
||||
if (!ret)
|
||||
pr_msg("Looks good.\n");
|
||||
|
|
|
|||
|
|
@ -10,4 +10,5 @@ extern const struct fdtype_ops tunfile_dump_ops;
|
|||
int dump_tun_link(NetDeviceEntry *nde, struct cr_fdset *fds);
|
||||
int restore_one_tun(NetDeviceEntry *nde, int nlsk);
|
||||
extern struct collect_image_info tunfile_cinfo;
|
||||
int check_tun(void);
|
||||
#endif
|
||||
|
|
|
|||
23
tun.c
23
tun.c
|
|
@ -44,6 +44,29 @@
|
|||
|
||||
#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);
|
||||
|
||||
struct tun_link {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue