Skip to content

Commit

Permalink
Merge pull request #2424 from pqarmitage/updates
Browse files Browse the repository at this point in the history
vrrp: Ensure VRRPv3 advert interval is <= 40.95 seconds
  • Loading branch information
pqarmitage authored Jun 2, 2024
2 parents 5ac9819 + cf61539 commit 379faa5
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions keepalived/vrrp/vrrp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1852,10 +1852,8 @@ vrrp_state_leave_fault(vrrp_t * vrrp)
vrrp->state = vrrp->wantstate;
send_instance_notifies(vrrp);

if (vrrp->state == VRRP_STATE_BACK) {
if (vrrp->state == VRRP_STATE_BACK)
vrrp->preempt_time.tv_sec = 0;
vrrp->master_adver_int = vrrp->adver_int;
}
}

/* Set the down timer */
Expand Down Expand Up @@ -3346,8 +3344,11 @@ vrrp_complete_instance(vrrp_t * vrrp)
vrrp->adver_int = vrrp->adver_int + (TIMER_CENTI_HZ / 2);
vrrp->adver_int -= vrrp->adver_int % TIMER_CENTI_HZ;

/* Ensure don't round outside [0.01,40.95] */
if (vrrp->adver_int == 0)
vrrp->adver_int = TIMER_CENTI_HZ;
else if (vrrp->adver_int == (1<<12) * TIMER_CENTI_HZ)
vrrp->adver_int = ((1<<12) - 1) * TIMER_CENTI_HZ;
}
}
vrrp->master_adver_int = vrrp->adver_int;
Expand Down

0 comments on commit 379faa5

Please sign in to comment.