bgpd: Send OPEN immediately on inbound connections

* bgpd_fsm.c: (bgp_connect_success) This is the transition function
  called when TCP_connection_open occurs in Connect or Active.  It
  sends OPEN, but only for a !ACCEPT_PEER.  I.e.  only on the local
  bgpd's outbound connection.

  This means OPEN will never be sent on a received connection, until
  OPEN is received on it.  Which means if the remote peer delays
  sending its OPEN on such an inbound connection, the local peer might
  hit a timer (e.g.  connectretry) before then and reset.

  There should be no harm in sending OPEN ASAP on any new connection
  with any conforming implementation, indeed this is supposed to be the
  behaviour.  It should speed up things, decrease the window in which
  collision detection could be hit, and make things more robust.  So do
  so.

* bgp_packet.c: (bgp_open_receive) Update the comment.
  Do not send bgp_open_send on the ACCEPT_PEER connection that has just
  been transferred over, that's now done in bgp_connect_success, as it
  should be.

  The accept peer's output fifo must also be transferred over, to
  ensure the Open gets sent, if not already, and the write thread state
  replicated accordingly.

* bgp_network.c: (bgp_accept) local AS config needs to set, so we can
  send Open early on ACCEPT_PEER connections.

Note: The Cumulus "Fix FSM to handle active/passive connections better"
patch also makes this change, amongst other things.
3 files changed