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.
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);
assert(peer->ibuf);
assert(peer->fd);
assert(peer->ibuf_work);
- assert(stream_get_endp(peer->ibuf_work) == 0);
assert(peer->obuf);
assert(!peer->t_connect_check_r);
assert(!peer->t_connect_check_w);