From 3733c9fe3b92ebe89a1b27ed16922a43976439fb 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. [wt: port to 1.2.19 of original commit 1ccd662cfe4715c6b85e5cff2eeef47546a871a6] --- doc/keepalived.conf.SYNOPSIS | 1 + keepalived/include/vrrp.h | 1 + keepalived/vrrp/vrrp.c | 6 +++--- keepalived/vrrp/vrrp_parser.c | 7 +++++++ 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/doc/keepalived.conf.SYNOPSIS b/doc/keepalived.conf.SYNOPSIS index 7a74bab..5d6c513 100644 --- a/doc/keepalived.conf.SYNOPSIS +++ b/doc/keepalived.conf.SYNOPSIS @@ -180,6 +180,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 unicast_src_ip # src_ip to use into the VRRP packets (alias to mcast_src_ip) unicast_peer { # Do not use multicast, instead send VRRP diff --git a/keepalived/include/vrrp.h b/keepalived/include/vrrp.h index 86b7f79..d6424f8 100644 --- a/keepalived/include/vrrp.h +++ b/keepalived/include/vrrp.h @@ -137,6 +137,7 @@ typedef struct _vrrp_t { vrrp_stats *stats; /* Statistics */ interface_t *ifp; /* Interface we belong to */ int dont_track_primary; /* If set ignores ifp faults */ + int dont_check_address; /* ignore different addresses in announces */ unsigned long vmac_flags; /* VRRP VMAC flags */ char vmac_ifname[IFNAMSIZ]; /* Name of VRRP VMAC interface */ unsigned int vmac_ifindex; /* ifindex of vmac interface */ diff --git a/keepalived/vrrp/vrrp.c b/keepalived/vrrp/vrrp.c index ec7716e..3fd5fe9 100644 --- a/keepalived/vrrp/vrrp.c +++ b/keepalived/vrrp/vrrp.c @@ -332,7 +332,7 @@ vrrp_in_chk(vrrp_t * vrrp, char *buffer) /* Correct type, version, and length. Count as VRRP advertisement */ ++vrrp->stats->advert_rcvd; - 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 @@ -390,7 +390,7 @@ vrrp_in_chk(vrrp_t * vrrp, char *buffer) /* Correct type, version, and length. Count as VRRP advertisement */ ++vrrp->stats->advert_rcvd; - 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 @@ -495,7 +495,7 @@ vrrp_in_chk(vrrp_t * vrrp, char *buffer) return VRRP_PACKET_KO; } - if (LIST_ISEMPTY(vrrp->vip) && hd->naddr > 0) { + if (!vrrp->dont_check_address && LIST_ISEMPTY(vrrp->vip) && hd->naddr > 0) { log_message(LOG_INFO, "receive an invalid ip number count associated with VRID!"); ++vrrp->stats->addr_list_err; return VRRP_PACKET_KO; diff --git a/keepalived/vrrp/vrrp_parser.c b/keepalived/vrrp/vrrp_parser.c index 8f70d40..5326fa0 100644 --- a/keepalived/vrrp/vrrp_parser.c +++ b/keepalived/vrrp/vrrp_parser.c @@ -220,6 +220,12 @@ vrrp_dont_track_handler(vector_t *strvec) vrrp->dont_track_primary = 1; } static void +vrrp_dont_check_address(vector_t *strvec) +{ + vrrp_t *vrrp = LIST_TAIL_DATA(vrrp_data->vrrp); + vrrp->dont_check_address = 1; +} +static void vrrp_srcip_handler(vector_t *strvec) { vrrp_t *vrrp = LIST_TAIL_DATA(vrrp_data->vrrp); @@ -599,6 +605,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_srcip_handler); -- 1.7.12.1