1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05: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:
Jana Radhakrishnan 2015-04-16 05:02:21 +00:00
parent 56c3adda07
commit b0a38a0d1b
2 changed files with 8 additions and 2 deletions

View file

@ -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 // We ensure that the bridge has the expectedIPv4 and IPv6 addresses in
// the case of a previously existing device. // the case of a previously existing device.
{bridgeAlreadyExists, setupVerifyConfiguredAddresses}, {bridgeAlreadyExists, setupVerifyAndReconcile},
// Setup the bridge to allocate containers IPv4 addresses in the // Setup the bridge to allocate containers IPv4 addresses in the
// specified subnet. // specified subnet.

View file

@ -6,7 +6,7 @@ import (
"github.com/vishvananda/netlink" "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. // Fetch a single IPv4 and a slice of IPv6 addresses from the bridge.
addrv4, addrsv6, err := i.addresses() addrv4, addrsv6, err := i.addresses()
if err != nil { 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) 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 return nil
} }