ifstated fails to monitor netgraph interface
Oleg Tarasov
subscriber at osk.com.ua
Thu Feb 23 05:29:18 PST 2006
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 at osk.com.ua
More information about the freebsd-net
mailing list