From 1ccd662cfe4715c6b85e5cff2eeef47546a871a6 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Tue, 29 Sep 2009 10:44:49 +0200 Subject: vrrp: add dont_check_address to disable comparison of addresses During a config change, two machines can announce different IP sets, leading to unexpected behaviours. This new flag disables the checking of announced IP addresses. --- doc/keepalived.conf.SYNOPSIS | 1 + keepalived/include/vrrp.h | 1 + keepalived/vrrp/vrrp.c | 4 ++-- keepalived/vrrp/vrrp_parser.c | 7 +++++++ 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/doc/keepalived.conf.SYNOPSIS b/doc/keepalived.conf.SYNOPSIS index c8a4eb7..1aeaae7 100644 --- a/doc/keepalived.conf.SYNOPSIS +++ b/doc/keepalived.conf.SYNOPSIS @@ -159,6 +159,7 @@ vrrp_instance { # VRRP instance declaration } dont_track_primary # (default unset) ignore VRRP interface faults. # useful for cross-connect VRRP config. + dont_check_address # ignore address differences in received packets mcast_src_ip # src_ip to use into the VRRP packets lvs_sync_daemon_interface # Binding interface for lvs syncd garp_master_delay # delay for gratuitous ARP after MASTER diff --git a/keepalived/include/vrrp.h b/keepalived/include/vrrp.h index 36ab984..24efa97 100644 --- a/keepalived/include/vrrp.h +++ b/keepalived/include/vrrp.h @@ -90,6 +90,7 @@ typedef struct _vrrp_rt { vrrp_sgroup *sync; /* Sync group we belong to */ interface *ifp; /* Interface we belong to */ int dont_track_primary; /* If set ignores ifp faults */ + int dont_check_address; /* ignore different addresses in annonces */ list track_ifp; /* Interface state we monitor */ list track_script; /* Script state we monitor */ uint32_t mcast_saddr; /* Src IP address to use in VRRP IP header */ diff --git a/keepalived/vrrp/vrrp.c b/keepalived/vrrp/vrrp.c index 0eebf9b..3e98ff6 100644 --- a/keepalived/vrrp/vrrp.c +++ b/keepalived/vrrp/vrrp.c @@ -257,7 +257,7 @@ vrrp_in_chk(vrrp_rt * vrrp, char *buffer) return VRRP_PACKET_DROP; } - if (!LIST_ISEMPTY(vrrp->vip)) { + if (!vrrp->dont_check_address && !LIST_ISEMPTY(vrrp->vip)) { /* * MAY verify that the IP address(es) associated with the * VRID are valid @@ -280,7 +280,7 @@ vrrp_in_chk(vrrp_rt * vrrp, char *buffer) return VRRP_PACKET_KO; } } - } else if (hd->naddr > 0) { + } else if (!vrrp->dont_check_address && hd->naddr > 0) { log_message(LOG_INFO, "receive an invalid ip number count associated with VRID!"); return VRRP_PACKET_KO; diff --git a/keepalived/vrrp/vrrp_parser.c b/keepalived/vrrp/vrrp_parser.c index 0a61179..96ab951 100644 --- a/keepalived/vrrp/vrrp_parser.c +++ b/keepalived/vrrp/vrrp_parser.c @@ -139,6 +139,12 @@ vrrp_dont_track_handler(vector strvec) vrrp->dont_track_primary = 1; } static void +vrrp_dont_check_address(vector strvec) +{ + vrrp_rt *vrrp = LIST_TAIL_DATA(vrrp_data->vrrp); + vrrp->dont_check_address = 1; +} +static void vrrp_mcastip_handler(vector strvec) { vrrp_rt *vrrp = LIST_TAIL_DATA(vrrp_data->vrrp); @@ -414,6 +420,7 @@ vrrp_init_keywords(void) install_keyword("state", &vrrp_state_handler); install_keyword("interface", &vrrp_int_handler); install_keyword("dont_track_primary", &vrrp_dont_track_handler); + install_keyword("dont_check_address", &vrrp_dont_check_address); install_keyword("track_interface", &vrrp_track_int_handler); install_keyword("track_script", &vrrp_track_scr_handler); install_keyword("mcast_src_ip", &vrrp_mcastip_handler); -- 1.6.0.4