On 12/17/05, [email protected]
<[email protected]> wrote:
> linux-ha CVS committal
>
> Author  : andrew
> Host    :
> Project : linux-ha
> Module  : resources
>
> Dir     : linux-ha/resources/OCF
>
>
> Modified Files:
>         IPaddr.in
>
>
> Log Message:
> Do not overwrite the value for NICINFO calculated in the conditional block
> Use the calculated NETMASK in later calls to $FINDIF
> Pass -C to $FINDIF so the calculated NETMASK is of the correct form
>
> ===================================================================
> RCS file: /home/cvs/linux-ha/linux-ha/resources/OCF/IPaddr.in,v
> retrieving revision 1.30
> retrieving revision 1.31
> diff -u -3 -r1.30 -r1.31
> --- IPaddr.in   13 Nov 2005 17:16:43 -0000      1.30
> +++ IPaddr.in   17 Dec 2005 07:00:39 -0000      1.31
> @@ -205,20 +205,25 @@
>          NIC="$OCF_RESKEY_nic"
>          NETMASK="$OCF_RESKEY_netmask"
>          #
> -        # $FINDIF can deal with the condition of empty intermediate 
> parameters.
> +        # $FINDIF can NOT deal with the condition of empty intermediate 
> parameters.
>          #
>
> -       if [ ! -z "$OCF_RESKEY_netmask" ]; then
> -               NICINFO=`$FINDIF "$BASEIP/$NETMASK/$NIC/$BRDCAST"`
> +       if [ ! -z "$NETMASK" ]; then
> +               NICINFO=`$FINDIF -C "$BASEIP/$NETMASK/$NIC/$BRDCAST"`

We should not use the -C option, ifconfig do not like things like "netmask 24".

>         else
> -               NICINFO=`$FINDIF "$BASEIP"`
> +               NICINFO=`$FINDIF -C "$BASEIP"`
>         fi
>
> -        NICINFO=`$FINDIF "$BASEIP/$NETMASK/$NIC/$BRDCAST"`
>         if [ $? -eq 0 ]; then
>              NIC=`echo "$NICINFO" | cut -f1`
>              NETMASK=`echo "$NICINFO" | cut -f2`
>              BRDCAST=`echo "$NICINFO" | cut -f3`
> +           case "$SYSTYPE" in
> +               Darwin*)
> +                   NETMASK=`echo "$NICINFO" | cut -f2 | cut -d ' ' -f2`
> +                   BRDCAST=`echo "$NICINFO" | cut -f3 | cut -d ' ' -f2`
> +                   ;;
> +           esac

The "netmask" literal is later used in add_interface( ), to set
netmask with ifconfig, wasn't your Darwin broken without it?
>         else
>             ocf_log err "Failed: $FINDIF $BASEIP/$NETMASK/$NIC/$BRDCAST . 
> Parameter error."
>             exit $OCF_ERR_GENERIC
> @@ -601,8 +606,8 @@
>    fi
>
>    FINDIFOPT=$BASEIP
> -  if [ ! -z "$OCF_RESKEY_netmask" ]; then
> -    FINDIFOPT=$FINDIFOPT/$OCF_RESKEY_netmask/$NIC/$BROADCAST
> +  if [ -n $NETMASK ]; then
> +    FINDIFOPT=$FINDIFOPT/$NETMASK/$NIC/$BROADCAST
>    fi
>    if
>      NICINFO=`$FINDIF $FINDIFOPT`
>
>
> _______________________________________________
> Linux-ha-cvs mailing list
> [email protected]
> http://lists.community.tummy.com/mailman/listinfo/linux-ha-cvs
>


--
Thanks & regards
Xun Sun
_______________________________________________________
Linux-HA-Dev: [email protected]
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/

Reply via email to