[Linux-ha-dev] IPaddr2 gives a spurious warning on stop
Aníbal Monsalve Salazar
anibal at sgi.com
Mon Mar 5 21:51:53 MST 2007
On Mon, Mar 05, 2007 at 11:01:52AM +0100, Lars Marowsky-Bree wrote:
>Alternatively, one should look up the netmask prior to deletion.
I've implemented the netmask look up prior to deletion. Please review the
following patch.
The context of this patch is SuSE Linux Enterprise Server 10 running RPM
packages of heartbeat-2.0.8 created using a spec file based on the SuSE
heartbeat-2.0.7 source RPM spec file.
--- resources/OCF/IPaddr2.in~ 2007-01-12 13:57:08.000000000 +1100
+++ resources/OCF/IPaddr2.in 2007-03-06 13:56:21.616190436 +1100
@@ -380,7 +380,31 @@
ipaddr="$1"
iface="$2"
- CMD="$IP2UTIL -f inet addr delete $ipaddr dev $iface"
+ #
+ # Look up the netmask prior to deletion
+ #
+ CMD="$IP2UTIL -o -f inet addr show $iface"
+
+ ocf_log info "$CMD"
+ ADDR=`$CMD`
+
+ if [ $? -ne 0 ]; then
+ return $?
+ fi
+
+ #
+ # $ADDR will have the netmask in CIDR format (e.g., 10.0.0.1/8)
+ #
+ ADDR=`echo $ADDR | grep $ipaddr | sed 's/^.*inet //;s/ brd.*$//'"`
+
+ if [ $? -ne 0 -o ! -z "$ADDR" ]; then
+ return $?
+ fi
+
+ #
+ # Delete interface
+ #
+ CMD="$IP2UTIL -f inet addr delete $ADDR dev $iface"
ocf_log info "$CMD"
$CMD
Thank you,
Aníbal
More information about the Linux-HA-Dev
mailing list