diff options
author | Quentin Young <qlyoung@cumulusnetworks.com> | 2018-12-06 23:19:11 +0100 |
---|---|---|
committer | Quentin Young <qlyoung@cumulusnetworks.com> | 2019-05-17 02:27:08 +0200 |
commit | 1485d9e5252f6ec427c39f3c870f5079dd3c9bd9 (patch) | |
tree | 95266fc7514a157ff2cf144285216b632701b497 | |
parent | vrrpd: clean up configuration code, fix skew bug (diff) | |
download | frr-1485d9e5252f6ec427c39f3c870f5079dd3c9bd9.tar.xz frr-1485d9e5252f6ec427c39f3c870f5079dd3c9bd9.zip |
vrrpd: fix more timer bugs
* Fix overflow in skew time computation
* Fix accidentally removed initial setting of advertisement interval
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
-rw-r--r-- | vrrpd/vrrp.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/vrrpd/vrrp.c b/vrrpd/vrrp.c index 4d68d617f..184b88ca6 100644 --- a/vrrpd/vrrp.c +++ b/vrrpd/vrrp.c @@ -78,10 +78,9 @@ static void vrrp_update_times(struct vrrp_vrouter *vr, { vr->advertisement_interval = advertisement_interval; vr->master_adver_interval = master_adver_interval; - vr->skew_time = (256 - vr->priority) * vr->master_adver_interval; - vr->skew_time /= 256; - vr->master_down_interval = (3 * vr->master_adver_interval); - vr->master_down_interval /= 256 + vr->skew_time; + vr->skew_time = ((256 - vr->priority) * master_adver_interval) / 256; + vr->master_down_interval = (3 * master_adver_interval); + vr->master_down_interval += vr->skew_time; } /* @@ -141,6 +140,7 @@ struct vrrp_vrouter *vrrp_vrouter_create(struct interface *ifp, uint8_t vrid) vrrp_mac_set(&vr->vr_mac_v4, false, vrid); vrrp_mac_set(&vr->vr_mac_v6, true, vrid); vr->fsm.state = VRRP_STATE_INITIALIZE; + vrrp_set_advertisement_interval(vr, VRRP_DEFAULT_ADVINT); vrrp_reset_times(vr); hash_get(vrrp_vrouters_hash, vr, hash_alloc_intern); |