sk-unix: fix connection to external sockets

Don't need to wait external sockets, they should exist.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
dump: save all vdso pages (v2)

If a vdso page was not accessed before dump, it's not present
and now it doesn't save in a dump image.
The vdso area is restored as VMA_ANON, it isn't an actual vdso more,
so when a not-present vdso page is accessed, a zero page would be mapped.

For this reason we should save all vdso pages in a image.

v2: make code more clear

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
eventfd: Add LOG_PREFIX

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
epoll: Add LOG_PREFIX

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
inotify: Add LOG_PREFIX

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
parasite: Remove unneeded headers from parasite.c

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
packet: Update diag header with fanout and rings

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
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>
zdtm: Test for packet fanout

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
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>
zdtm: Configure rings in packet socket test

Now we can at least look into images manually to check how
rings are dumped. Later we should write an auto test.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
files: add one more operation post_create

It will be used for restoring inet sockets. An inet socket is created with
the option REUSEADDR, because the restore logic requires this.
The origin value can be restored only when all sockets were restored.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
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>
sk-unix: connect unix sockets in post_open

Move logic from run_unix_connections to post_open().

I don't fix indents in this patch for easy reviewing.
They are fixed in the next patch.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
sk-unix: fix indents

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
unix: Remove conn-jobs

After previous rework (513dde00) they are no longer needed.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
inet: Factor out sockaddr-s preparations

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
inet: Sanitize ii->ie mass dereference in inet sk restore

Just save the ii->ie on stack and do s/ii->ie/ie/ over the fn.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
inet: Remove is_bound fn

It's now quite simple. It's better to open-code one.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
zdtm: rework logging

* Delete internal buffer, all data are written immediately in a log file
* Add timestamp and pid in a message
* All processes write log messages in one file

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>