summaryrefslogtreecommitdiffstats
path: root/bgpd/bgp_connection.c
diff options
context:
space:
mode:
authorChris Hall <GMCH@hestia.halldom.com>2010-01-23 11:21:17 +0000
committerChris Hall <GMCH@hestia.halldom.com>2010-01-23 11:21:17 +0000
commit0341d5ce47c301b4a4d92b77a83930da4fdc8fb3 (patch)
treeacff360d75d85e711d65e8d4fbe5139bf19b25e0 /bgpd/bgp_connection.c
parenteeda1184fa60c5077c2d404d0a8415d11e836ccd (diff)
downloadquagga-0341d5ce47c301b4a4d92b77a83930da4fdc8fb3.tar.bz2
quagga-0341d5ce47c301b4a4d92b77a83930da4fdc8fb3.tar.xz
Blitz on bgp_msg_read, particularly OPEN message handling
In the BGP Engine the OPEN message needs to be processed into the open_recv structure in the *connection*. The OPEN that arrives must be checked for acceptability before it is acknowledged. Later the connection may be discarded in collision resolution, or the connection may become the Established connection, and the open_recv structure is passed to the session and hence to the Peering Engine. modified: bgpd/bgp.h modified: bgpd/bgp_common.c modified: bgpd/bgp_common.h 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_read.h modified: bgpd/bgp_msg_write.c modified: bgpd/bgp_notification.c modified: bgpd/bgp_notification.h modified: bgpd/bgp_open.h modified: bgpd/bgp_open_state.c modified: bgpd/bgp_open_state.h modified: bgpd/bgp_packet.c modified: bgpd/bgp_session.h modified: lib/distribute.c modified: lib/if_rmap.c modified: lib/qafi_safi.h modified: lib/stream.c modified: lib/stream.h
Diffstat (limited to 'bgpd/bgp_connection.c')
-rw-r--r--bgpd/bgp_connection.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/bgpd/bgp_connection.c b/bgpd/bgp_connection.c
index 8ceb9db6..2e10eaf1 100644
--- a/bgpd/bgp_connection.c
+++ b/bgpd/bgp_connection.c
@@ -126,8 +126,11 @@ bgp_connection_init_new(bgp_connection connection, bgp_session session,
* * keepalive_timer_interval none -- set when connection is opened
* * as4 not AS4 conversation
* * route_refresh_pre not pre-RFC ROUTE-REFRESH
+ * * orf_prefix_pre not pre-RFC ORF by prefix
* * read_pending nothing pending
* * read_header not reading header
+ * * msg_type none -- set when reading message
+ * * msg_size none -- set when reading message
* * notification_pending nothing pending
* * wbuff all pointers NULL -- empty buffer
*/
@@ -232,8 +235,7 @@ bgp_connection_make_primary(bgp_connection connection)
* Copy the negotiated hold_timer_interval and keepalive_timer_interval
* Copy the su_local and su_remote
*/
- session->open_recv = connection->open_recv ;
- connection->open_recv = NULL ; /* no longer interested in this */
+ bgp_open_state_set_mov(&session->open_recv, &connection->open_recv) ;
XFREE(MTYPE_BGP_PEER_HOST, connection->host) ;
bgp_connection_init_host(connection, "") ;
@@ -243,6 +245,7 @@ bgp_connection_make_primary(bgp_connection connection)
session->as4 = connection->as4 ;
session->route_refresh_pre = connection->route_refresh_pre ;
+ session->orf_prefix_pre = connection->orf_prefix_pre ;
sockunion_set_mov(&session->su_local, &connection->su_local) ;
sockunion_set_mov(&session->su_remote, &connection->su_remote) ;
@@ -895,9 +898,9 @@ bgp_connection_read_action(qps_file qf, void* file_info)
*
* Exits loop iff completes a BGP message.
*/
- while (1)
+ while (want > 0)
{
- ret = stream_read_unblock(connection->ibuf, qps_file_fd(&connection->qf),
+ ret = stream_read_nonblock(connection->ibuf, qps_file_fd(&connection->qf),
want) ;
if (ret >= 0)
{
@@ -915,8 +918,6 @@ bgp_connection_read_action(qps_file qf, void* file_info)
want = bgp_msg_check_header(connection) ;
/* returns balance of message */
- if (want < 0)
- return ; /* failed in header check */
}
else
{
@@ -925,6 +926,9 @@ bgp_connection_read_action(qps_file qf, void* file_info)
} ;
} ;
+ if (want < 0)
+ return ; /* failed in header check */
+
/* Deal with the BGP message. MUST remove from ibuf before returns ! */
bgp_msg_dispatch(connection) ;