mirror of
https://github.com/cloudnativelabs/kube-router.git
synced 2025-11-18 19:41:05 +01:00
fix(NRC): error when nec. host IP not found
If we can't find an appropriate IP to add for nextHop to injectRoute or overlay tunnel, raise error rather than trying to continue.
This commit is contained in:
parent
4f284be53e
commit
0023dedc4d
@ -657,6 +657,10 @@ func (nrc *NetworkRoutingController) injectRoute(path *gobgpapi.Path) error {
|
||||
// Need to activate the ip command in IPv6 mode
|
||||
bestIPForFamily = utils.FindBestIPv6NodeAddress(nrc.primaryIP, nrc.nodeIPv6Addrs)
|
||||
}
|
||||
if bestIPForFamily == nil {
|
||||
return fmt.Errorf("not able to find an appropriate configured IP address on node for destination "+
|
||||
"IP family: %s", dst.String())
|
||||
}
|
||||
route = &netlink.Route{
|
||||
LinkIndex: link.Attrs().Index,
|
||||
Src: bestIPForFamily,
|
||||
@ -734,6 +738,10 @@ func (nrc *NetworkRoutingController) setupOverlayTunnel(tunnelName string, nextH
|
||||
bestIPForFamily = utils.FindBestIPv6NodeAddress(nrc.primaryIP, nrc.nodeIPv6Addrs)
|
||||
ipipMode = "ip6ip6"
|
||||
}
|
||||
if nil == bestIPForFamily {
|
||||
return nil, fmt.Errorf("not able to find an appropriate configured IP address on node for destination "+
|
||||
"IP family: %s", nextHop.String())
|
||||
}
|
||||
|
||||
// an error here indicates that the tunnel didn't exist, so we need to create it, if it already exists there's
|
||||
// nothing to do here
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user