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>
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>
Will be usefull later with "pretty" show support.
Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
"depth" variable was moved to field structure.
Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>