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
bc3370fc47 net: sockets -- Dont use multiline for() without braces
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-28 12:16:36 +04:00
Cyrill Gorcunov
c53408d6b7 net: sockets -- Make sure ue->namelen < UNIX_PATH_MAX
UNIX_PATH_MAX is a size of path, so max length
should never be equal to such size.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-27 23:32:17 +04:00
Cyrill Gorcunov
2ae99d73b9 net: Define named constant for nlmsg_seq
For better readability.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-27 20:13:18 +04:00
Cyrill Gorcunov
843747de55 net: A few changes in headres to follow c99
Since we're not system library

 - no underscopes in functions name until really needed
   and known to not clash with posix namespace
 - empty line between system headers and own headers
   for readability
 - extern for function prototypes

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-27 14:26:13 +04:00
Cyrill Gorcunov
f532e9fed2 net: sockets -- Use dprintk helper
Drop USK_DEBUG, we have dprintk which is active
if compiled with make DEBUG=1

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-27 14:26:02 +04:00
Cyrill Gorcunov
ccd5e2295f net: sockets -- Replace __u32 with u32
We provide such type in types.h.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-27 12:41:42 +04:00
Cyrill Gorcunov
4a015bba33 sockets: Use safe snprintf
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-27 00:17:24 +04:00
Pavel Emelyanov
c5eb61e866 Unix sockets initial support
Currently it can only work with stream sockets, which have no skbs in queues
(listening or established -- both work OK).

The cpt part uses the sock_diag engine that was merged to Dave recently to
collect sockets. Then it dumps sockets by checking the filesystem ID of a
failed-to-open through /proc/pid/fd descriptors (sockets do not allow for
such tricks with opens through proc) against SOCKFS_TYPE.

The rst part is more tricky. Listen sockets are just restored, this is simple.
Connected sockets are restored like this:

1. One end establishes a listening anon socket at the desired descriptor;
2. The other end just creates a socket at the desired descriptor;
3. All sockets, that are to be connect()-ed call connect. Unix sockets
   do not block connect() till the accept() time and thus we continue with...
4. ... all listening sockets call accept() and ... dup2 the new fd into the
   accepting end.

There's a problem with this approach -- socket names are not preserved, but
looking into our OpenVZ implementation I think this is OK for existing apps.

What should be done next is:

1. Need to merge the file IDs patches in our tree and make Andrey to
   support files sharing. This will solve the

	sk = socket();
	fork();

   case. Currently it simply doesn't work :(

2. Need to add support for DGRAM sockets -- I wrote comment how to do it
   in the can_dump_unix_sk()

3. Need to add support for in-flight connections

4. Implement support for UDP sockets (quite simple)

5. Implement support for listening TCP sockets (also not very complex)

6. Implement support for connected TCP scokets (hard one, Tejun's patches are not
   very good for this from my POV)

Cyrill, plz, apply this patch and put the above descriptions onto wiki docs (do we
have the plans page yet?).

Andrey, plz, take care of unix sockets tests in zdtm. Most likely it won't work till
you do the shared files support for sockets.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-26 23:25:04 +04:00