"Andrew Beekhof" <[EMAIL PROTECTED]> writes:
>>  - "netmask" param for IPaddr takes only dot notation, and
>>     does not take CIDR format.
>
> nope, the addition of cidr_netmask was a mistake that we're all going
> to try and forget ever happened.
>
> netmask can take either form (now that findif can too)

OK, This is "the spec."
Then, this is still NOT working.

Here's the command output again:
---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- 
[EMAIL PROTECTED] ~]# env OCF_RESKEY_ip=192.168.20.210 OCF_RESKEY_netmask=24 
OCF_RESKEY_nic=eth0   /usr/lib/ocf/resource.d/heartbeat/IPaddr start
2006/11/28_17:46:06 INFO: Using calculated broadcast for 192.168.20.210: 
192.168.20.255
2006/11/28_17:46:07 INFO: eval /sbin/ifconfig eth0:0 192.168.20.210 netmask 24 
broadcast 192.168.20.255
SIOCSIFNETMASK: Invalid argument
2006/11/28_17:46:07 DEBUG: Sending Gratuitous Arp for 192.168.20.210 on eth0:0 
[eth0]
---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- 
(the latest IPaddr pulled from crm-stable is used)

Please look at the ifconfig command line carefully.
The script gives "24" to the ifconfig netmask option parameter.
"24" is the CIDR value specified at OCF_RESKEY_netmask parameter as is.

Now looking into the IPaddr script code, see Line 820-823 at
ip_validate_all(). The if statement at Line 821 fails in the case
of above because OCF_RESKEY_netmask was specified, therefore the
OCF_RESKEY_netmask value remains "24" which will be eventually
passed to the ifconfig command. The dot notation value
calculated by findif is assigned into $tmp but the value is
never used in this scenario, therefore a bug in findif is not the case.


I would suggest another patch. In this patch,

 - Replace the netmask value by the calculated one if the
   specified netmask value and the calculated value are not matched.

   In the original IPaddr script there are comment lines below
   and this is the case we should use the calculated value.

   # We cant do this because netmask used to take the CIDR form...
   #    elif [ x$tmp != x${OCF_RESKEY_netmask} ]; then


- Modified the description in meta_data so that it reflects the
  specification to avoid confusion.


Thanks,
-- 
Keisuke MORI
NTT DATA Intellilink Corporation

diff -r f220e888f07d resources/OCF/IPaddr.in
--- a/resources/OCF/IPaddr.in	Mon Nov 27 10:48:28 2006 +0100
+++ b/resources/OCF/IPaddr.in	Tue Nov 28 20:20:44 2006 +0900
@@ -121,8 +121,8 @@ routing table.
 
 <parameter name="netmask">
 <longdesc lang="en">
-The netmask for the interface in CIDR format.
-(e.g., 255.255.255.0 and not 24)
+The netmask for the interface either in dot notation or in CIDR format.
+(e.g., 255.255.255.0 or 24)
 
 If unspecified, the script will also try to determine this from the
 routing table.
@@ -818,13 +818,10 @@ ip_validate_all() {
     fi
 
     tmp=`echo "$NICINFO" | cut -f2 | cut -d ' ' -f2`
-    if [ "x$OCF_RESKEY_netmask" = "x" ]; then
+# Replace the value when unmatched in order to accept netmask in the CIDR form.
+    if [ "x$OCF_RESKEY_netmask" = "x" -o x$tmp != x${OCF_RESKEY_netmask} ]; then
 	ocf_log info "Using calculated netmask for ${OCF_RESKEY_ip}: $tmp"
 	OCF_RESKEY_netmask=$tmp
-# We cant do this because netmask used to take the CIDR form...
-#    elif [ x$tmp != x${OCF_RESKEY_netmask} ]; then
-#	ocf_log err "Invalid parameter value: netmask [$OCF_RESKEY_netmask [Calculated netmask: $tmp]"
-#	return $OCF_ERR_ARGS
     fi
     
     tmp=`echo "$NICINFO" | cut -f3 | cut -d ' ' -f2`
_______________________________________________________
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