2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-28 12:57:57 +00:00

208 Commits

Author SHA1 Message Date
Cyrill Gorcunov
e9f9fdb9b3 headers: Drop uintX_t usage
We have a mess of uintX_t and uX usage. Drop off uintX_t ones.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-12-12 10:03:07 +04:00
Andrey Vagin
a434e7f075 crtools: move pid_rst_prio to pid.h
crtools.h is too heavy to be included in many sources

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-11-06 18:18:12 +04:00
Andrey Vagin
1fd180ca6c sockets: don't double buffer size for sockets
SO_SNDBUF and SO_RCVBUF sets a double input value, because
"Linux reserves half of te socket buffer for metadata."

So if a process is suspended/restored many times, a socket buffer
size is doubled on each iteration and in a one moment it is overflowed.
Very likely the program hangs in such situation, because the socket with
negative buffer size is unusable.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-09-17 22:46:55 +04:00
Pavel Emelyanov
72ec39f10c util: Rename pie's util-net.c into util.c
Will put more things there.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-07-29 12:43:30 +04:00
Pavel Emelyanov
ca6c026a31 check: Netlink diag and peek-siginfo is in 3.10 already
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-07-01 18:24:24 +04:00
Pavel Emelyanov
d020ebb36d files: Compact the code by removing per-file dump helpers
Since *all* of them just call do_dump_gen_file with proper ops,
just call one directly. Compacts the code.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-06-14 00:11:08 +04:00
Kir Kolyshkin
3e8b82d367 Change crtools to criu in comments
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-05-10 11:02:27 +04:00
Cyrill Gorcunov
921dbf23de Don't use \Newline in pr_perror
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-05-02 22:44:24 +04:00
Pavel Emelyanov
379abca968 check: Introduce --ms option
This option skips checking for features, that are known to
be absent in mainstream kernel.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-23 23:38:47 +04:00
Pavel Emelyanov
8201e08081 check: Warn *diag absense always
To know what exactly is missing.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-23 23:25:13 +04:00
Kir Kolyshkin
d90d4b1b88 Fix typos in log messages
Someone has to do it, right?..

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-15 12:46:25 +04:00
Andrey Vagin
d1787c84a0 sockets: free all allocated objected in case of any error
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-04 14:00:25 +04:00
Andrey Vagin
06d8c36c56 socket: handle errors of xmalloc
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-04 14:00:24 +04:00
Pavel Emelyanov
09ebdd4534 sockets: Make crtools check report error when DIAG is incomplete
Absense of packet and netlink diag is OK at dump -- we can be on
older kernel and will fail later if _really_ need these sockets.

During check stage all diag is expected to be in place.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-04 13:08:28 +04:00
Andrey Vagin
aaad8054ee sk-inet: drop proto from struct inet_sk_desc
It isn't required anymore

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-28 18:23:20 +04:00
Andrey Vagin
d2b1d6f2aa socket: prevent dumping of sockets if they are not collected
The idea is simple. If the collection of given type of sockets failed,
crtools can't be sure, that it's able to dump such sockets correctly.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-28 18:23:18 +04:00
Andrey Vagin
5b8f179f1b sockets: skip errors from collecting of netlink and packet sockets
The packet diag are not compiled in Fedora 19 kernel.
The netlink diag is going to be merged in 3.10.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-28 18:21:17 +04:00
Pavel Emelyanov
fd5bcbe733 check: More verbose messages when sock diag infratructure is missing.
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-26 19:36:26 +04:00
Andrey Vagin
b9e6a27c3d sockets: dump netlink sockets
All info about bound sockets are got via socket diag interface.
All connected sockets are automatically bound.
For other sockets only protocol must be dumped, which is got
with help getsockopt.

A netlink sockets with pending data are not supported yet and
probably will not be supported in a near future.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-26 00:23:59 +04:00
Andrey Vagin
b17c9f64c5 sockets: use socket diag for collecting netlink sockets
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-26 00:23:14 +04:00
Pavel Emelyanov
b55e07f883 sk: Fail is SO_BINDTODEVICE and SO_GET_FILTER are missing
The v3.8 is out, so we should exptect these to be in kernel.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-02-20 13:32:20 +04:00
Cyrill Gorcunov
f682ba81d3 sockets: Print which socket family is unsupported
It's good to know which family we've met.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-02-07 00:25:03 +04:00
Pavel Emelyanov
5d7cfa8fcf sk: Don't fail collect_sockets in non netns case
This is already so, just move the check for netns case
into collect_sockets. It knows it does so.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-25 15:20:38 +04:00
Pavel Emelyanov
1505815760 sk: Fix check for whether or not to restore namespace in collect_sockets
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-25 15:14:17 +04:00
Pavel Emelyanov
ac845bd1d8 cr: Obsolete the --namespaces option
It's no longer required to use this option -- two currently
supported cases (tasks on host and tasks in containers) can
be detected automatically. Keep this option for future.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-18 13:25:16 +04:00
Pavel Emelyanov
3a1c7d1d76 ns: Introduce ns descriptors
These are structs that (now) tie together ns string
and the CLONE_ flag. It's nice to have one (some code
becomes simpler) and will help us with auto-namespaces
detection.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-15 23:24:01 +04:00
Andrey Vagin
0fc129a121 files: pass a file descriptor on an fdinfo image instead of cr_fdset
Currently fdinfo dumps for each task, so CR_FD_FDINFO is in cr_fdset.
A few tasks can share one fd table and the set of descriptors will be
dumped once and a image name will contain files_id instead of pid.
In this case CR_FD_FDINFO will go away from cr_fdset.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-11 14:47:09 +04:00
Pavel Emelyanov
f43c1c2ade sk: Rework bound-dev dump/restore according to new API
The SO_BINDTODEVICE getter is changed in the kernel (before
official release) to report not index, but name to be in
harmony with setter.

Fix crtools accordingly.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-11-28 20:24:42 +03:00
Andrey Vagin
6b2d7f0799 net: don't prevent to dump ipv6 tcp connections
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-11-23 16:36:37 +04:00
Andrey Vagin
0fa83b0394 socket: increase socket buffers for restoring queues (v2)
Sizes of send and recv buffers are set to maximum to restore queues,
after that sizes of buffers are restored.

O_NONBLOCK is set to a socket to prevent blocking during restore.

#2411

v2: do the same for unix sockets.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-11-02 13:40:54 +04:00
Pavel Emelyanov
d3397e8f8c sk: Support socket filters
One thing to note. The socket filter proggie is a set of struct-s
wuth 8 and 16 bits values in it. Protobuf doesn't support such thing
and it's too annoying to mess with yet another message for that.
Instead, I encode all this stuff into array of fixed64 fields to
handle endianity (yes, protobuf handles it, but each field is not
just 64-bit value, but a structure).

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-11-01 19:20:33 +03:00
Pavel Emelyanov
a6a476ff23 skopts: Prepare for xmalloc-able entries on SkOptsEntry 2012-11-01 17:53:57 +03:00
Pavel Emelyanov
a723809c7d sock: Fix ret code collection when dumping sockets option
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-11-01 17:53:26 +03:00
Pavel Emelyanov
b42f8fa1ac sk: Support SO_BINDTODEVICE option
The kernel SO_BINDTODEVICE option is not symmetrical --
set required device name, but get reports index. Thus
need the index to name resolver.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-10-19 17:36:44 +04:00
Pavel Emelyanov
293eca3127 sk: Support SO_NO_CHECK option
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-10-15 15:45:57 +04:00
Pavel Emelyanov
ed745fa9cf sk: Support SO_DONTROUTE option
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-10-12 20:32:06 +04:00
Pavel Emelyanov
5e1a9f840c sk: Support SO_PASSSEC and SO_PASSCRED options
There's some bug in show fn for options :( Will be fixed later.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-10-12 14:01:18 +04:00
Pavel Emelyanov
b53d6d90b7 sk: Support SO_MARK socket option
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-10-12 13:48:18 +04:00
Pavel Emelyanov
0a9ef15e64 sk: Remove dead code
After reworking sk showing on generic pb showers this one
is not required.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-10-12 13:44:47 +04:00
Pavel Emelyanov
9929d2efdf sock: Handle rcvlowat and priority options
And write a test for them.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-10-11 22:02:25 +04:00
Andrey Vagin
1ce1cca2ac sk-queue: don't block on restore of socket queues
If a socket queue doesn't have a free space, a error should be returned,
because nobody reads this socket.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-09-28 16:42:15 +04:00
Andrey Vagin
a74605a78d sk-inet: restore option REUSEADDR (v2)
All sockets are created with SO_REUSEADDR, it's needed for restoring.
E.g.: A listen socket is created after a connected socket. Both of them
are binded to one port.

So SO_REUSEADDR should be restored, when all sockets on a port were created.

This code creates a structure for each port of one type of sockets
and accounts a number of sockets, which are not restored yet.

Sockets have a hook post_open(), in which it waits when all sockets for
a defined port would be created and then it will restore SO_REUSEADDR.

struct port contains a type (udp, tcp, etc) and a port number.
It doesn't contain family or addr, because it's extra loads of logic,
which doesn't bring a significant profits.

v2: fix according with comments from Pavel

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-20 17:50:08 +04:00
Pavel Emelyanov
2660b810d9 packet: Rings support
There's no way (currently) to check that the ring got restored.
Will do it once we implement mapping of a packet socket and
tcpdump app test.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-20 15:32:55 +04:00
Pavel Emelyanov
4ee3345beb packet: Support fanout
This one may be present and may be not, thus it's optional in the image.
The C-binding we use report the field absense in the parsed stream via
the has_xxx field, but in the google docs it's stated, that

	"When a message is parsed, if it does not contain an optional
	 element, the corresponding field in the parsed object is set
	 to the default value for that field."

Thus, I also declare the default value for it to be not zero as 0 is
a valid fanout configuration.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-20 15:32:27 +04:00
Pavel Emelyanov
69acf64f57 packet: Add support for mclists
The implementation is rather straightforward. One thing to note
is that non-single membership of each type is not supported. It
can be done, but I'm unaware of any software doing so.

Note: the pb show routine should be tuned to support showing bytes.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-15 21:04:49 +04:00
Pavel Emelyanov
fb5a5671c8 sock: Do strict socket family checks when looking up collected socket
We hash socket with inode and family, but search only by inode. Well,
yes, family should match, since all sockets are in one sockfs in kernel,
but let's make sure _we_ did things right by checking the family as well.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-15 19:16:12 +04:00
Pavel Emelyanov
4ff60cd870 packet: Switch to use packet diag module
It's in net-next already and does provide all we currently
need (and more). Implementation is like for inet and unix
sockets.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-15 17:39:21 +04:00
Pavel Emelyanov
acba1e9bae sock: Cleanup inet sockets collecing
There is no need in 6 receive callbacks -- we can find out family and protocol
(and thus -- type) out of the inet_diag_req_v2 passed through transparent arg
of nlk request engine.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-11 22:32:38 +04:00
Andrey Vagin
796d4ceb95 socket: switch netns for collecting sockets
All sockets should be collected in a target net name-space when the -n net
is specified.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-11 13:12:43 +04:00
Pavel Emelyanov
216a3a6521 sk: Add level to socket option dump/restore helpers
Packet socket need SOL_PACKET one.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-09 17:25:11 +04:00