[CRIU] [PATCH cr 2/2] sk-inet: restore option REUSEADDR

Andrey Vagin avagin at openvz.org
Thu Aug 16 09:45:13 EDT 2012


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.

Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
 include/sk-inet.h      |    2 +
 protobuf/sk-opts.proto |    1 +
 sk-inet.c              |   81 ++++++++++++++++++++++++++++++++++++++++++++++--
 sockets.c              |    9 +++++-
 4 files changed, 89 insertions(+), 4 deletions(-)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-sk-inet-restore-option-REUSEADDR.patch
Type: text/x-patch
Size: 5335 bytes
Desc: not available
Url : http://openvz.org/pipermail/criu/attachments/20120816/5c574a2e/0002-sk-inet-restore-option-REUSEADDR.bin


More information about the CRIU mailing list