mirror of
https://github.com/clearlinux/libnetwork.git
synced 2026-05-14 10:33:46 +00:00
Fixed a bug in bridge driver where when the bridge already exists
the bridgeInterface.bridgeIPv4 is not getting initialized properly Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
This commit is contained in:
@@ -156,7 +156,7 @@ func (d *driver) CreateNetwork(id driverapi.UUID, option interface{}) error {
|
||||
|
||||
// We ensure that the bridge has the expectedIPv4 and IPv6 addresses in
|
||||
// the case of a previously existing device.
|
||||
{bridgeAlreadyExists, setupVerifyConfiguredAddresses},
|
||||
{bridgeAlreadyExists, setupVerifyAndReconcile},
|
||||
|
||||
// Setup the bridge to allocate containers IPv4 addresses in the
|
||||
// specified subnet.
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"github.com/vishvananda/netlink"
|
||||
)
|
||||
|
||||
func setupVerifyConfiguredAddresses(config *Configuration, i *bridgeInterface) error {
|
||||
func setupVerifyAndReconcile(config *Configuration, i *bridgeInterface) error {
|
||||
// Fetch a single IPv4 and a slice of IPv6 addresses from the bridge.
|
||||
addrv4, addrsv6, err := i.addresses()
|
||||
if err != nil {
|
||||
@@ -29,6 +29,12 @@ func setupVerifyConfiguredAddresses(config *Configuration, i *bridgeInterface) e
|
||||
return fmt.Errorf("Bridge IPv6 addresses do not match the expected bridge configuration %s", bridgeIPv6)
|
||||
}
|
||||
|
||||
// By this time we have either configured a new bridge with an IP address
|
||||
// or made sure an existing bridge's IP matches the configuration
|
||||
// Now is the time to cache these states in the bridgeInterface.
|
||||
i.bridgeIPv4 = addrv4.IPNet
|
||||
i.bridgeIPv6 = bridgeIPv6
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user