mirror of
https://github.com/cloudnativelabs/kube-router.git
synced 2025-11-19 20:11:36 +01:00
fix(bgp_peers): do peer only if IP protos match
For configured BGP peers only attempt peering if IP protos match, otherwise skip and log warning
This commit is contained in:
parent
0023dedc4d
commit
c491bcb48d
@ -216,12 +216,18 @@ func (nrc *NetworkRoutingController) connectToExternalBGPPeers(server *gobgp.Bgp
|
|||||||
neighborIPStr)
|
neighborIPStr)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
peeringAddressForNeighbor := net.ParseIP(n.Transport.LocalAddress)
|
||||||
|
if peeringAddressForNeighbor == nil {
|
||||||
|
klog.Errorf("unable to parse our local address for peer (%s), not peering with this peer (%s)",
|
||||||
|
n.Transport.LocalAddress, neighborIPStr)
|
||||||
|
}
|
||||||
|
|
||||||
neighborIsIPv4 := neighborIP.To4() != nil
|
neighborIsIPv4 := neighborIP.To4() != nil
|
||||||
primaryIsIPv4 := nrc.primaryIP.To4() != nil
|
peeringAddressIsIPv4 := peeringAddressForNeighbor.To4() != nil
|
||||||
if neighborIsIPv4 != primaryIsIPv4 {
|
if neighborIsIPv4 != peeringAddressIsIPv4 {
|
||||||
klog.Warningf("Not peering with configured peer as it's primary IP (%s) uses a different "+
|
klog.Warningf("Not peering with configured peer as it's primary IP (%s) uses a different "+
|
||||||
"protocol than our primary IP (%s)", neighborIP, nrc.primaryIP)
|
"protocol than our configured local-address (%s). Its possible that this can be resolved by setting "+
|
||||||
|
"the local address appropriately", neighborIP, peeringAddressForNeighbor)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user