From 43a2b083e87079802ab67f4918fc0686101c7f31 Mon Sep 17 00:00:00 2001 From: msabansal Date: Wed, 20 Apr 2016 15:44:32 -0700 Subject: [PATCH] Static ip support for windows Signed-off-by: msabansal --- libnetwork/drivers/windows/windows.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/libnetwork/drivers/windows/windows.go b/libnetwork/drivers/windows/windows.go index 9a98a98b6b..aa4c7e5808 100644 --- a/libnetwork/drivers/windows/windows.go +++ b/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...) + if ifInfo.Address() != nil { + endpointStruct.IPAddress = ifInfo.Address().IP + } + configurationb, err := json.Marshal(endpointStruct) if err != nil { return err @@ -452,8 +456,13 @@ func (d *driver) CreateEndpoint(nid, eid string, ifInfo driverapi.InterfaceInfo, n.endpoints[eid] = endpoint 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 }