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 <qlyoung@cumulusnetworks.com>
This commit is contained in:
Quentin Young 2019-03-13 18:37:48 +00:00
parent c2034b2550
commit 08671293e2

View File

@ -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;
}