[CRIU] [PATCH cr 2/4] sk-inet: restore option REUSEADDR (v2)
Andrey Vagin
avagin at openvz.org
Mon Aug 20 09:41:11 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.
v2: fix according with comments from Pavel
Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
include/sk-inet.h | 2 +
protobuf/sk-opts.proto | 1 +
sk-inet.c | 77 ++++++++++++++++++++++++++++++++++++++++++++++--
sockets.c | 8 ++++-
4 files changed, 84 insertions(+), 4 deletions(-)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-sk-inet-restore-option-REUSEADDR-v2.patch
Type: text/x-patch
Size: 4767 bytes
Desc: not available
Url : http://openvz.org/pipermail/criu/attachments/20120820/22145302/0002-sk-inet-restore-option-REUSEADDR-v2.bin
More information about the CRIU
mailing list