浏览代码

Lock linux namespace structure when adding neighbors

Signed-off-by: Santhosh Manohar <santhosh@docker.com>
Santhosh Manohar 8 年之前
父节点
当前提交
200410dd18
共有 1 个文件被更改,包括 2 次插入0 次删除
  1. 2 0
      libnetwork/osl/neigh_linux.go

+ 2 - 0
libnetwork/osl/neigh_linux.go

@@ -147,7 +147,9 @@ func (n *networkNamespace) AddNeighbor(dstIP net.IP, dstMac net.HardwareAddr, op
 		return fmt.Errorf("could not add neighbor entry: %v", err)
 	}
 
+	n.Lock()
 	n.neighbors = append(n.neighbors, nh)
+	n.Unlock()
 
 	return nil
 }