Skip to content

Cannot re-use peer address #2893

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

Open
wez470 opened this issue Mar 11, 2025 · 0 comments
Open

Cannot re-use peer address #2893

wez470 opened this issue Mar 11, 2025 · 0 comments

Comments

@wez470
Copy link

wez470 commented Mar 11, 2025

Doing an action like below will cause an err

peer1 := &api.Peer{
	Conf: &api.PeerConf{
		NeighborAddress: "127.0.0.1",
		PeerAsn:         11111,
	},
	Transport: &api.Transport{
		RemotePort: 10179,
	},
	Timers: &api.Timers{
		Config: &api.TimersConfig{
			ConnectRetry:           1,
			IdleHoldTimeAfterReset: 1,
		},
	},
}
myBGPServer.AddPeer(context.Background(), &api.AddPeerRequest{Peer: peer1})
peer2 := &api.Peer{
	Conf: &api.PeerConf{
		NeighborAddress: "127.0.0.1",
		PeerAsn:         22222,
	},
	Transport: &api.Transport{
		RemotePort: 20179,
	},
	Timers: &api.Timers{
		Config: &api.TimersConfig{
			ConnectRetry:           1,
			IdleHoldTimeAfterReset: 1,
		},
	},
}
err := myBGPServer.AddPeer(context.Background(), &api.AddPeerRequest{Peer: peer2})
fmt.Println(err)

can't overwrite the existing peer: 127.0.0.1

Because the neighbour map uses address string only as the key. You can bypass this one time on local by changing one of the peers to "localhost". It would be useful (mostly for testing) if the PeerAsn was used as part of the neighbour map key so multiple peers can live at a single address.

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

No branches or pull requests

1 participant