summaryrefslogtreecommitdiffstats
path: root/bgpd/bgp_fsm.c
diff options
context:
space:
mode:
authorQuentin Young <qlyoung@cumulusnetworks.com>2017-11-03 19:47:56 +0100
committerQuentin Young <qlyoung@cumulusnetworks.com>2017-11-30 22:18:05 +0100
commit7db44ec8fa9e2cf32007473a7cb2683b01d31692 (patch)
tree02e7c28423bdb293bd67a0eabeb6938d1295e4c1 /bgpd/bgp_fsm.c
parentbgpd: fix bgp active open (diff)
downloadfrr-7db44ec8fa9e2cf32007473a7cb2683b01d31692.tar.xz
frr-7db44ec8fa9e2cf32007473a7cb2683b01d31692.zip
bgpd: transfer raw input buffer to new peer
During initial session establishment, bgpd performs a "connection transfer" to a new peer struct if the connection was initiated passively (i.e. by the remote peer). With the addition of buffered input, I forgot to transfer the raw input buffer to the new peer. This resulted in infrequent failures during session handshaking whereby half of a packet would be thrown away in the middle of a read causing us to send a NOTIFY for an unsynchronized header. Usually the transfer coincided with a clean input buffer, hence why it only showed up once in a while.
Diffstat (limited to 'bgpd/bgp_fsm.c')
-rw-r--r--bgpd/bgp_fsm.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/bgpd/bgp_fsm.c b/bgpd/bgp_fsm.c
index f7c031610..b97bebd7b 100644
--- a/bgpd/bgp_fsm.c
+++ b/bgpd/bgp_fsm.c
@@ -181,6 +181,8 @@ static struct peer *peer_xfer_conn(struct peer *from_peer)
while (from_peer->ibuf->head)
stream_fifo_push(peer->ibuf,
stream_fifo_pop(from_peer->ibuf));
+
+ stream_copy(peer->ibuf_work, from_peer->ibuf_work);
}
pthread_mutex_unlock(&from_peer->io_mtx);
pthread_mutex_unlock(&peer->io_mtx);