Skip to content

Commit

Permalink
keep nse container net ns open until close is done
Browse files Browse the repository at this point in the history
Signed-off-by: Periyasamy Palanisamy <periyasamy.palanisamy@est.tech>
  • Loading branch information
pperiyasamy committed Sep 9, 2021
1 parent 28d8426 commit f981f52
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pkg/kernel/networkservice/inject/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,13 @@ func move(ctx context.Context, conn *networkservice.Connection, isClient, isMove
if !contNetNS.IsOpen() && isMoveBack {
contNetNS = vfConfig.ContNetNS
}
defer func() { _ = contNetNS.Close() }()

// keep NSE container's net ns open until connection close is done,.
// this would properly move back VF into host net namespace even when
// container is accidentally deleted before close.
if !isClient || isMoveBack {
defer func() { _ = contNetNS.Close() }()
}

ifName := mech.GetInterfaceName()
if !isMoveBack {
Expand Down

0 comments on commit f981f52

Please sign in to comment.