]> git.puffer.fish Git - mirror/frr.git/commitdiff
vrrpd: fix more timer bugs
authorQuentin Young <qlyoung@cumulusnetworks.com>
Thu, 6 Dec 2018 22:19:11 +0000 (22:19 +0000)
committerQuentin Young <qlyoung@cumulusnetworks.com>
Fri, 17 May 2019 00:27:08 +0000 (00:27 +0000)
* Fix overflow in skew time computation
* Fix accidentally removed initial setting of advertisement interval

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
vrrpd/vrrp.c

index 4d68d617fca75308a05a7203f53fe3e450b85fbd..184b88ca60f1257a1fa64665ba092e57949295b5 100644 (file)
@@ -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);