ok i finally figured out the debugging option of PF might be helpful too
I've put it into misc mode.
I've put PF here back on.
When looking at /var/log/messages when i do the test, I get loads of these :
May 17 00:41:03 lnx kernel: pf: BAD state: TCP 192.168.1.100:61777 192.168.1.100:61777 213.40.196.93:80 [lo=3200806316 high=3200812108 win=33304 modulator=0 wscale=1] [lo=936377993 high=936444600 win=5792 modulator=0 wscale=0] 9:9 S seq=3223601976 ack=936377993 len=0 ackskew=0 pkts=4:2 dir=out,fwd
May 17 00:41:03 lnx kernel: pf: State failure on: 1 | 5
May 17 00:41:03 lnx kernel: pf: BAD state: TCP 192.168.1.100:53020 192.168.1.100:53020 213.40.196.93:80 [lo=3440918211 high=3440924003 win=33304 modulator=0 wscale=1] [lo=944883930 high=944950537 win=5792 modulator=0 wscale=0] 9:9 S seq=3453415866 ack=944883930 len=0 ackskew=0 pkts=4:2 dir=out,fwd
May 17 00:41:03 lnx kernel: pf: State failure on: 1 | 5
May 17 00:41:04 lnx kernel: pf: BAD state: TCP 192.168.1.100:61112 192.168.1.100:61112 213.40.196.93:80 [lo=2880554281 high=2880560073 win=33304 modulator=0 wscale=1] [lo=950102446 high=950169053 win=5792 modulator=0 wscale=0] 9:9 S seq=2895159713 ack=950102446 len=0 ackskew=0 pkts=4:2 dir=out,fwd
May 17 00:41:04 lnx kernel: pf: State failure on: 1 | 5
May 17 00:41:05 lnx kernel: pf: BAD state: TCP 192.168.1.100:62364 192.168.1.100:62364 213.40.196.93:80 [lo=2592795149 high=2592800941 win=33304 modulator=0 wscale=1] [lo=935531122 high=935597729 win=5792 modulator=0 wscale=0] 9:9 S seq=2603319085 ack=935531122 len=0 ackskew=0 pkts=4:2 dir=out,fwd
May 17 00:41:05 lnx kernel: pf: State failure on: 1 | 5
May 17 00:41:06 lnx kernel: pf: BAD state: TCP 192.168.1.100:61777 192.168.1.100:61777 213.40.196.93:80 [lo=3200806316 high=3200812108 win=33304 modulator=0 wscale=1] [lo=936377993 high=936444600 win=5792 modulator=0 wscale=0] 9:9 S seq=3223601976 ack=936377993 len=0 ackskew=0 pkts=4:2 dir=out,fwd
May 17 00:41:06 lnx kernel: pf: State failure on: 1 | 5
May 17 00:41:06 lnx kernel: pf: BAD state: TCP 192.168.1.100:53020 192.168.1.100:53020 213.40.196.93:80 [lo=3440918211 high=3440924003 win=33304 modulator=0 wscale=1] [lo=944883930 high=944950537 win=5792 modulator=0 wscale=0] 9:9 S seq=3453415866 ack=944883930 len=0 ackskew=0 pkts=4:2 dir=out,fwd
May 17 00:41:06 lnx kernel: pf: State failure on: 1 | 5
May 17 00:41:07 lnx kernel: pf: BAD state: TCP 192.168.1.100:61112 192.168.1.100:61112 213.40.196.93:80 [lo=2880554281 high=2880560073 win=33304 modulator=0 wscale=1] [lo=950102446 high=950169053 win=5792 modulator=0 wscale=0] 9:9 S seq=2895159713 ack=950102446 len=0 ackskew=0 pkts=4:2 dir=out,fwd
May 17 00:41:07 lnx kernel: pf: State failure on: 1 | 5
May 17 00:41:08 lnx kernel: pf: BAD state: TCP 192.168.1.100:57459 192.168.1.100:57459 213.40.196.93:80 [lo=1065900272 high=1065906064 win=33304 modulator=0 wscale=1] [lo=957857707 high=957924314 win=5792 modulator=0 wscale=0] 9:9 S seq=1076524357 ack=957857707 len=0 ackskew=0 pkts=4:2 dir=out,fwd
May 17 00:41:08 lnx kernel: pf: State failure on: 1 | 5
May 17 00:41:09 lnx kernel: pf: BAD state: TCP 192.168.1.100:61777 192.168.1.100:61777 213.40.196.93:80 [lo=3200806316 high=3200812108 win=33304 modulator=0 wscale=1] [lo=936377993 high=936444600 win=5792 modulator=0 wscale=0] 9:9 S seq=3223601976 ack=936377993 len=0 ackskew=0 pkts=4:2 dir=out,fwd
May 17 00:41:09 lnx kernel: pf: State failure on: 1 | 5
May 17 00:41:09 lnx kernel: pf: BAD state: TCP 192.168.1.100:53020 192.168.1.100:53020 213.40.196.93:80 [lo=3440918211 high=3440924003 win=33304 modulator=0 wscale=1] [lo=944883930 high=944950537 win=5792 modulator=0 wscale=0] 9:9 S seq=3453415866 ack=944883930 len=0 ackskew=0 pkts=4:2 dir=out,fwd
May 17 00:41:09 lnx kernel: pf: State failure on: 1 | 5
May 17 00:41:10 lnx kernel: pf: BAD state: TCP 192.168.1.100:61112 192.168.1.100:61112 213.40.196.93:80 [lo=2880554281 high=2880560073 win=33304 modulator=0 wscale=1] [lo=950102446 high=950169053 win=5792 modulator=0 wscale=0] 9:9 S seq=2895159713 ack=950102446 len=0 ackskew=0 pkts=4:2 dir=out,fwd
May 17 00:41:10 lnx kernel: pf: State failure on: 1 | 5
May 17 00:41:11 lnx kernel: pf: BAD state: TCP 192.168.1.100:57459 192.168.1.100:57459 213.40.196.93:80 [lo=1065900272 high=1065906064 win=33304 modulator=0 wscale=1] [lo=957857707 high=957924314 win=5792 modulator=0 wscale=0] 9:9 S seq=1076524357 ack=957857707 len=0 ackskew=0 pkts=4:2 dir=out,fwd
May 17 00:41:11 lnx kernel: pf: State failure on: 1 | 5
May 17 00:41:13 lnx kernel: pf: BAD state: TCP 192.168.1.100:53020 192.168.1.100:53020 213.40.196.93:80 [lo=3440918211 high=3440924003 win=33304 modulator=0 wscale=1] [lo=944883930 high=944950537 win=5792 modulator=0 wscale=0] 9:9 S seq=3453415866 ack=944883930 len=0 ackskew=0 pkts=4:2 dir=out,fwd
May 17 00:41:13 lnx kernel: pf: State failure on: 1 | 5
May 17 00:41:13 lnx kernel: pf: BAD state: TCP 192.168.1.100:61112 192.168.1.100:61112 213.40.196.93:80 [lo=2880554281 high=2880560073 win=33304 modulator=0 wscale=1] [lo=950102446 high=950169053 win=5792 modulator=0 wscale=0] 9:9 S seq=2895159713 ack=950102446 len=0 ackskew=0 pkts=4:2 dir=out,fwd
May 17 00:41:13 lnx kernel: pf: State failure on: 1 | 5
May 17 00:41:14 lnx kernel: pf: BAD state: TCP 192.168.1.100:57459 192.168.1.100:57459 213.40.196.93:80 [lo=1065900272 high=1065906064 win=33304 modulator=0 wscale=1] [lo=957857707 high=957924314 win=5792 modulator=0 wscale=0] 9:9 S seq=1076524357 ack=957857707 len=0 ackskew=0 pkts=4:2 dir=out,fwd
May 17 00:41:14 lnx kernel: pf: State failure on: 1 | 5
May 17 00:41:16 lnx kernel: pf: BAD state: TCP 192.168.1.100:53020 192.168.1.100:53020 213.40.196.93:80 [lo=3440918211 high=3440924003 win=33304 modulator=0 wscale=1] [lo=944883930 high=944950537 win=5792 modulator=0 wscale=0] 9:9 S seq=3453415866 ack=944883930 len=0 ackskew=0 pkts=4:2 dir=out,fwd
May 17 00:41:16 lnx kernel: pf: State failure on: 1 | 5
May 17 00:41:18 lnx kernel: pf: BAD state: TCP 192.168.1.100:57459 192.168.1.100:57459 213.40.196.93:80 [lo=1065900272 high=1065906064 win=33304 modulator=0 wscale=1] [lo=957857707 high=957924314 win=5792 modulator=0 wscale=0] 9:9 S seq=1076524357 ack=957857707 len=0 ackskew=0 pkts=4:2 dir=out,fwd
May 17 00:41:18 lnx kernel: pf: State failure on: 1 | 5
May 17 00:41:19 lnx kernel: pf: BAD state: TCP 192.168.1.100:61112 192.168.1.100:61112 213.40.196.93:80 [lo=2880554281 high=2880560073 win=33304 modulator=0 wscale=1] [lo=950102446 high=950169053 win=5792 modulator=0 wscale=0] 9:9 S seq=2895159713 ack=950102446 len=0 ackskew=0 pkts=4:2 dir=out,fwd
May 17 00:41:19 lnx kernel: pf: State failure on: 1 | 5
May 17 00:41:21 lnx kernel: pf: BAD state: TCP 192.168.1.100:57459 192.168.1.100:57459 213.40.196.93:80 [lo=1065900272 high=1065906064 win=33304 modulator=0 wscale=1] [lo=957857707 high=957924314 win=5792 modulator=0 wscale=0] 9:9 S seq=1076524357 ack=957857707 len=0 ackskew=0 pkts=4:2 dir=out,fwd
May 17 00:41:21 lnx kernel: pf: State failure on: 1 | 5
May 17 00:41:24 lnx kernel: pf: BAD state: TCP 192.168.1.100:57459 192.168.1.100:57459 213.40.196.93:80 [lo=1065900272 high=1065906064 win=33304 modulator=0 wscale=1] [lo=957857707 high=957924314 win=5792 modulator=0 wscale=0] 9:9 S seq=1076524357 ack=957857707 len=0 ackskew=0 pkts=4:2 dir=out,fwd
May 17 00:41:24 lnx kernel: pf: State failure on: 1 | 5
Note the source ports - a lot of duplicates - pretty odd. I wonder if this means that the connect () function appears to reuse old sockets too quickly.
Anyway, I don't think the problem should be due to having too little ports availble.
My sysctl range vars :
net.inet.ip.portrange.lowfirst: 1023
net.inet.ip.portrange.lowlast: 600
net.inet.ip.portrange.first: 49152
net.inet.ip.portrange.last: 65535
net.inet.ip.portrange.hifirst: 49152
net.inet.ip.portrange.hilast: 65535
net.inet.ip.portrange.reservedhigh: 1023
net.inet.ip.portrange.reservedlow: 0
net.inet.ip.portrange.randomized: 1
net.inet.ip.portrange.randomcps: 10
net.inet.ip.portrange.randomtime: 45
These are the same as yours - sooooo ... humm