I've followed the divert and ipfw manpages, Stevens _Unix
Network Programming_ etc, Baldine's Feb 2000 Divert
Sockets mini-HOWTO at www.tldp.org/HOWTO, and everything
else I could find (not very much exactly about this, tho).
My situation is:
firewall: have ipfw divert portnum rule for port
Here's the ipfw -a list content at the start. I
run a shell script manually to set these, it starts
with a flush then adds rules. The keep-state are
leftover from studying dynamic rule creation. (FWIW,
Mac OSX 10.2.8 seemed on brief review not to use a
3000 check-state I originally was trying.)