Fix issue in ipv6 when a non-default link-local ipv6 address is present.

If the bridge exists and it exists with a different link local ip address
than fe80::1/64 then we waifl to accept that as a valid configuration without
trying to add the default link local ip address. With this fix we always try
to add the default link local address if it doesn't exist.

Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
This commit is contained in:
Jana Radhakrishnan 2015-05-12 23:35:15 +00:00
parent b9fc99be2c
commit 79556b1ccc
2 changed files with 3 additions and 2 deletions

View File

@ -190,7 +190,7 @@ func (ipv4 *IPv4AddrNoMatchError) Error() string {
type IPv6AddrNoMatchError net.IPNet
func (ipv6 *IPv6AddrNoMatchError) Error() string {
return fmt.Sprintf("bridge IPv6 addresses do not match the expected bridge configuration %s", ipv6)
return fmt.Sprintf("bridge IPv6 addresses do not match the expected bridge configuration %s", (*net.IPNet)(ipv6).String())
}
// InvalidLinkIPAddrError is returned when a link is configured to a container with an invalid ip address

View File

@ -34,7 +34,8 @@ func setupBridgeIPv6(config *NetworkConfiguration, i *bridgeInterface) error {
return err
}
if len(addrsv6) == 0 {
// Add the default link local ipv6 address if it doesn't exist
if !findIPv6Address(netlink.Addr{IPNet: bridgeIPv6}, addrsv6) {
if err := netlink.AddrAdd(i.Link, &netlink.Addr{IPNet: bridgeIPv6}); err != nil {
return &IPv6AddrAddError{ip: bridgeIPv6, err: err}
}