Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
criu
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhul
criu
Commits
fe7d8a92
Commit
fe7d8a92
authored
Mar 02, 2018
by
Kirill Tkhai
Committed by
Andrei Vagin
May 12, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tun: Check tun has ioctl() cmd SIOCGSKNS
Signed-off-by:
Kirill Tkhai
<
ktkhai@virtuozzo.com
>
parent
8f9553a0
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
38 additions
and
0 deletions
+38
-0
cr-check.c
criu/cr-check.c
+8
-0
kerndat.h
criu/include/kerndat.h
+1
-0
tun.h
criu/include/tun.h
+1
-0
kerndat.c
criu/kerndat.c
+8
-0
tun.c
criu/tun.c
+20
-0
No files found.
criu/cr-check.c
View file @
fe7d8a92
...
@@ -1209,6 +1209,13 @@ static int check_tun(void)
...
@@ -1209,6 +1209,13 @@ static int check_tun(void)
return
check_tun_cr
(
-
1
);
return
check_tun_cr
(
-
1
);
}
}
static
int
check_tun_netns
(
void
)
{
bool
has
=
false
;
check_tun_netns_cr
(
&
has
);
return
has
?
0
:
-
1
;
}
static
int
check_nsid
(
void
)
static
int
check_nsid
(
void
)
{
{
if
(
kerndat_nsid
()
<
0
)
if
(
kerndat_nsid
()
<
0
)
...
@@ -1246,6 +1253,7 @@ static struct feature_list feature_list[] = {
...
@@ -1246,6 +1253,7 @@ static struct feature_list feature_list[] = {
{
"aio_remap"
,
check_aio_remap
},
{
"aio_remap"
,
check_aio_remap
},
{
"timerfd"
,
check_timerfd
},
{
"timerfd"
,
check_timerfd
},
{
"tun"
,
check_tun
},
{
"tun"
,
check_tun
},
{
"tun_ns"
,
check_tun_netns
},
{
"userns"
,
check_userns
},
{
"userns"
,
check_userns
},
{
"fdinfo_lock"
,
check_fdinfo_lock
},
{
"fdinfo_lock"
,
check_fdinfo_lock
},
{
"seccomp_suspend"
,
check_ptrace_suspend_seccomp
},
{
"seccomp_suspend"
,
check_ptrace_suspend_seccomp
},
...
...
criu/include/kerndat.h
View file @
fe7d8a92
...
@@ -48,6 +48,7 @@ struct kerndat_s {
...
@@ -48,6 +48,7 @@ struct kerndat_s {
enum
loginuid_func
luid
;
enum
loginuid_func
luid
;
bool
compat_cr
;
bool
compat_cr
;
bool
sk_ns
;
bool
sk_ns
;
bool
tun_ns
;
enum
pagemap_func
pmap
;
enum
pagemap_func
pmap
;
unsigned
int
has_xtlocks
;
unsigned
int
has_xtlocks
;
unsigned
long
mmap_min_addr
;
unsigned
long
mmap_min_addr
;
...
...
criu/include/tun.h
View file @
fe7d8a92
...
@@ -15,5 +15,6 @@ struct net_link;
...
@@ -15,5 +15,6 @@ struct net_link;
extern
int
restore_one_tun
(
struct
net_link
*
link
,
int
nlsk
);
extern
int
restore_one_tun
(
struct
net_link
*
link
,
int
nlsk
);
extern
struct
collect_image_info
tunfile_cinfo
;
extern
struct
collect_image_info
tunfile_cinfo
;
extern
int
check_tun_cr
(
int
no_tun_err
);
extern
int
check_tun_cr
(
int
no_tun_err
);
extern
int
check_tun_netns_cr
(
bool
*
result
);
#endif
/* __CR_TUN_H__ */
#endif
/* __CR_TUN_H__ */
criu/kerndat.c
View file @
fe7d8a92
...
@@ -29,6 +29,7 @@
...
@@ -29,6 +29,7 @@
#include "sk-inet.h"
#include "sk-inet.h"
#include "sockets.h"
#include "sockets.h"
#include "net.h"
#include "net.h"
#include "tun.h"
#include <compel/plugins/std/syscall-codes.h>
#include <compel/plugins/std/syscall-codes.h>
#include <compel/compel.h>
#include <compel/compel.h>
#include "netfilter.h"
#include "netfilter.h"
...
@@ -933,6 +934,11 @@ out_unmap:
...
@@ -933,6 +934,11 @@ out_unmap:
return
ret
;
return
ret
;
}
}
static
int
kerndat_tun_netns
(
void
)
{
return
check_tun_netns_cr
(
&
kdat
.
tun_ns
);
}
int
kerndat_init
(
void
)
int
kerndat_init
(
void
)
{
{
int
ret
;
int
ret
;
...
@@ -969,6 +975,8 @@ int kerndat_init(void)
...
@@ -969,6 +975,8 @@ int kerndat_init(void)
ret
=
kerndat_compat_restore
();
ret
=
kerndat_compat_restore
();
if
(
!
ret
)
if
(
!
ret
)
ret
=
kerndat_socket_netns
();
ret
=
kerndat_socket_netns
();
if
(
!
ret
)
ret
=
kerndat_tun_netns
();
if
(
!
ret
)
if
(
!
ret
)
ret
=
kerndat_nsid
();
ret
=
kerndat_nsid
();
if
(
!
ret
)
if
(
!
ret
)
...
...
criu/tun.c
View file @
fe7d8a92
...
@@ -19,6 +19,7 @@
...
@@ -19,6 +19,7 @@
#include "net.h"
#include "net.h"
#include "namespaces.h"
#include "namespaces.h"
#include "xmalloc.h"
#include "xmalloc.h"
#include "kerndat.h"
#include "images/tun.pb-c.h"
#include "images/tun.pb-c.h"
...
@@ -70,6 +71,25 @@ int check_tun_cr(int no_tun_err)
...
@@ -70,6 +71,25 @@ int check_tun_cr(int no_tun_err)
return
ret
;
return
ret
;
}
}
int
check_tun_netns_cr
(
bool
*
result
)
{
bool
val
;
int
tun
;
tun
=
open
(
TUN_DEV_GEN_PATH
,
O_RDONLY
);
if
(
tun
<
0
)
{
pr_perror
(
"Unable to create tun"
);
return
-
1
;
}
check_has_netns_ioc
(
tun
,
&
val
,
"tun"
);
close
(
tun
);
if
(
result
)
*
result
=
val
;
return
0
;
}
static
LIST_HEAD
(
tun_links
);
static
LIST_HEAD
(
tun_links
);
struct
tun_link
{
struct
tun_link
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment