summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Walton <dwalton@cumulusnetworks.com>2016-10-06 13:20:02 +0000
committerDaniel Walton <dwalton@cumulusnetworks.com>2016-10-06 13:20:02 +0000
commit1ba2a97af940168a4ca7673287272000f27f93ca (patch)
tree020f9328489db5f2bf768c49b4a024e184ea5742
parentb705df1286a63bd444a8f7332c66110b2045331a (diff)
bgpd: 'Last write' does not update when we TX a keepalive
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com> Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com> Ticket: CM-5518
-rw-r--r--bgpd/bgp_fsm.c2
-rw-r--r--bgpd/bgp_packet.c8
-rw-r--r--bgpd/bgpd.h3
3 files changed, 10 insertions, 3 deletions
diff --git a/bgpd/bgp_fsm.c b/bgpd/bgp_fsm.c
index f775bd048f..ab4ea71d61 100644
--- a/bgpd/bgp_fsm.c
+++ b/bgpd/bgp_fsm.c
@@ -688,7 +688,7 @@ bgp_adjust_routeadv (struct peer *peer)
*
* m > MRAI
*/
- diff = difftime(nowtime, peer->last_write);
+ diff = difftime(nowtime, peer->last_update);
if (diff > (double) peer->v_routeadv)
{
BGP_TIMER_OFF(peer->t_routeadv);
diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c
index ae54cd43d3..6811513448 100644
--- a/bgpd/bgp_packet.c
+++ b/bgpd/bgp_packet.c
@@ -341,6 +341,7 @@ bgp_write (struct thread *thread)
u_char type;
struct stream *s;
int num;
+ int update_last_write = 0;
unsigned int count = 0;
unsigned int oc = 0;
@@ -432,6 +433,7 @@ bgp_write (struct thread *thread)
/* OK we send packet so delete it. */
bgp_packet_delete (peer);
+ update_last_write = 1;
}
while (++count < peer->bgp->wpkt_quanta &&
(s = bgp_write_packet (peer)) != NULL);
@@ -439,8 +441,12 @@ bgp_write (struct thread *thread)
bgp_write_proceed_actions (peer);
done:
- /* Update the last write if some updates were written. */
+ /* Update last_update if UPDATEs were written. */
if (peer->update_out > oc)
+ peer->last_update = bgp_clock ();
+
+ /* If we TXed any flavor of packet update last_write */
+ if (update_last_write)
peer->last_write = bgp_clock ();
sockopt_cork (peer->fd, 0);
diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h
index 2aa90e4877..cc55fb87d1 100644
--- a/bgpd/bgpd.h
+++ b/bgpd/bgpd.h
@@ -789,7 +789,8 @@ struct peer
/* Syncronization list and time. */
struct bgp_synchronize *sync[AFI_MAX][SAFI_MAX];
time_t synctime;
- time_t last_write; /* timestamp when the last UPDATE msg was written */
+ time_t last_write; /* timestamp when the last msg was written */
+ time_t last_update; /* timestamp when the last UPDATE msg was written */
/* Send prefix count. */
unsigned long scount[AFI_MAX][SAFI_MAX];