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: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
Andrey Vagin 2012-09-17 20:05:49 +04:00 committed by Pavel Emelyanov
parent 8e90ed8c4d
commit fbea445df4

View file

@ -67,9 +67,11 @@ static int tcp_repair_establised(int fd, struct inet_sk_desc *sk)
goto err1;
}
ret = nf_lock_connection(sk);
if (ret < 0)
goto err2;
if (!(opts.namespaces_flags & CLONE_NEWNET)) {
ret = nf_lock_connection(sk);
if (ret < 0)
goto err2;
}
ret = tcp_repair_on(sk->rfd);
if (ret < 0)
@ -79,7 +81,8 @@ static int tcp_repair_establised(int fd, struct inet_sk_desc *sk)
return 0;
err3:
nf_unlock_connection(sk);
if (!(opts.namespaces_flags & CLONE_NEWNET))
nf_unlock_connection(sk);
err2:
close(sk->rfd);
err1: