Skip to content

Commit

Permalink
Re-allow unspecified IPv6 local transport address
Browse files Browse the repository at this point in the history
Fix regression introduced by 832b2d9
which breaks peerings with unspecified IPv6 local transport address.

Signed-off-by: Rastislav Szabo <[email protected]>
  • Loading branch information
rastislavs committed Oct 7, 2024
1 parent 313096d commit c675324
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -880,7 +880,7 @@ func (s *BgpServer) toConfig(peer *peer, getAdvertised bool) *oc.Neighbor {
if state == bgp.BGP_FSM_ESTABLISHED {
peer.fsm.lock.RLock()
conf.Transport.State.LocalAddress, conf.Transport.State.LocalPort = peer.fsm.LocalHostPort()
if conf.Transport.Config.LocalAddress != netip.IPv4Unspecified().String() {
if conf.Transport.Config.LocalAddress != netip.IPv4Unspecified().String() && conf.Transport.Config.LocalAddress != netip.IPv6Unspecified().String() {
conf.Transport.State.LocalAddress = conf.Transport.Config.LocalAddress
}
_, conf.Transport.State.RemotePort = peer.fsm.RemoteHostPort()
Expand Down Expand Up @@ -1620,7 +1620,7 @@ func (s *BgpServer) handleFSMMessage(peer *peer, e *fsmMsg) {
// exclude zone info
ipaddr, _ := net.ResolveIPAddr("ip", laddr)
peer.fsm.peerInfo.LocalAddress = ipaddr.IP
if peer.fsm.pConf.Transport.Config.LocalAddress != netip.IPv4Unspecified().String() {
if peer.fsm.pConf.Transport.Config.LocalAddress != netip.IPv4Unspecified().String() && peer.fsm.pConf.Transport.Config.LocalAddress != netip.IPv6Unspecified().String() {
peer.fsm.peerInfo.LocalAddress = net.ParseIP(peer.fsm.pConf.Transport.Config.LocalAddress)
peer.fsm.pConf.Transport.State.LocalAddress = peer.fsm.pConf.Transport.Config.LocalAddress
}
Expand Down

0 comments on commit c675324

Please sign in to comment.