# HG changeset patch
# User Florian Haas <florian.haas at linbit.com>
# Date 1285854769 -7200
# Node ID d5e389633c8621499327f2acf28fd74ad18c1290
# Parent  c910a3f4a5bfd3636b0b0bbb2bd46678cfb0d457
Medium: IPaddr2: optionally flush kernel routing table on interface stop

This is an updated version which uses the generic "ip route flush cache"
command instead of relying on the existence of a specific sysctl.

diff -r c910a3f4a5bf -r d5e389633c86 heartbeat/IPaddr2
--- a/heartbeat/IPaddr2 Wed Sep 29 21:52:52 2010 +1000
+++ b/heartbeat/IPaddr2 Thu Sep 30 15:52:49 2010 +0200
@@ -231,8 +231,26 @@
 <content type="string" default="ffffffffffff"/>
 </parameter>
 
+<parameter name="flush_routes">
+<longdesc lang="en">
+Flush the routing table on stop. This is for
+applications which use the cluster IP address
+and which run on the same physical host that the
+IP address lives on. The Linux kernel may force that
+application to take a shortcut to the local loopback
+interface, instead of the interface the address
+is really bound to. Under those circumstances, an
+application may, somewhat unexpectedly, continue
+to use connections for some time even after the
+IP address is deconfigured. Set this parameter in
+order to immediately disable said shortcut when the
+IP address goes away.
+</longdesc>
+<shortdesc lang="en">Flush kernel routing table on stop</shortdesc>
+<content type="boolean" default="false"/>
+</parameter>
+
 </parameters>
-
 <actions>
 <action name="start"   timeout="20s" />
 <action name="stop"    timeout="20s" />
@@ -396,9 +414,12 @@
 
        CMD="$IP2UTIL -f inet addr delete $ipaddr/$netmask dev $iface"
 
-       ocf_log info "$CMD"
-       $CMD ||
-               return $OCF_ERR_GENERIC
+       ocf_run $CMD || return $OCF_ERR_GENERIC
+
+       if ocf_is_true $OCF_RESKEY_flush_routes; then
+           ocf_run ip route flush cache
+       fi
+
        return $OCF_SUCCESS
 }
 


_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/

Reply via email to