ifstated behavior

Alexandre Biancalana ale at seudns.net
Tue Mar 20 03:22:53 UTC 2007


Hi list,

  First, excuse-me by the off-topic message, I asked this on -questions 
but I don't have any answer.

  I'm trying to setup ifstated to check two links and if some go down, 
do some actions like change pf rules and machine's route.
 
  My doubt is about the execution order/repetition of the states body of 
ifstated.conf, in all configs that I tried just the last check is 
executed always, follow and example:

ifstated.conf:
==============================
loglevel debug

ping1 = '( "ping -q -c 1 -t 3 www.site1.com <http://www.site1.com> > 
/dev/null" every 10 ) '
ping2 = '( "ping -q -c 1 -t 3 www.site2.com <http://www.site2.com> > 
/dev/null" every 10 ) '

state one {
        if ! ( $ping1 && $ping2 ) {
                set-state two
        }
}

state two {

        init {
                run "logger -p console.notice -t ifstated 'Restarting 
network !'"
        }

        if ( $ping && $ping2 ) {
                set-state one
        }
}

==============================

# ifstated -dv
ping1 = "( "ping -q -c 1 -t 3 www.site1.com <http://www.site1.com> > 
/dev/null" every 10 ) "
ping2 = "( "ping -q -c 1 -t 3 www.site2.com <http://www.site2.com> > 
/dev/null" every 10 ) "
ifstated: initial state: one
ifstated: changing state to one
ifstated: running ping -q -c 1 -t 3 www.site1.com <http://www.site1.com> 
 > /dev/null
ifstated: running ping -q -c 1 -t 3 www.site2.com <http://www.site2.com> 
 > /dev/null
ifstated: started
ifstated: changing state to two
ifstated: running ping -q -c 1 -t 3 www.site1.com <http://www.site1.com> 
 > /dev/null
ifstated: running ping -q -c 1 -t 3 www.site2.com <http://www.site2.com> 
 > /dev/null
ifstated: running ping -q -c 1 -t 3 www.site2.com <http://www.site2.com> 
 > /dev/null
ifstated: running ping -q -c 1 -t 3 www.site2.com <http://www.site2.com> 
 > /dev/null


As you can see, after change state ifstated execute only the *last* 
check command of the statement (ping2) forever....

This is the expected behavior ?

I'm running 6-STABLE + ifstated-20050505 (instaled via 
/usr/ports/net/ifstated)

Thanks for any help.

Alexandre


More information about the freebsd-net mailing list