* 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 with any conforming
implementation, and it should speed up things and make things more
robust. So do so.
* bgp_packet.c: (bgp_open_receive) Update the comment.
* bgp_fsm_{quagga,4271}.dot: Graphviz DOT files to document the BGP FSM
somewhat, for both Quagga and the basics of 4271. May contain
errors, and could do with more work, but hopefully a useful start.
Note: The Cumulus "Fix FSM to handle active/passive connections better"
patch also makes this change, amongst other things.
---
Been staring at the FSM. Mostly for discussion, but seems this change might
speed up Quagga FSM a bit, and maybe even fix some wedgies, esp with any
implementations that do DelayOpen. (??)
bgpd/bgp_fsm.c | 3 +--
bgpd/bgp_fsm_4271.dot | 34 ++++++++++++++++++++++++++++
bgpd/bgp_fsm_quagga.dot | 59 +++++++++++++++++++++++++++++++++++++++++++++++++
bgpd/bgp_packet.c | 3 +++
4 files changed, 97 insertions(+), 2 deletions(-)
create mode 100644 bgpd/bgp_fsm_4271.dot
create mode 100644 bgpd/bgp_fsm_quagga.dot
diff --git a/bgpd/bgp_fsm.c b/bgpd/bgp_fsm.c
index c4cfd58..8612383 100644
--- a/bgpd/bgp_fsm.c
+++ b/bgpd/bgp_fsm.c
@@ -655,8 +655,7 @@ bgp_connect_success (struct peer *peer)
zlog_debug ("%s passive open", peer->host);
}
- if (! CHECK_FLAG (peer->sflags, PEER_STATUS_ACCEPT_PEER))
- bgp_open_send (peer);
+ bgp_open_send (peer);
return 0;
}
diff --git a/bgpd/bgp_fsm_4271.dot b/bgpd/bgp_fsm_4271.dot
new file mode 100644
index 0000000..c03939f
--- /dev/null
+++ b/bgpd/bgp_fsm_4271.dot
@@ -0,0 +1,34 @@
+digraph {
+ rankdir=LR
+ //concentrate=true
+ nojustify="true"
+
+ Idle -> Connect [ label="ManualStart\l|AutomaticStart" ]
+ Idle -> Active [
label="ManualStart_with_PassiveTcpEstablishment\l|AutomaticStart_with_PassiveTcpEstablishment"
]
+
+ Connect -> Idle [ label="ManualStop"]
+ Connect -> Connect [
label="ConnectRetryTimer_Expires\l|TcpConnection_Valid\l|Tcp_CR_Invalid\l|Tcp_CR_Acked
&& DelayOpen == True\l|TcpConnectionConfirmed && DelayOpen == True\l" ]
+ Connect -> OpenSent [ label="DelayOpenTimer_Expires\l|Tcp_CR_Acked &&
DelayOpen == False\l|TcpConnectionConfirmed && DelayOpen == False\l" ]
+ Connect -> Active [ label="TcpConnectionFails && DelayOpenTimer ==
\"running\"\l" ]
+ Connect -> Idle [ label="TcpConnectionFails && DelayOpenTimer == \"not
running\"\l" ]
+ Connect -> OpenConfirm [ label="BGPOpen && DelayOpenTimer == \"running\"" ]
+ Connect -> Idle [ label="NotifMsg|*\l" ]
+
+ Active -> Idle [ label="ManualStop\l|TcpConnectionFails\l|NotifMsg|*" ]
+ Active -> Connect [ label="ConnectRetryTimer_Expires" ]
+ Active -> OpenSent [ label="DelayOpenTimer_Expires" ]
+ Active -> Active [ label="(Tcp_CR_Acked\l|TcpConnectionConfirmed)\l&&
DelayOpen = True" ]
+ Active -> OpenSent [ label="(Tcp_CR_Acked|TcpConnectionConfirmed)\l&&
DelayOpen = False" ]
+ Active -> OpenConfirm [ label="BGPOpen && DelayOpenTimer == \"running\"" ]
+
+ OpenSent -> Idle [
label="ManualStop\l|AutomaticStop\l|HoldTimer_Expires\l|NotifMsg\l|OpenCollisionDump\l"
]
+ OpenSent -> Active [ label="TcpConnectionFails" ]
+ OpenSent -> OpenConfirm [ label="BGPOpen" ]
+
+ OpenConfirm -> Idle [
label="ManualStop\l|AutomaticStop\l|HoldTimer_Expires\l|TcpConnectionFails\l|NotifMsg\l|BGPOpen|*\l"]
+ OpenConfirm -> Established [ label="KeepAliveMsg|"]
+ OpenConfirm -> OpenConfirm [ label="KeepaliveTimer_Expires" ]
+
+ Established -> Idle [ label="OpenCollisionDump|*"]
+ Established -> Established [ label="Tcp_CR_Invalid|KeepAliveMsg|UpdateMsg"]
+}
\ No newline at end of file
diff --git a/bgpd/bgp_fsm_quagga.dot b/bgpd/bgp_fsm_quagga.dot
new file mode 100644
index 0000000..2b9bee8
--- /dev/null
+++ b/bgpd/bgp_fsm_quagga.dot
@@ -0,0 +1,59 @@
+digraph {
+ rankdir=LR
+ //concentrate=true
+ nojustify="true"
+
+ Idle
+ Connect
+ Active
+ OpenSent
+ OpenConfirm
+ Established
+ Clearing
+ Idle -> Deleted
+ Configured -> Idle
+
+ Idle -> Connect [ label="BGP_Start\l/bgp_start\l" ]
+ Idle -> Idle [
label="BGP_Stop\l|TCP_connection_open\l|TCP_connection_closed\l|TCP_fatal_error\l/bgp_stop\l"]
+
+ Connect -> Connect [ label="ConnectRetry_timer_expired\l/bgp_reconnect\l" ]
+ Connect -> Idle [
label="BGP_Stop\l|TCP_connection_open\l|Receive_NOTIFICATION_message\l/bgp_stop\l"
]
+ Connect -> Idle [ label="TCP_fatal_error\l/bgp_connect_fail\l" ]
+ Connect -> Idle [
label="Hold_Timer_expired\l|KeepAlive_timer_expired\l|Receive_OPEN_message\l|Receive_KEEPALIVE_message\l|Receive_UPDATE_message\l|Clearing_Completed\l/bgp_ignore"]
+ Connect -> OpenSent [ label="TCP_connection_open\l/bgp_connect_success\l" ]
+ Connect -> Active [ label="TCP_connection_open_failed\l/bgp_connect_fail\l" ]
+
+ Active -> Idle [ label="BGP_Stop\l|TCP_connection_closed\l/bgp_stop\l" ]
+ Active -> Idle [
label="Receive_NOTIFICATION_message\l/bgp_stop_with_error\l" ]
+ Active -> Idle [
label="TCP_fatal_error\l|Hold_Timer_expired\l|KeepAlive_timer_expired\l|Receive_OPEN_message\l|Receive_KEEPALIVE_message\l|Receive_UPDATE_message\l|Clearing_Completed\l/bgp_ignore\l"
]
+ Active -> OpenSent [ label="TCP_connection_open\l/bgp_connect_success\l" ]
+ Active -> Connect [ label="ConnectRetry_timer_expiredl/bgp_start\l" ]
+
+ Accept -> Active [ label="Raise TCP_connection_open on Active" ]
+
+ OpenSent -> Idle [ label="BGP_Stop\l/bgp_stop\l" ]
+ OpenSent -> Idle [
label="ConnectRetry_timer_expired\l|Clearing_Completed\l|KeepAlive_timer_expired\l/bgp_ignore\l"
]
+ OpenSent -> Idle [ label="Hold_Timer_expired\l/bgp_fsm_holdtime_expire\l"]
+ OpenSent -> Idle [
label="Receive_KEEPALIVE_message\l|Receive_UPDATE_message\l/bgp_fsm_event_error"
]
+ OpenSent -> Idle [
label="Receive_NOTIFICATION_message\l/bgp_stop_with_error" ]
+ OpenSent -> Active [
label="TCP_connection_open\l|TCP_connection_closed\l|TCP_connection_open_failed\l|TCP_fatal_error\l/bgp_stop\l"]
+ OpenSent -> OpenConfirm [ label="Receive_OPEN_message\l/bgp_fsm_open" ]
+
+ OpenConfirm -> Idle [
label="BGP_Stop\l|TCP_connection_open\l|TCP_connection_closed\l|TCP_connection_open_failed\l|TCP_fatal_error\l/bgp_stop\l"]
+ OpenConfirm -> Idle [ label="Hold_Timer_expired\l/bgp_fsm_holdtime_expire" ]
+ OpenConfirm -> Idle [
label="ConnectRetry_timer_expired\l|Receive_OPEN_message\l|Receive_UPDATE_message\l|Clearing_Completed\l/bgp_ignore"]
+ OpenConfirm -> Idle [
label="Receive_NOTIFICATION_message\l/bgp_stop_with_error\l" ]
+ OpenConfirm -> Established [
label="Receive_KEEPALIVE_message\l/bgp_establish\l" ]
+
+ Established -> Clearing [
label="BGP_Stop\l|TCP_connection_open\l|TCP_connection_closed\l|TCP_connection_open_failed\l|TCP_fatal_error\l|ConnectRetry_timer_expired\l|Hold_Timer_expired\l|Receive_OPEN_message\l/bgp_stop\l"]
+ Established -> Idle [ label="Clearing_Completed\l/bgp_ignore" ]
+ Established -> Clearing [
label="Receive_NOTIFICATION_message\l/bgp_stop_with_error"]
+
+ Clearing -> Idle [ label="Clearing_Completed\l/bgp_clearing_completed" ]
+ subgraph cluster_pre_collision_detect {
+ label="Prior to collision detection"
+ bgcolor=lightgray
+ Connect Accept Active OpenSent OpenConfirm
+ }
+
+}
\ No newline at end of file
diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c
index 740b0f1..464118f 100644
--- a/bgpd/bgp_packet.c
+++ b/bgpd/bgp_packet.c
@@ -1407,6 +1407,9 @@ bgp_open_receive (struct peer *peer, bgp_size_t size)
* Connect Connect
*
*
+ * Note that Active->OpenSent historically in Quagga did not send
+ * OPEN on the accept-peer connection.
+ *
* If both sides are Quagga, they're almost certain to wait for
* the same amount of time of course (which doesn't preclude other
* implementations also waiting for same time). The race is
--
2.5.5
_______________________________________________
Quagga-dev mailing list
[email protected]
https://lists.quagga.net/mailman/listinfo/quagga-dev