Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 20 Mar 2007 00:22:55 -0300
From:      Alexandre Biancalana <ale@seudns.net>
To:        freebsd-net@freebsd.org
Subject:   ifstated behavior
Message-ID:  <45FF538F.1050405@seudns.net>

next in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?45FF538F.1050405>