# HG changeset patch
# User Florian Haas <florian.h...@linbit.com>
# Date 1285854769 -7200
# Node ID 149dda4775a9928a5cc4ac5ebf501982822ba474
# Parent  a401cc017298e50ec34b8d0f8b47ca15ed39bfbf
Medium: IPaddr2: optionally flush kernel routing table on interface stop

diff -r a401cc017298 -r 149dda4775a9 heartbeat/IPaddr2
--- a/heartbeat/IPaddr2 Thu Sep 30 02:48:54 2010 +0200
+++ b/heartbeat/IPaddr2 Thu Sep 30 15:52:49 2010 +0200
@@ -231,8 +231,26 @@
 <content type="string" default="ffffffffffff"/>
 </parameter>
 
+<parameter name="flush_route">
+<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,19 @@
 
        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_route; then
+               local flush_semaphore
+               flush_semaphore=/proc/sys/net/ipv4/route/flush
+               if [ -e $flush_semaphore ]; then
+                       ocf_log info "Flushing kernel routing table"
+                       echo 1 > $flush_semaphore
+               else
+                       ocf_log warn "Configured to flush kernel routing table 
on stop, but $flush_semaphore is not available"
+               fi
+       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