[PATCH 3/4] Elect higher IP addresses in case the priority is equal
Eilon Greenstein <[email protected]>
| Newsgroups | gmane.linux.keepalived.devel |
|---|---|
| Message-ID | <[email protected]> |
From: Dharmender Garg <[email protected]> This patch set the master according to the higher IP address in case the priority is the same. Signed-off-by: Dharmender Garg <[email protected]> Signed-off-by: Eilon Greenstein <[email protected]> --- keepalived/vrrp/vrrp.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/keepalived/vrrp/vrrp.c b/keepalived/vrrp/vrrp.c index 8f4f702..a930009 100644 --- a/keepalived/vrrp/vrrp.c +++ b/keepalived/vrrp/vrrp.c @@ -901,10 +901,12 @@ vrrp_state_backup(vrrp_t * vrrp, char *buf, int buflen) notify_instance_exec(vrrp, VRRP_STATE_GOTO_MASTER); } else if (hd->priority == 0) { vrrp->ms_down_timer = VRRP_TIMER_SKEW(vrrp); - } else if (vrrp->nopreempt || hd->priority >= vrrp->effective_priority || + } else if (vrrp->nopreempt || hd->priority > vrrp->effective_priority || timer_cmp(vrrp->preempt_time, timer_now()) > 0) { vrrp->ms_down_timer = 3 * vrrp->adver_int + VRRP_TIMER_SKEW(vrrp); - } else if (hd->priority < vrrp->effective_priority) { + } else if ((hd->priority < vrrp->effective_priority) || + (hd->priority == vrrp->effective_priority && + ntohl(saddr) < ntohl(VRRP_PKT_SADDR(vrrp)))) { log_message(LOG_INFO, "VRRP_Instance(%s) forcing a new MASTER election" , vrrp->iname); vrrp->wantstate = VRRP_STATE_GOTO_MASTER; -- 1.8.4.3 ------------------------------------------------------------------------------ Is your legacy SCM system holding you back? Join Perforce May 7 to find out: • 3 signs your SCM is hindering your productivity • Requirements for releasing software faster • Expert tips and advice for migrating your SCM now http://p.sf.net/sfu/perforce