Hi,
i know ifstated was designed with carp in mind, but nothing from the
manpage seems to forbid one to use it with other interfaces, thus im
trying to make it work with ppp so that i can just up a potentially
existing ppp0 interface and ifstated would magically start xl2tpd to up
a tunnel.
fiddling with this, i came up with this sample config which... behaves
weird:
init-state vpn_unknown
state vpn_up {
if ppp1.link.unknown {
run 'echo "ppp1 is up->unk" > /tmp/foo'
}
if ppp1.link.down {
run 'echo "ppp1 is up->down" > /tmp/foo'
}
}
state vpn_unknown {
if ppp1.link.up {
run 'echo "ppp1 is unk->up" > /tmp/foo'
set-state vpn_up
}
if ppp1.link.down {
run 'echo "ppp1 is unk->down" > /tmp/foo'
set-state vpn_down
}
}
$ifconfig ppp1
ppp1: flags=8010<POINTOPOINT,MULTICAST> mtu 1500
index 8 priority 0 llprio 3
groups: ppp
$doas ifstated -vd -f t.conf
initial state: vpn_unknown
changing state to vpn_unknown
running echo "ppp1 is unk->up" > /tmp/foo
changing state to vpn_up
running echo "ppp1 is up->unk" > /tmp/foo
started
i dont really understand the state flipping here... it's as if at first
ppp1.link.up was true, then immediately the link state is unknown.. or
maybe it just evaluates the first statement to true, when no macros are
used ? the config is valid according to the grammar, but the behaviour
is .. weird. Dunno if the grammar or the examples or the manpage should be
adapted/clarified ?