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
01e88d1c
Commit
01e88d1c
authored
Feb 11, 2014
by
Pavel Emelyanov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rpc: Add ability to specify veth pairs (--veth-pair option)
Signed-off-by:
Pavel Emelyanov
<
xemul@parallels.com
>
parent
72bf807c
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
36 additions
and
11 deletions
+36
-11
cr-service.c
cr-service.c
+7
-0
crtools.c
crtools.c
+6
-11
net.h
include/net.h
+2
-0
net.c
net.c
+15
-0
rpc.proto
protobuf/rpc.proto
+6
-0
No files found.
cr-service.c
View file @
01e88d1c
...
@@ -22,6 +22,7 @@
...
@@ -22,6 +22,7 @@
#include "cr-service-const.h"
#include "cr-service-const.h"
#include "sd-daemon.h"
#include "sd-daemon.h"
#include "page-xfer.h"
#include "page-xfer.h"
#include "net.h"
unsigned
int
service_sk_ino
=
-
1
;
unsigned
int
service_sk_ino
=
-
1
;
...
@@ -159,6 +160,7 @@ static int setup_opts_from_req(int sk, CriuOpts *req)
...
@@ -159,6 +160,7 @@ static int setup_opts_from_req(int sk, CriuOpts *req)
socklen_t
ids_len
=
sizeof
(
struct
ucred
);
socklen_t
ids_len
=
sizeof
(
struct
ucred
);
char
images_dir_path
[
PATH_MAX
];
char
images_dir_path
[
PATH_MAX
];
char
work_dir_path
[
PATH_MAX
];
char
work_dir_path
[
PATH_MAX
];
int
i
;
if
(
getsockopt
(
sk
,
SOL_SOCKET
,
SO_PEERCRED
,
&
ids
,
&
ids_len
))
{
if
(
getsockopt
(
sk
,
SOL_SOCKET
,
SO_PEERCRED
,
&
ids
,
&
ids_len
))
{
pr_perror
(
"Can't get socket options"
);
pr_perror
(
"Can't get socket options"
);
...
@@ -265,6 +267,11 @@ static int setup_opts_from_req(int sk, CriuOpts *req)
...
@@ -265,6 +267,11 @@ static int setup_opts_from_req(int sk, CriuOpts *req)
list_add
(
&
script
->
node
,
&
opts
.
scripts
);
list_add
(
&
script
->
node
,
&
opts
.
scripts
);
}
}
for
(
i
=
0
;
i
<
req
->
n_veths
;
i
++
)
{
if
(
veth_pair_add
(
req
->
veths
[
i
]
->
if_in
,
req
->
veths
[
i
]
->
if_out
))
return
-
1
;
}
return
0
;
return
0
;
}
}
...
...
crtools.c
View file @
01e88d1c
...
@@ -230,20 +230,15 @@ int main(int argc, char *argv[])
...
@@ -230,20 +230,15 @@ int main(int argc, char *argv[])
break
;
break
;
case
47
:
case
47
:
{
{
struct
veth_pair
*
n
;
char
*
aux
;
n
=
xmalloc
(
sizeof
(
*
n
));
aux
=
strchr
(
optarg
,
'='
);
if
(
n
==
NULL
)
if
(
aux
==
NULL
)
return
1
;
n
->
outside
=
strchr
(
optarg
,
'='
);
if
(
n
->
outside
==
NULL
)
{
xfree
(
n
);
goto
bad_arg
;
goto
bad_arg
;
}
*
n
->
outside
++
=
'\0'
;
*
aux
=
'\0'
;
n
->
inside
=
optarg
;
if
(
veth_pair_add
(
optarg
,
aux
+
1
))
list_add
(
&
n
->
node
,
&
opts
.
veth_pairs
)
;
return
1
;
}
}
break
;
break
;
case
49
:
case
49
:
...
...
include/net.h
View file @
01e88d1c
...
@@ -24,4 +24,6 @@ extern int write_netdev_img(NetDeviceEntry *nde, struct cr_fdset *fds);
...
@@ -24,4 +24,6 @@ extern int write_netdev_img(NetDeviceEntry *nde, struct cr_fdset *fds);
extern
int
read_ns_sys_file
(
char
*
path
,
char
*
buf
,
int
len
);
extern
int
read_ns_sys_file
(
char
*
path
,
char
*
buf
,
int
len
);
extern
int
restore_link_parms
(
NetDeviceEntry
*
nde
,
int
nlsk
);
extern
int
restore_link_parms
(
NetDeviceEntry
*
nde
,
int
nlsk
);
extern
int
veth_pair_add
(
char
*
in
,
char
*
out
);
#endif
/* __CR_NET_H__ */
#endif
/* __CR_NET_H__ */
net.c
View file @
01e88d1c
...
@@ -605,4 +605,19 @@ void network_unlock(void)
...
@@ -605,4 +605,19 @@ void network_unlock(void)
run_scripts
(
"network-unlock"
);
run_scripts
(
"network-unlock"
);
}
}
int
veth_pair_add
(
char
*
in
,
char
*
out
)
{
struct
veth_pair
*
n
;
n
=
xmalloc
(
sizeof
(
*
n
));
if
(
n
==
NULL
)
return
-
1
;
n
->
inside
=
in
;
n
->
outside
=
out
;
list_add
(
&
n
->
node
,
&
opts
.
veth_pairs
);
pr_debug
(
"Added %s:%s veth map
\n
"
,
in
,
out
);
return
0
;
}
struct
ns_desc
net_ns_desc
=
NS_DESC_ENTRY
(
CLONE_NEWNET
,
"net"
);
struct
ns_desc
net_ns_desc
=
NS_DESC_ENTRY
(
CLONE_NEWNET
,
"net"
);
protobuf/rpc.proto
View file @
01e88d1c
...
@@ -4,6 +4,11 @@ message criu_page_server_info {
...
@@ -4,6 +4,11 @@ message criu_page_server_info {
optional
int32
pid
=
3
;
optional
int32
pid
=
3
;
}
}
message
criu_veth_pair
{
required
string
if_in
=
1
;
required
string
if_out
=
2
;
};
message
criu_opts
{
message
criu_opts
{
required
int32
images_dir_fd
=
1
;
required
int32
images_dir_fd
=
1
;
optional
int32
pid
=
2
;
/* if not set on dump, will dump requesting process */
optional
int32
pid
=
2
;
/* if not set on dump, will dump requesting process */
...
@@ -27,6 +32,7 @@ message criu_opts {
...
@@ -27,6 +32,7 @@ message criu_opts {
optional
int32
work_dir_fd
=
16
;
optional
int32
work_dir_fd
=
16
;
optional
bool
link_remap
=
17
;
optional
bool
link_remap
=
17
;
repeated
criu_veth_pair
veths
=
18
;
}
}
message
criu_dump_resp
{
message
criu_dump_resp
{
...
...
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