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

1830 Commits

Author SHA1 Message Date
Stanislav Kinsbursky
3904b402bb protobuf: "pretty" engine
v2:
1) parser updated to properly parse strings like this: "11:%x 1:%d"

Protobuf generic show function now accept a string with pretty specificators.
The string have to look like below (an example):

"0:%d 3:%u"

where numbers with colon specifies field number (the same number as in
proto-file) and "%[a-zA-Z]" specifies output format.
If pretty specificator for specified for a field, then it will be used for
output instead of generic hexidecimal view.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-14 14:49:21 +04:00
Stanislav Kinsbursky
50ff74ffa9 protobuf: show field cleanup
Let's pass field structure to show functions. Hope, it makes the mess less
anoying...

Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-14 14:47:40 +04:00
Stanislav Kinsbursky
ed9cbaf412 protobuf: field showing routine split
Will be usefull later with "pretty" show support.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-14 14:47:03 +04:00
Stanislav Kinsbursky
92b6d86c7e protobuf: helper for show function selection introduced
Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-14 14:46:49 +04:00
Stanislav Kinsbursky
f64633bd7d protobuf: service helper for show routine introduced
Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-14 14:46:47 +04:00
Stanislav Kinsbursky
3f1b07f5a7 protobuf: move data pointer to field structure
Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-14 14:45:47 +04:00
Stanislav Kinsbursky
ea5f645463 protobuf: structure for currently showing field introduced
"depth" variable was moved to field structure.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-14 14:45:29 +04:00
Stanislav Kinsbursky
248a97c160 protobuf: rename type for show functions
Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-14 14:45:10 +04:00
Stanislav Kinsbursky
d84dc289a7 protobuf: remove carriage return from unknown object print
Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-14 14:44:55 +04:00
Stanislav Kinsbursky
691bbdad4b protobuf: change pb_pr_field_t to pointer
Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-14 14:44:43 +04:00
Stanislav Kinsbursky
621afa560d zdtm: fix compile error in case of NEW_IPC_NS is not set
Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-14 14:24:06 +04:00
Cyrill Gorcunov
f7c22fc771 make: Build crtools with -O2 by default
Enable debugging only if DEBUG=1 provided.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-14 14:22:49 +04:00
Cyrill Gorcunov
1663d74996 make: Add -fno-strict-aliasing
Since we use some kernel tricks for CMSG_FIRSTHDR
some compilers (in particular gcc version 4.4.5
20110214 (Red Hat 4.4.5-6)) do complain about strict
aliasing.

Thus pass -fno-strict-aliasing to be on the same
coast as kernel is.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-14 14:22:42 +04:00
Pavel Emelyanov
3ae36e700f restore: Don't mess with last_pid when restoring pidns init
When we fork a pidns init there's no need in specifying its pid,
as it will be autogenerated to 1. Clean the code not to mess with
the last_pid sysctl at all in that case, rather than just omitting
the write into it.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-14 14:09:20 +04:00
Andrey Vagin
6aaf65642b zdtm: move all logic about namespaces from test_init in libzdtm
A test will be executed in new set of namespaces if the environment
variable ZDTM_NEWNS is set. A pid of the root task will be written in
$ZDTM_PIDFILE and a root fyle system will be changed on $ZDTM_ROOT.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-14 12:56:20 +04:00
Andrey Vagin
aabb56bd66 crtools: write a pid of a root task in a specified file
When we restore a pid namespace the root task will get some unknown pid
in the original (i.e. -- the ns crtools a launched from) one. To find
this pid out one can use this option -- it will make the pid obtained by
the new init to be written into a pid file.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-14 12:54:00 +04:00
Andrey Vagin
a5ac06f503 net: define PACKET_TIMESTAMP
It's required for compiling on RHEL6

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-14 12:50:37 +04:00
Andrey Vagin
d0476ea93b sockets: fail if an unsupported socket is in a dumped netns
If netns is dumped, crtools fails if it collects unsupported sockets.

If netns isn't dumped, crtools will fail only
if an unsupported socket should be dumped.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-14 12:49:21 +04:00
Andrey Vagin
acf73093df sk-inet: save the socket option IPV6_V6ONLY (v2)
Most part of services (ssh, httpd, ...) create two separate sockets
one for ipv4 and one for ipv6. If IPV6_V6ONLY isn't dumped, bind() returns
EADDRINUSE

v2: use do_dump_opt and initialize yes = 1

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-14 12:46:43 +04:00
Andrey Vagin
6afafb12ca sk-inet: if a source port isn't zero, a socket should be bound (v2)
Now crtools checks address, but it may be zero. For example,
a listen socket is bound to zero address to accept connections
from any addresses.

v2: add a comment about zero port

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-14 12:39:23 +04:00
Pavel Emelyanov
51133437c9 fd: Remove per-filetype make_gen_id abstraction
It doesn't makemuch sense in pulling this further. The generic genid generation seems to
be enough for eny file type.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-11 22:41:29 +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
Pavel Emelyanov
64149b40f2 code: A little but more checkpatch fixes over code
There are more in test/ (and checkpatch.pl crashes in the middle =),
but seem to be all.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-11 22:19:34 +04:00
Pavel Emelyanov
d10ee39f28 code: Fix checkpatch.pl warnings since v0.1
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-11 22:03:11 +04:00
Pavel Emelyanov
5c9cc71fea log: Replace perror-s with pr_perror-s over code
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-11 21:57:42 +04:00
Pavel Emelyanov
f1b41e0824 code: Replace 0x%x with %#x in messages
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-11 21:55:48 +04:00
Pavel Emelyanov
a1b731dac3 code: Brush up multi-line comments first line
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-11 21:48:17 +04:00
Pavel Emelyanov
5908c2eb45 code: Fix while ( formatting
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-11 21:39:36 +04:00
Pavel Emelyanov
cdc4c99835 code: Fix spaced indentation where found
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-11 21:36:03 +04:00
Pavel Emelyanov
9efd12f2c7 code: Remove trailing whitespaces over .c and .h files
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-11 21:34:35 +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
Cyrill Gorcunov
1e1837a83e zdtm: Add futex-rl test
To test futex robust list C/R.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-10 20:29:02 +04:00
Cyrill Gorcunov
57032aff5e restorer: Do restore futex robust lists
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-10 20:29:01 +04:00
Cyrill Gorcunov
097d73a101 dump: Add futex robust list dumping v3
This patch introduces ThreadCoreEntry protobuf structure which is to carry
thread-specific arch-independent information.

Now put there the c/r futex robust lists.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-10 20:28:59 +04:00
Pavel Emelyanov
1a62282d48 net: Push the host end of a veth to original netns
The call will then have to handle this end (put into a bridge).

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-10 19:14:36 +04:00
Pavel Emelyanov
076faf7443 net: Preliminary veth restore
The peer device is named veth_host and is supposed to be pushed outside
the netns being restored for proper host-side configuration.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-10 17:36:00 +04:00
Pavel Emelyanov
3fee68f56b net: Put IFLA_LINKINFO attr on newlink if required
Veth will fill the linkinfo part for peer.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-10 17:32:56 +04:00
Pavel Emelyanov
9d18a851c2 net: Put ifname and mtu on newlink request
The name will be valid for new veth, mtu has to be restored for all devices.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-10 17:31:03 +04:00
Pavel Emelyanov
ff3770a22d net: Declare and expand a struct with newlink request
We need to add payload to NEWLINK request and will have to work with it outside the
restore_one_link fn.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-10 17:29:49 +04:00
Pavel Emelyanov
425ed1e92c net: Pass NLM_F_CREATE flag on link restore
This one is required to say, that we do want a new device is it doesn't exists.
This is so for all the devices except lo.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-10 17:25:42 +04:00
Pavel Emelyanov
4ae4c4acc9 net: Dump veth device
These devices can be distinguished by type ETHER and kind "veth".
Some problems with peer detection exists (described in comment), but
we cannot handle them at the moment.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-10 17:24:11 +04:00
Pavel Emelyanov
52b2ca86c9 libnetlink: More helpers
Add more helpers that manage nla blobs (taken from iproute2 tool). Need for veth support.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-10 17:21:34 +04:00
Pavel Emelyanov
b57fb6da34 net: Move ifla parsing higher the call-stack
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-10 17:20:22 +04:00
Pavel Emelyanov
7f1c9af0f8 vma: State that vma->fd is -1 constant in the image
This field was lost while switching to protobuf -- the vma images
were used by parasite as plain array and it was easier to reseve
this space in the image. Now it's too late to change this, so make
it be -1 always.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-10 10:17:50 +04:00
Pavel Emelyanov
321a71fd82 sk-inet: Fix for inet address checks validation
Bug introduced by 27d62237e5e2. Sorry about it :(

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-10 10:17:18 +04:00
Cyrill Gorcunov
01ef70a106 syscalls: Add futex robust list helpers
Will need them for futex robust list c/r.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-10 12:23:03 +04:00
Pavel Emelyanov
27d62237e5 inet: Sanitize addresses size handling
We use repeated u32 field for IPv* address. For ipv4 there's 1 element
in it, for ipv6 -- 4. Validate these sizes in image and check that
sockaddr_in* elements sizes match.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-10 07:58:19 +04:00
Stanislav Kinsbursky
9e03fd584b sk: optimize dump size a bit
Let's carry only on uint_32 for IPv4 address.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-10 07:40:54 +04:00
Pavel Emelyanov
64e161f307 show: Tune protobus showers for .int(32|64)
Use # for both and don't use fixed field width for 32bit one (as they are
most likely just some values, while the 64bit is some address which is better
to be printed with full width).

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-10 07:36:20 +04:00
Pavel Emelyanov
6a9e5bbdcc show: Fix optional submessage showing
Wrong pointer was checked against NULL and default value. This resulted
in lost tc part of the core message in show output.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-09 22:40:18 +04:00