On Thu, Mar 09, 2017 at 04:23:05PM +0100, Ondrej Zajicek wrote:
If we are using the secondary remote AS mechanism, we don't necessarily need to restart an already established BGP connection if the remote AS for a BGP session changes, as long as the AS number that the peer is currently connected with is still in the list of AS numbers that we accept from the peer.
This commit will avoid reconfiguring a BGP protocol if there is a corresponding connection in OpenConfirm or Established state and the only change to the protocol configuration was related to remote AS numbers and the AS number that the peer is currently connected with is still a permitted remote AS number. This allows adding a secondary remote AS number to a BGP protocol without bouncing an already established BGP session for this protocol.
Well, the simple way to avoid reconfiguration in this case is just to move 'remote_as2' field at the end of bgp_config, like 'check_link' or 'bfd'.
Well, e.g. if remote_as is 12345 and the currently established peer AS is 12345, and you change remote_as from 12345 to 23456 and remote_as2 from 0 to 12345, you want to avoid doing the reconfigure. And if you keep remote_as at 12345 and set remote_as2 to 23456 by specifying the ASes the other way around, you would avoid the reconfigure if you leave remote_as2 outside the memcmp() field, but then when the other side completes its maintenance and you reestablish a connection with remote AS 23456, you would then set remote_as from 12345 to 23456 and remote_as2 from 23456 to 0, and that would then unnecessarily trigger a reconfigure as well because remote_as changes.