fix: ipv6 static default gateway not set if gateway is a LL unicast address

The source address is set by default, which leads to RNETLINK
errors, when the Global Unicast Address is passed as a Source
to a LL Unicast Gateway. Errors of RTNETLINK are now logged.

Signed-off-by: Frederik Schwan <frederik.schwan@linux.com>
This commit is contained in:
Frederik Schwan 2020-04-30 02:13:58 +02:00 committed by talos-bot
parent 0204feeb0b
commit f57d05e02a

View File

@ -367,9 +367,15 @@ func (n *NetworkInterface) configureInterface(method address.Addressing, link *n
gw = nil gw = nil
} }
// Any errors here would be non-fatal, so we'll just ignore them src := method.Address()
//nolint: errcheck // if destination is the ipv6 route,and gateway is LL do not pass a src address to set the default geteway
n.rtnlConn.RouteAddSrc(method.Link(), *r.Dest, method.Address(), gw) if net.IPv6zero.Equal(r.Dest.IP) && gw.IsLinkLocalUnicast() {
src = nil
}
if err := n.rtnlConn.RouteAddSrc(method.Link(), *r.Dest, src, gw); err != nil {
log.Println("failed to configure route: " + err.Error())
}
} }
return nil return nil