mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-31 22:35:33 +00:00
restore: disable repair mode in post_open()
A disabling repair mode drops SO_REUSEADDR. We can set SO_REUSEADDR after disabling repair mode, but a small race window exists in this case. Signed-off-by: Andrey Vagin <avagin@openvz.org> Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
committed by
Pavel Emelyanov
parent
c00038042d
commit
458cb41f57
19
sk-inet.c
19
sk-inet.c
@@ -403,16 +403,23 @@ static int inet_validate_address(InetSkEntry *ie)
|
||||
static int post_open_inet_sk(struct file_desc *d, int sk)
|
||||
{
|
||||
struct inet_sk_info *ii;
|
||||
int no = 0;
|
||||
int val;
|
||||
|
||||
ii = container_of(d, struct inet_sk_info, d);
|
||||
|
||||
if (!ii->ie->opts->reuseaddr) {
|
||||
futex_wait_until(&ii->port->users, 0);
|
||||
/* SO_REUSEADDR is set for all sockets */
|
||||
if (!tcp_connection(ii->ie) && ii->ie->opts->reuseaddr)
|
||||
return 0;
|
||||
|
||||
if (restore_opt(sk, SOL_SOCKET, SO_REUSEADDR, &no))
|
||||
return -1;
|
||||
}
|
||||
futex_wait_until(&ii->port->users, 0);
|
||||
|
||||
/* Disabling repair mode drops SO_REUSEADDR */
|
||||
if (tcp_connection(ii->ie))
|
||||
tcp_repair_off(sk);
|
||||
|
||||
val = ii->ie->opts->reuseaddr;
|
||||
if (restore_opt(sk, SOL_SOCKET, SO_REUSEADDR, &val))
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user