소스 검색

pkg/mesh: don't shadow privIface

This commit fixes a bug where the variable holding the index of the
private interface was shadowed, causing it to always be "0".

Signed-off-by: Lucas Servén Marín <lserven@gmail.com>
Lucas Servén Marín 5 년 전
부모
커밋
03545d674f
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      pkg/mesh/mesh.go

+ 1 - 1
pkg/mesh/mesh.go

@@ -131,7 +131,7 @@ func New(backend Backend, enc encapsulation.Encapsulator, granularity Granularit
 		if err != nil {
 		if err != nil {
 			return nil, fmt.Errorf("failed to find interface for private IP: %v", err)
 			return nil, fmt.Errorf("failed to find interface for private IP: %v", err)
 		}
 		}
-		privIface := ifaces[0].Index
+		privIface = ifaces[0].Index
 		if enc.Strategy() != encapsulation.Never {
 		if enc.Strategy() != encapsulation.Never {
 			if err := enc.Init(privIface); err != nil {
 			if err := enc.Init(privIface); err != nil {
 				return nil, fmt.Errorf("failed to initialize encapsulator: %v", err)
 				return nil, fmt.Errorf("failed to initialize encapsulator: %v", err)