From 358363a220159c1b09ebf129c7b782df655f0fbf Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Tue, 9 Feb 2016 11:03:43 +0100 Subject: vrrp: disable periodic gratuitous ARPs when using VMAC We don't want to periodically flood the network with ARP messages when using vmacs since the address is not supposed to change. We only perform the first emissions and that's all. --- keepalived/vrrp/vrrp.c | 2 +- keepalived/vrrp/vrrp_scheduler.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/keepalived/vrrp/vrrp.c b/keepalived/vrrp/vrrp.c index 3fd5fe9..ee8c202 100644 --- a/keepalived/vrrp/vrrp.c +++ b/keepalived/vrrp/vrrp.c @@ -1070,7 +1070,7 @@ vrrp_state_become_master(vrrp_t * vrrp) if (!timer_isnull(vrrp->garp_refresh)) { vrrp->garp_refresh_timer = timer_add_now(vrrp->garp_refresh); } - else if (vrrp->garp_left) { + else if (vrrp->garp_left && !(__test_bit(VRRP_VMAC_BIT, &vrrp->vmac_flags))) { vrrp->garp_refresh_timer = timer_add_long(time_now, 1 * TIMER_HZ); } diff --git a/keepalived/vrrp/vrrp_scheduler.c b/keepalived/vrrp/vrrp_scheduler.c index f1d8bae..a3ec91d 100644 --- a/keepalived/vrrp/vrrp_scheduler.c +++ b/keepalived/vrrp/vrrp_scheduler.c @@ -732,7 +732,7 @@ vrrp_gratuitous_arp_thread(thread_t * thread) /* only enable and update garp_left if garp_refresh is disabled */ if (timer_isnull(vrrp->garp_refresh) && vrrp->garp_left > 0) { vrrp->garp_left -= 1*TIMER_HZ; - if (vrrp->garp_left <= 0) { + if (vrrp->garp_left <= 0 || (__test_bit(VRRP_VMAC_BIT, &vrrp->vmac_flags))) { vrrp->garp_left = 0; return 0; } @@ -817,7 +817,7 @@ vrrp_master(vrrp_t * vrrp) * emission in vrrp_state_become_master(). */ if (vrrp_state_master_tx(vrrp, 0)) { - if (vrrp->garp_left) + if (vrrp->garp_left && !(__test_bit(VRRP_VMAC_BIT, &vrrp->vmac_flags))) thread_add_timer(master, vrrp_gratuitous_arp_thread, vrrp, 1 * TIMER_HZ); else if (vrrp->garp_delay) -- 1.7.12.1