keepalived/keepalived-1.2.7-fix-primary-ip-address-comparison.patch

35 lines
1.4 KiB
Diff

From 6e52cb884e3cab75ca5597b59027a11d982593ab Mon Sep 17 00:00:00 2001
From: Boon Ang <boon.s.ang@gmail.com>
Date: Thu, 6 Dec 2012 11:01:55 -0600
Subject: [PATCH 09/10] Fix comparison of primary IP addresses.
If a router in the master state receives an advertisement with
priority equal to the local priority, it must also compare the primary
IP addresses (RFC 3768, section 6.4.3). The code to handle this was
comparing two IP addresses with different byte-ordering, resulting in
multiple routers in the master state. This patches resolves the
problem by coverting the local primary IP address to network byte
order for the comparison.
Signed-off-by: Ryan O'Hara <rohara@redhat.com>
---
keepalived/vrrp/vrrp.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/keepalived/vrrp/vrrp.c b/keepalived/vrrp/vrrp.c
index 0a8bc3f..a88deb3 100644
--- a/keepalived/vrrp/vrrp.c
+++ b/keepalived/vrrp/vrrp.c
@@ -923,7 +923,7 @@ vrrp_state_master_rx(vrrp_rt * vrrp, char *buf, int buflen)
} else if (vrrp->family == AF_INET) {
if (hd->priority > vrrp->effective_priority ||
(hd->priority == vrrp->effective_priority &&
- ntohl(saddr) > VRRP_PKT_SADDR(vrrp))) {
+ ntohl(saddr) > ntohl(VRRP_PKT_SADDR(vrrp)))) {
log_message(LOG_INFO, "VRRP_Instance(%s) Received higher prio advert"
, vrrp->iname);
if (proto == IPPROTO_IPSEC_AH) {
--
1.7.1