summaryrefslogtreecommitdiffstats
path: root/bgpd/bgp_msg_write.c
diff options
context:
space:
mode:
Diffstat (limited to 'bgpd/bgp_msg_write.c')
-rw-r--r--bgpd/bgp_msg_write.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/bgpd/bgp_msg_write.c b/bgpd/bgp_msg_write.c
index c0769578..c7b18bfe 100644
--- a/bgpd/bgp_msg_write.c
+++ b/bgpd/bgp_msg_write.c
@@ -78,6 +78,8 @@
* 1 => written to wbuff -- waiting for socket
* 0 => nothing written -- insufficient space in wbuff
* -1 => failed -- error event generated
+ *
+ * NB: requires the session LOCKED -- connection-wise
*/
extern int
bgp_msg_write_notification(bgp_connection connection, bgp_notify notification)
@@ -85,6 +87,8 @@ bgp_msg_write_notification(bgp_connection connection, bgp_notify notification)
struct stream *s = connection->obuf ;
int length;
+ ++connection->session->stats.notify_out ;
+
assert(notification != NULL) ;
/* Make NOTIFY message header */
@@ -156,6 +160,8 @@ bgp_msg_write_notification(bgp_connection connection, bgp_notify notification)
* 1 => written to wbuff -- waiting for socket
* 0 => nothing written -- insufficient space in wbuff
* -1 => failed -- error event generated
+ *
+ * NB: requires the session LOCKED -- connection-wise
*/
extern int
bgp_msg_send_keepalive(bgp_connection connection)
@@ -166,6 +172,8 @@ bgp_msg_send_keepalive(bgp_connection connection)
if (!bgp_connection_write_empty(connection))
return 0 ;
+ ++connection->session->stats.keepalive_out ;
+
/* Make KEEPALIVE message -- comprises header only */
bgp_packet_set_marker(s, BGP_MSG_KEEPALIVE);
length = bgp_packet_set_size(s);
@@ -204,6 +212,8 @@ bgp_open_capability_orf (struct stream *s, iAFI_t afi, iSAFI_t safi,
* 1 => written to wbuff -- waiting for socket
* 0 => nothing written -- wbuff was too full !!!
* -1 => failed -- error event generated
+ *
+ * NB: requires the session LOCKED -- connection-wise
*/
extern int
bgp_msg_send_open(bgp_connection connection, bgp_open_state open_state)
@@ -213,6 +223,8 @@ bgp_msg_send_open(bgp_connection connection, bgp_open_state open_state)
assert(bgp_connection_write_empty(connection)) ;
+ ++connection->session->stats.open_out ;
+
/* Make OPEN message header */
bgp_packet_set_marker(s, BGP_MSG_OPEN) ;
@@ -479,6 +491,8 @@ bgp_msg_orf_prefix(struct stream* s, uint8_t common,
* Returns: > 0 => all written
* 0 => unable to write everything
* < 0 => failed -- error event generated
+ *
+ * NB: requires the session LOCKED -- connection-wise
*/
extern int
bgp_msg_send_route_refresh(bgp_connection connection, bgp_route_refresh rr)
@@ -489,6 +503,8 @@ bgp_msg_send_route_refresh(bgp_connection connection, bgp_route_refresh rr)
bgp_size_t msg_len ;
int ret ;
+ ++connection->session->stats.refresh_out ;
+
msg_type = (connection->route_refresh == bgp_form_pre)
? BGP_MT_ROUTE_REFRESH_pre
: BGP_MT_ROUTE_REFRESH ;
@@ -767,6 +783,8 @@ bgp_msg_orf_prefix(struct stream* s, uint8_t common,
* 1 => written to wbuff -- waiting for socket
* 0 => nothing written -- insufficient space in wbuff
* -1 => failed -- error event generated
+ *
+ * NB: requires the session LOCKED -- connection-wise
*/
extern int
bgp_msg_send_update(bgp_connection connection, struct stream* s)
@@ -774,6 +792,8 @@ bgp_msg_send_update(bgp_connection connection, struct stream* s)
if (bgp_connection_write_full(connection))
return 0 ;
+ ++connection->session->stats.update_out ;
+
return bgp_connection_write(connection, s) ;
} ;