Преглед изворни кода

Merge pull request #1131 from msabansal/staticip

Static ip support for windows
Alessandro Boch пре 9 година
родитељ
комит
57a91d9153
1 измењених фајлова са 11 додато и 2 уклоњено
  1. 11 2
      libnetwork/drivers/windows/windows.go

+ 11 - 2
libnetwork/drivers/windows/windows.go

@@ -417,6 +417,10 @@ func (d *driver) CreateEndpoint(nid, eid string, ifInfo driverapi.InterfaceInfo,
 	}
 	}
 	endpointStruct.Policies = append(endpointStruct.Policies, qosPolicies...)
 	endpointStruct.Policies = append(endpointStruct.Policies, qosPolicies...)
 
 
+	if ifInfo.Address() != nil {
+		endpointStruct.IPAddress = ifInfo.Address().IP
+	}
+
 	configurationb, err := json.Marshal(endpointStruct)
 	configurationb, err := json.Marshal(endpointStruct)
 	if err != nil {
 	if err != nil {
 		return err
 		return err
@@ -452,8 +456,13 @@ func (d *driver) CreateEndpoint(nid, eid string, ifInfo driverapi.InterfaceInfo,
 	n.endpoints[eid] = endpoint
 	n.endpoints[eid] = endpoint
 	n.Unlock()
 	n.Unlock()
 
 
-	ifInfo.SetIPAddress(endpoint.addr)
-	ifInfo.SetMacAddress(endpoint.macAddress)
+	if ifInfo.Address() == nil {
+		ifInfo.SetIPAddress(endpoint.addr)
+	}
+
+	if macAddress == nil {
+		ifInfo.SetMacAddress(endpoint.macAddress)
+	}
 
 
 	return nil
 	return nil
 }
 }