Date: Thu, 23 Feb 2006 15:29:13 +0200 From: Oleg Tarasov <subscriber@osk.com.ua> To: FreeBSD MailList <subscriber@osk.com.ua> Cc: freebsd-net@FreeBSD.org Subject: Re: ifstated fails to monitor netgraph interface Message-ID: <648510709.20060223152913@osk.com.ua> In-Reply-To: <1775760256.20060223143441@osk.com.ua> References: <1775760256.20060223143441@osk.com.ua>
next in thread | previous in thread | raw e-mail | index | archive | help
Hello,
I have found a solution to see ng0 state but using external test.
Everything would be fine but there are 2 difficulties:
1) for some reason when in state "secondary" only one external test is
run (viewing logfile at debug loglevel)
2) Second (PPPoE) connection can disappear for a short period of time
destroying default route but it won't trigger state change as the
periodic test can miss this.
What can be the source of 1) ? Commenting second "if" statement in
"secondary" state makes first test run. Other way only second is run
after 1 first test execution.
My ifstated.conf
===========================================================
init-state auto
loglevel debug
pri_iface_up = '"ping -q -c 1 -t 1 111.111.111.111 > /dev/null" every 5'
sec_iface_up = '"ifconfig ng0 | grep UP > /dev/null" every 2'
#sec_iface_up = '"ping -q -c 1 -t 1 222.222.222.222 > /dev/null" every 10'
#sec_iface_up = "ng0.link.up"
state auto {
        if $pri_iface_up
                set-state primary
        if $sec_iface_up
                set-state secondary
}
state primary {
        init {
                run "route delete default"
                run "route add default 111.111.111.111"
                run "sleep 20"
        }
        if ! $pri_iface_up
                set-state primary_failing
}
state primary_failing {
        init {
                run "sleep 10"
        }
        if $pri_iface_up
                set-state primary
        if ! $pri_iface_up && $sec_iface_up
                set-state secondary
        if ! $pri_iface_up && ! $sec_iface_up
                set-state secondary
}
state secondary {
        init {
                run "route delete default"
                run "route add default 222.222.222.222"
                run "sleep 20"
        }
        if $pri_iface_up
                set-state primary
        if ! $sec_iface_up
                set-state auto
}
==========================================================
Initially primary router is down
ifstated.log
==========================================================
ifstated: initial state: auto
ifstated: changing state to auto
ifstated: running ping -q -c 1 -t 1 111.111.111.111 > /dev/null
ifstated: running ifconfig ng0 | grep UP > /dev/null
ifstated: started
ifstated: changing state to secondary
ifstated: running ping -q -c 1 -t 1 111.111.111.111 > /dev/null
ifstated: running ifconfig ng0 | grep UP > /dev/null
ifstated: running route delete default
delete net default
ifstated: running route add default 222.222.222.222
add net default: gateway 222.222.222.222
ifstated: running sleep 20
ifstated: running ifconfig ng0 | grep UP > /dev/null
ifstated: running ifconfig ng0 | grep UP > /dev/null
ifstated: running ifconfig ng0 | grep UP > /dev/null
ifstated: running ifconfig ng0 | grep UP > /dev/null
ifstated: running ifconfig ng0 | grep UP > /dev/null
ifstated: running ifconfig ng0 | grep UP > /dev/null
ifstated: running ifconfig ng0 | grep UP > /dev/null
==========================================================
-- 
Best regards,
 Oleg Tarasov                          mailto:subscriber@osk.com.ua
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?648510709.20060223152913>
