Commit 319b0534 authored by Andrey Vagin's avatar Andrey Vagin Committed by David S. Miller

tcp: allow to enable the repair mode for non-listening sockets

The repair mode is used to get and restore sequence numbers and
data from queues. It used to checkpoint/restore connections.

Currently the repair mode can be enabled for sockets in the established
and closed states, but for other states we have to dump the same socket
properties, so lets allow to enable repair mode for these sockets.

The repair mode reveals nothing more for sockets in other states.
Signed-off-by: default avatarAndrei Vagin <avagin@openvz.org>
Acked-by: default avatarPavel Emelyanov <xemul@openvz.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ceb980bc
...@@ -2300,7 +2300,7 @@ EXPORT_SYMBOL(tcp_disconnect); ...@@ -2300,7 +2300,7 @@ EXPORT_SYMBOL(tcp_disconnect);
static inline bool tcp_can_repair_sock(const struct sock *sk) static inline bool tcp_can_repair_sock(const struct sock *sk)
{ {
return ns_capable(sock_net(sk)->user_ns, CAP_NET_ADMIN) && return ns_capable(sock_net(sk)->user_ns, CAP_NET_ADMIN) &&
((1 << sk->sk_state) & (TCPF_CLOSE | TCPF_ESTABLISHED)); (sk->sk_state != TCP_LISTEN);
} }
static int tcp_repair_set_window(struct tcp_sock *tp, char __user *optbuf, int len) static int tcp_repair_set_window(struct tcp_sock *tp, char __user *optbuf, int len)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment