On Thu, 24 Aug 2006, Alan Robertson wrote:

> [...]
> # OCF_RESKEY_ip=10.10.10.199 OCF_RESKEY_cidr_netmask=22 ./IPaddr start
> 2006/08/24_06:58:55 INFO: eval /sbin/ifconfig eth1:0 10.10.10.199
> netmask 255.255.252.0 broadcast 10.10.11.255
> 2006/08/24_06:58:55 INFO: Sending Gratuitous Arp for 10.10.10.199 on
> eth1:0 [eth1]
> 2006/08/24_06:58:55 INFO: /usr/lib64/heartbeat/send_arp -i 500 -r 10 -p
> /var/run/heartbeat/rsctmp/send_arp/send_arp-10.10.10.199 eth1
> 10.10.10.199 auto 10.10.10.199 ffffffffffff
>
> Well... It  indicates that it runs the right ifconfig command -- with
> the right (non-cidr) netmask.  But running 'eval' on it sounds broken..
> - but not a problem in this context.   And, the code used to explicitly
> say 'up'.  But, the man page (for Linux) says it doesn't need 'up' - so
> I guess that's OK.  I hope it works the same on other OSes.  But, two
> OSes have special cases around them.  And, I see how $CMD is set -
> there's no reason for the eval -- and I like 'up' myself ;-)

I confess!  But there is a reason for the eval (or at least for needing
something similar).  See below.


> Let's see what happens when we look at the ifconfig output:
>
> # ifconfig eth1:0
> eth1:0    Link encap:Ethernet  HWaddr 00:0F:EA:3C:45:3C
>           inet addr:10.10.10.199  Bcast:10.10.11.255  Mask:255.255.252.0
>           UP BROADCAST NOTRAILERS RUNNING MULTICAST  MTU:1500  Metric:1
>           Interrupt:193 Base address:0xe800
>
> This is correct.
>
> I added a set -x into the code JUST TO MAKE SURE the eval didn't somehow
> do the wrong thing:
>
> + eval /sbin/ifconfig eth1:0 10.10.10.199 netmask 255.255.252.0
> broadcast 10.10.11.255
> ++ /sbin/ifconfig eth1:0 10.10.10.199 netmask 255.255.252.0 broadcast
> 10.10.11.255
> + set +x


The problem was that in at least one OS the command:
   ifconfig xxx:y   i.j.k.l   netmask p.q.r.s   broadcast w.x.y.z

would fail under BSC.  Investigation showed that this was not generally
true for that OS, but that the particular values in BSC would trigger a
failure of that command.  Further, separating this into three distinct
'ifconfig' commands would succeed.

Hence the need, in that environment, to change a single, multi-argumented
'ifconfig' into a chain of three single-argumented commands.

This is all mentioned in the comments in the code.

Now I'll readily agree that "eval" might not be the best solution to this
problem.  (Hmmm... I've just been typing something similar about mismatch
of problems and solutions in another thread.  The barbed-wire boomerang
returns!)

But we do have a need, in at least one supported environment, for the
action to be more than a single command.

What is the appropriate fix to enable multiple commands?

-- 

:  David Lee                                I.T. Service          :
:  Senior Systems Programmer                Computer Centre       :
:                                           Durham University     :
:  http://www.dur.ac.uk/t.d.lee/            South Road            :
:                                           Durham DH1 3LE        :
:  Phone: +44 191 334 2752                  U.K.                  :
_______________________________________________________
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