mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
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:
parent
b9fc99be2c
commit
79556b1ccc
2 changed files with 3 additions and 2 deletions
|
@ -190,7 +190,7 @@ func (ipv4 *IPv4AddrNoMatchError) Error() string {
|
||||||
type IPv6AddrNoMatchError net.IPNet
|
type IPv6AddrNoMatchError net.IPNet
|
||||||
|
|
||||||
func (ipv6 *IPv6AddrNoMatchError) Error() string {
|
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
|
// InvalidLinkIPAddrError is returned when a link is configured to a container with an invalid ip address
|
||||||
|
|
|
@ -34,7 +34,8 @@ func setupBridgeIPv6(config *NetworkConfiguration, i *bridgeInterface) error {
|
||||||
return err
|
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 {
|
if err := netlink.AddrAdd(i.Link, &netlink.Addr{IPNet: bridgeIPv6}); err != nil {
|
||||||
return &IPv6AddrAddError{ip: bridgeIPv6, err: err}
|
return &IPv6AddrAddError{ip: bridgeIPv6, err: err}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue