Yes, ipf is stateful. You might want to go there if you want to setup a small OpenBSD firewall: http://real.ath.cx/BSDinstall.html