bgpd: check rtt later after the real peer is known
OPEN message handler moves the connection from the temporary
"struct peer" (used to accept it) to the real "struct peer" based
on the configuration. RTT needs to be updated only to the real
struct peer, and this patch moves the RTT query to point where
realpeer is known.
Fixes: ef757700d0 "bgpd: allow using rtt in route-map's set metric"
Signed-off-by: Timo Teräs <timo.teras@iki.fi>
diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c
index 4ab5b06..a90e56b 100644
--- a/bgpd/bgp_packet.c
+++ b/bgpd/bgp_packet.c
@@ -1572,6 +1572,7 @@
/* Get sockname. */
bgp_getsockname (peer);
+ peer->rtt = sockopt_tcp_rtt (peer->fd);
BGP_EVENT_ADD (peer, Receive_OPEN_message);
@@ -2582,7 +2583,6 @@
{
case BGP_MSG_OPEN:
peer->open_in++;
- peer->rtt = sockopt_tcp_rtt(peer->fd);
bgp_open_receive (peer, size); /* XXX return value ignored! */
break;
case BGP_MSG_UPDATE: