summaryrefslogtreecommitdiffstats
path: root/bgpd/bgp_msg_write.c
diff options
context:
space:
mode:
authorChris Hall <GMCH@hestia.halldom.com>2010-01-27 22:37:55 +0000
committerChris Hall <GMCH@hestia.halldom.com>2010-01-27 22:37:55 +0000
commite29ed2adec0ef11ca1c84b40b2c98247f162f3df (patch)
treed0a65837f2a544c8e46f8ddda654e70686c531a1 /bgpd/bgp_msg_write.c
parente6d986058f23f350aa6aedac4da5fe9f3afda6e8 (diff)
downloadquagga-e29ed2adec0ef11ca1c84b40b2c98247f162f3df.tar.bz2
quagga-e29ed2adec0ef11ca1c84b40b2c98247f162f3df.tar.xz
Binding to interfaces and counting of messages.
Wired up message counters in bgp_session structure. Added fields to session for neighbor interface and neighbor update-source -- so that these can be set when connect() is done. Peering Engine resolves any interface name to an address, so that BGP Engine doesn't have to. Reinstated as much code as necessary in bgp_network to bind to specific interfaces, as set in the session. Moved setting of bgp_nexthop_set() back into Routeing Engine. Result is that only Peering Engine talks to Zebra or uses the iflist. Wired up setting of TTL. Reworked connections locking of the session mutex so more robust if/when connections are cut loose from the session. Made peer_index entry point at connection, not session. Works better in bgp_network that way. modified: bgpd/bgp_connection.c modified: bgpd/bgp_connection.h modified: bgpd/bgp_fsm.c modified: bgpd/bgp_msg_read.c modified: bgpd/bgp_msg_write.c modified: bgpd/bgp_network.c modified: bgpd/bgp_network.h modified: bgpd/bgp_peer.c modified: bgpd/bgp_peer.h modified: bgpd/bgp_peer_index.c modified: bgpd/bgp_peer_index.h modified: bgpd/bgp_session.c modified: bgpd/bgp_session.h modified: lib/prefix.h modified: lib/sockunion.c modified: lib/sockunion.h
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) ;
} ;