|
|
15862b |
From 24edeaaacf0648b3df0032ef5d1deb3a9e11b388 Mon Sep 17 00:00:00 2001
|
|
|
15862b |
From: Oyvind Albrigtsen <oalbrigt@redhat.com>
|
|
|
15862b |
Date: Wed, 11 Jan 2017 14:11:21 +0100
|
|
|
15862b |
Subject: [PATCH] IPaddr2 detect duplicate IP
|
|
|
15862b |
|
|
|
15862b |
---
|
|
|
15862b |
heartbeat/IPaddr2 | 28 ++++++++++++++++++++++++----
|
|
|
15862b |
1 file changed, 24 insertions(+), 4 deletions(-)
|
|
|
15862b |
|
|
|
15862b |
diff --git a/heartbeat/IPaddr2 b/heartbeat/IPaddr2
|
|
|
15862b |
index b416e31..2d5e1ea 100755
|
|
|
15862b |
--- a/heartbeat/IPaddr2
|
|
|
15862b |
+++ b/heartbeat/IPaddr2
|
|
|
15862b |
@@ -79,6 +79,7 @@ OCF_RESKEY_arp_count_default=5
|
|
|
15862b |
OCF_RESKEY_arp_count_refresh_default=0
|
|
|
15862b |
OCF_RESKEY_arp_bg_default=true
|
|
|
15862b |
OCF_RESKEY_arp_mac_default="ffffffffffff"
|
|
|
15862b |
+OCF_RESKEY_run_arping_default=false
|
|
|
15862b |
|
|
|
15862b |
: ${OCF_RESKEY_lvs_support=${OCF_RESKEY_lvs_support_default}}
|
|
|
15862b |
: ${OCF_RESKEY_lvs_ipv6_addrlabel=${OCF_RESKEY_lvs_ipv6_addrlabel_default}}
|
|
|
15862b |
@@ -90,6 +91,7 @@ OCF_RESKEY_arp_mac_default="ffffffffffff"
|
|
|
15862b |
: ${OCF_RESKEY_arp_count_refresh=${OCF_RESKEY_arp_count_refresh_default}}
|
|
|
15862b |
: ${OCF_RESKEY_arp_bg=${OCF_RESKEY_arp_bg_default}}
|
|
|
15862b |
: ${OCF_RESKEY_arp_mac=${OCF_RESKEY_arp_mac_default}}
|
|
|
15862b |
+: ${OCF_RESKEY_run_arping=${OCF_RESKEY_run_arping_default}}
|
|
|
15862b |
#######################################################################
|
|
|
15862b |
|
|
|
15862b |
SENDARP=$HA_BIN/send_arp
|
|
|
15862b |
@@ -340,6 +342,14 @@ IP address goes away.
|
|
|
15862b |
<content type="boolean" default="false"/>
|
|
|
15862b |
</parameter>
|
|
|
15862b |
|
|
|
15862b |
+<parameter name="run_arping">
|
|
|
15862b |
+<longdesc lang="en">
|
|
|
15862b |
+Whether or not to run arping for IPv4 collision detection check.
|
|
|
15862b |
+</longdesc>
|
|
|
15862b |
+<shortdesc lang="en">Run arping for IPv4 collision detection check</shortdesc>
|
|
|
15862b |
+<content type="string" default="${OCF_RESKEY_run_arping_default}"/>
|
|
|
15862b |
+</parameter>
|
|
|
15862b |
+
|
|
|
15862b |
</parameters>
|
|
|
15862b |
<actions>
|
|
|
15862b |
<action name="start" timeout="20s" />
|
|
|
15862b |
@@ -556,6 +566,15 @@ add_interface () {
|
|
|
15862b |
iface="$4"
|
|
|
15862b |
label="$5"
|
|
|
15862b |
|
|
|
15862b |
+ if [ "$FAMILY" = "inet" ] && ocf_is_true $OCF_RESKEY_run_arping &&
|
|
|
15862b |
+ check_binary arping; then
|
|
|
15862b |
+ arping -q -c 2 -w 3 -D -I $iface $ipaddr
|
|
|
15862b |
+ if [ $? = 1 ]; then
|
|
|
15862b |
+ ocf_log err "IPv4 address collision $ipaddr [DAD]"
|
|
|
15862b |
+ return $OCF_ERR_CONFIGURED
|
|
|
15862b |
+ fi
|
|
|
15862b |
+ fi
|
|
|
15862b |
+
|
|
|
15862b |
if [ "$FAMILY" = "inet6" ] && ocf_is_true $OCF_RESKEY_lvs_ipv6_addrlabel ;then
|
|
|
15862b |
add_ipv6_addrlabel $ipaddr
|
|
|
15862b |
fi
|
|
|
15862b |
@@ -877,10 +896,11 @@ ip_start() {
|
|
|
15862b |
fi
|
|
|
15862b |
|
|
|
15862b |
add_interface $OCF_RESKEY_ip $NETMASK ${BRDCAST:-none} $NIC $IFLABEL
|
|
|
15862b |
-
|
|
|
15862b |
- if [ $? -ne 0 ]; then
|
|
|
15862b |
- ocf_exit_reason "$CMD failed."
|
|
|
15862b |
- exit $OCF_ERR_GENERIC
|
|
|
15862b |
+ rc=$?
|
|
|
15862b |
+
|
|
|
15862b |
+ if [ $rc -ne $OCF_SUCCESS ]; then
|
|
|
15862b |
+ ocf_exit_reason "Failed to add $OCF_RESKEY_ip"
|
|
|
15862b |
+ exit $rc
|
|
|
15862b |
fi
|
|
|
15862b |
fi
|
|
|
15862b |
|