From: Quentin Young Date: Wed, 13 Mar 2019 18:37:48 +0000 (+0000) Subject: vrrpd: fix v2 master_down_interval computation X-Git-Tag: base_7.2~330^2~29 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=08671293e2d2017c91d66496c0a92033107d5adc;p=matthieu%2Ffrr.git vrrpd: fix v2 master_down_interval computation VRRPv2 uses the configured advertisement interval to compute the master down timer, whereas VRRPv3 uses the one advertised by the master. Fix computation to use the configured in in v2. Signed-off-by: Quentin Young --- diff --git a/vrrpd/vrrp.c b/vrrpd/vrrp.c index 3f93ac441c..4ab6605918 100644 --- a/vrrpd/vrrp.c +++ b/vrrpd/vrrp.c @@ -97,9 +97,11 @@ static void vrrp_mac_set(struct ethaddr *mac, bool v6, uint8_t vrid) */ static void vrrp_recalculate_timers(struct vrrp_router *r) { + uint16_t mdiadv = r->vr->version == 3 ? r->master_adver_interval + : r->vr->advertisement_interval; uint16_t skm = (r->vr->version == 3) ? r->master_adver_interval : 100; r->skew_time = ((256 - r->vr->priority) * skm) / 256; - r->master_down_interval = (3 * r->master_adver_interval); + r->master_down_interval = 3 * mdiadv; r->master_down_interval += r->skew_time; }