I'm seeing a 35-40 second delay in ifstated after a state transition
before jumping into the init {} sequence.  In the log below, the
detection to isp2l2down occurs at 10:36:19 and the first init run occurs
at 10:36:58.  Is that normal?

(OpenBSD 4.5-stable (GENERIC.MP) #7: Fri Jul 31 09:13:51 EDT 2009) Is
this normal?

/var/log/daemon:
Oct  9 10:33:24 fw1 ifstated[22548]: changing state to safereturn
Oct  9 10:36:19 fw1 ifstated[22548]: changing state to isp2l2down
Oct  9 10:36:58 fw1 ifstated[22548]: running pfctl -a outbound3 -F rules
Oct  9 10:36:58 fw1 ifstated[22548]: running date|mail -s 'FW1 says
Link2 is down' root
Oct  9 10:36:58 fw1 ifstated[22548]: running pfctl -a outbound3 -F rules
-f /etc/pf.isp2l2up.conf
Oct  9 10:36:58 fw1 ifstated[22548]: running date|mail -s 'FW1 says
Link2 is up' root

/etc/ifstated.conf:
isp1l1_up = '( "ping -q -c 8 -w 2 -I 192.168.1.60 192.168.16.1 >
/dev/null" every 60)'
isp2l1_up = '( "ping -q -c 10 -w 1 192.168.8.254 > /dev/null" every 60
&& \
                "ping -q -c 10 -w 1 -I 192.168.8.228 192.168.32.20 >
/dev/null" every 60)'
isp2l2_up = '( "ping -q -c 10 -w 1 192.168.57.221 > /dev/null" every 60
&& \
                "ping -q -c 10 -w 1 -I 192.168.57.222 192.168.58.10 >
/dev/null" every 60)'



state bothup {
        init {
                run "route delete default 192.168.1.33"
                run "route add default 192.168.8.254"
                run "pfctl -a outbound3 -F rules -f
/etc/pf.isp2l2up.conf"
                run "pfctl -a outbound -F rules -f /etc/pf.bothup.conf"
                run "date|mail -s 'FW1 says both ISPs up' root"
        }
        if ! $isp2l1_up
                set-state isp2l1down
        if ! $isp2l2_up
                set-state isp2l2down
        if ! $isp1l1_up
                set-state isp1l1down
}

state safereturn {
        if ! $isp2l1_up
                set-state isp2l1down
        if ! $isp2l2_up
                set-state isp2l2down
        if ! $isp1l1_up
                set-state isp1l1down
}

state isp1l1down {
        init {
                run "route delete default 192.168.1.33"
                run "route add default 192.168.8.254"
                run "pfctl -a outbound -F rules -f
/etc/pf.isp1l1down.conf"
                run "date|mail -s 'FW1 says Isp1l1 is down' root"
                run "pkill ftp-proxy"
                run "sleep 5"
                run "/usr/sbin/ftp-proxy -a 192.168.8.228"
        }
        if $isp1l1_up {
                run "pkill ftp-proxy"
                run "/usr/sbin/ftp-proxy -a 192.168.1.62"
                run "/usr/sbin/ftp-proxy -b 192.168.1.43 -R 10.9.0.11 -p
21"
                set-state bothup
        }
}

state isp2l1down {
        init {
                run "route delete default 192.168.8.254"
                run "route add default 192.168.1.33"
                run "pfctl -a outbound -F rules -f
/etc/pf.isp2l1down.conf"
                run "date|mail -s 'FW1 says FreedomNet Link1 is down'
root"
        }
        if $isp2l1_up {
                set-state bothup
        }
}

state isp2l2down {
        init {
                run "pfctl -a outbound3 -F rules"
                run "date|mail -s 'FW1 says FreedomNet Link2 is down'
root"
        }
        if $isp2l2_up {
                run "pfctl -a outbound3 -F rules -f
/etc/pf.isp2l2up.conf"
                run "date|mail -s 'FW1 says FreedomNet Link2 is up'
root"
                set-state safereturn
        }
        if ! $isp2l1_up
                set-state isp2l1down
}


-Steve S.

Reply via email to