Do not lock network if running in the host network namespace

Submitted by Adrian Reber on Nov. 29, 2018, 9:24 a.m.

Details

Message ID 1543483441-15407-1-git-send-email-adrian@lisas.de
State Accepted
Series "Do not lock network if running in the host network namespace"
Headers show

Commit Message

Adrian Reber Nov. 29, 2018, 9:24 a.m.
From: Adrian Reber <areber@redhat.com>

Related: https://github.com/checkpoint-restore/criu/issues/577

Restoring a runc container which is running in the host's network
namespace locked the network (iptables-restore) without unlocking it.

This disables network logging if running in the host's network
namespace.

Suggested-by: Andrei Vagin <avagin@gmail.com>
Signed-off-by: Adrian Reber <areber@redhat.com>
---
 criu/cr-restore.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/criu/cr-restore.c b/criu/cr-restore.c
index 6086d65..d8fe352 100644
--- a/criu/cr-restore.c
+++ b/criu/cr-restore.c
@@ -2135,7 +2135,7 @@  static int restore_root_task(struct pstree_item *init)
 			goto out_kill;
 	}
 
-	if (opts.empty_ns & CLONE_NEWNET) {
+	if (root_ns_mask & opts.empty_ns & CLONE_NEWNET) {
 		/*
 		 * Local TCP connections were locked by network_lock_internal()
 		 * on dump and normally should have been C/R-ed by respectively

Comments

Andrei Vagin Dec. 4, 2018, 7:53 a.m.
Applied, thanks!

On Thu, Nov 29, 2018 at 09:24:01AM +0000, Adrian Reber wrote:
> From: Adrian Reber <areber@redhat.com>
> 
> Related: https://github.com/checkpoint-restore/criu/issues/577
> 
> Restoring a runc container which is running in the host's network
> namespace locked the network (iptables-restore) without unlocking it.
> 
> This disables network logging if running in the host's network
> namespace.
> 
> Suggested-by: Andrei Vagin <avagin@gmail.com>
> Signed-off-by: Adrian Reber <areber@redhat.com>
> ---
>  criu/cr-restore.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/criu/cr-restore.c b/criu/cr-restore.c
> index 6086d65..d8fe352 100644
> --- a/criu/cr-restore.c
> +++ b/criu/cr-restore.c
> @@ -2135,7 +2135,7 @@ static int restore_root_task(struct pstree_item *init)
>  			goto out_kill;
>  	}
>  
> -	if (opts.empty_ns & CLONE_NEWNET) {
> +	if (root_ns_mask & opts.empty_ns & CLONE_NEWNET) {
>  		/*
>  		 * Local TCP connections were locked by network_lock_internal()
>  		 * on dump and normally should have been C/R-ed by respectively
> -- 
> 1.8.3.1
>