bio-routing / bio-rd

bio routing is a project to create a versatile, fast and reliable routing daemon in Golang. bio = BGP + IS-IS + OSPF
Apache License 2.0
283 stars 44 forks source link

Enable SO_REUSEPORT #464

Closed netixx closed 2 months ago

netixx commented 4 months ago

Enable SO_REUSEPORT on the TCP socket,

This enables multiple instances of the BGP server to be started on the same machine, binding to the same TCP port.

The kernel will load-balance the incoming connections to all listening instances. Instances that have the correct BGP peers configured will take the connection, and those who don't will reject it, letting another instance have a try when the router restarts the connection.

taktv6 commented 4 months ago

Thanks for contributing. LGTM in general. But I think we should make this configurable to avoid confusion for those who accidentally start multiple instances they didn't intent to.

netixx commented 4 months ago

ok, I added an option on the BGP server itself.

Maybe it would be better to push a list of options in the ListenAddrsPerVRF, so that we could set that per listener, but that is breaking change in terms of API.

( Instead of map[string][]string we would need a

map[string]struct{
listenAddr []string
reusePort bool
}

)

Let me know if you would prefer that option :)