Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use configured local address over the one that is taken from the BGP session #2827

Closed
wants to merge 1 commit into from

Conversation

barlev-eddie
Copy link

Use configured local address over the one that is taken from the BGP TCP connection.

This is needed in cases when using VRFs over GENEVE Tunnels where we bind the listening address to one internal IP for security reasons. Without this fix the local address was overridden with the listening address resulting in wrong nexthop advertisement.

…session.

This is needed in cases when using VRFs over GENEVE Tunnels where we bind the listening address to one internal IP for security reasons.
Without this fix the local address was overridden with the listening address resulting in wrong nexthop advertisement.
@@ -879,6 +879,9 @@ 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 != "0.0.0.0" {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be != ""?

Copy link
Author

@barlev-eddie barlev-eddie Aug 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was my initial change and then when tested things didnt worked as expected. So, added a log and this is the value I got. You think I should add also != "" ?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@barlev-eddie maybe we can use STDLIB to check localhost, what will happen when user uses 127.0.0.1 / localhost fqdn?

@fujita
Copy link
Member

fujita commented Sep 26, 2024

Pushed, thanks. IPv4Unspecified() is better than 0.0.0.0, I guess though.

@fujita fujita closed this Sep 26, 2024
@barlev-eddie
Copy link
Author

@fujita , thanks for handling it. I forgot about it due to family and work load. Do u want me to open another PR to change to the IPv4Unspecified() call ?

@fujita
Copy link
Member

fujita commented Sep 26, 2024

Yeah, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants