Commit fbea445d authored by Andrey Vagin's avatar Andrey Vagin Committed by Pavel Emelyanov

cd-dump: lock connection with iptables rules only in a current netns

For another netns we don't need to lock separate connections,
an external chanel can be locked.
Signed-off-by: 's avatarAndrey Vagin <avagin@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 8e90ed8c
...@@ -67,9 +67,11 @@ static int tcp_repair_establised(int fd, struct inet_sk_desc *sk) ...@@ -67,9 +67,11 @@ static int tcp_repair_establised(int fd, struct inet_sk_desc *sk)
goto err1; goto err1;
} }
if (!(opts.namespaces_flags & CLONE_NEWNET)) {
ret = nf_lock_connection(sk); ret = nf_lock_connection(sk);
if (ret < 0) if (ret < 0)
goto err2; goto err2;
}
ret = tcp_repair_on(sk->rfd); ret = tcp_repair_on(sk->rfd);
if (ret < 0) if (ret < 0)
...@@ -79,6 +81,7 @@ static int tcp_repair_establised(int fd, struct inet_sk_desc *sk) ...@@ -79,6 +81,7 @@ static int tcp_repair_establised(int fd, struct inet_sk_desc *sk)
return 0; return 0;
err3: err3:
if (!(opts.namespaces_flags & CLONE_NEWNET))
nf_unlock_connection(sk); nf_unlock_connection(sk);
err2: err2:
close(sk->rfd); close(sk->rfd);
......
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