I'm getting some weird results when running iperf tests over UDP to a
remote server. The gateway is running OpenBSD 3.6 with pf. When I try
iperf from the gateway itself, I get these results on the remote node:

[ 3] local port 5001 connected with port 5001
[ 3] 0.0- 1.0 sec 880 KBytes 7.21 Mbits/sec 0.988 ms 223/ 836
(27%)
[ 3] 1.0- 2.0 sec 902 KBytes 7.39 Mbits/sec 0.914 ms 231/ 859
(27%)
[ 3] 2.0- 3.0 sec 879 KBytes 7.20 Mbits/sec 1.061 ms 223/ 835
(27%)
[ 3] 3.0- 4.0 sec 881 KBytes 7.22 Mbits/sec 1.018 ms 243/ 857
(28%)
[ 3] 4.0- 5.0 sec 873 KBytes 7.15 Mbits/sec 1.209 ms 250/ 858
(29%)
[ 3] 5.0- 6.0 sec 891 KBytes 7.30 Mbits/sec 1.239 ms 231/ 852
(27%)
[ 3] 6.0- 7.0 sec 873 KBytes 7.15 Mbits/sec 1.177 ms 239/ 847
(28%)
[ 3] 7.0- 8.0 sec 858 KBytes 7.03 Mbits/sec 1.133 ms 238/ 836
(28%)
[ 3] 8.0- 9.0 sec 879 KBytes 7.20 Mbits/sec 0.999 ms 256/ 868
(29%)
[ 3] 9.0-10.0 sec 871 KBytes 7.14 Mbits/sec 1.454 ms 218/ 825
(26%)
[ 3] 0.0-10.0 sec 8.60 MBytes 7.21 Mbits/sec 1.196 ms 2368/ 8504
(28%)
[ 3] 0.0-10.0 sec 1 datagrams received out-of-order

When running Iperf from a Linux or Windows PC inside the LAN behind the
OpenBSD gateway, I get much better results:

[ 3] local port 5001 connected with port
32770
[ 3] 0.0- 1.0 sec 1.16 MBytes 9.77 Mbits/sec 0.817 ms 18/ 849
(2.1%)
[ 3] 1.0- 2.0 sec 1.15 MBytes 9.63 Mbits/sec 1.339 ms 27/ 846
(3.2%)
[ 3] 2.0- 3.0 sec 1.18 MBytes 9.93 Mbits/sec 0.861 ms 10/ 854
(1.2%)
[ 3] 3.0- 4.0 sec 1.17 MBytes 9.84 Mbits/sec 0.981 ms 13/ 850
(1.5%)
[ 3] 4.0- 5.0 sec 1.16 MBytes 9.76 Mbits/sec 1.120 ms 16/ 846
(1.9%)
[ 3] 5.0- 6.0 sec 1.16 MBytes 9.76 Mbits/sec 0.708 ms 25/ 855
(2.9%)
[ 3] 6.0- 7.0 sec 1.15 MBytes 9.64 Mbits/sec 1.327 ms 26/ 846
(3.1%)
[ 3] 7.0- 8.0 sec 1.14 MBytes 9.54 Mbits/sec 1.175 ms 37/ 848
(4.4%)
[ 3] 8.0- 9.0 sec 1.17 MBytes 9.84 Mbits/sec 1.144 ms 12/ 849
(1.4%)
[ 3] 9.0-10.0 sec 1.17 MBytes 9.85 Mbits/sec 1.210 ms 14/ 852
(1.6%)
[ 3] 0.0-10.0 sec 11.6 MBytes 9.76 Mbits/sec 1.179 ms 198/ 8505
(2.3%)

The percentage represents packet loss. Any idea why the results are
better for hosts behind the gateway that on the gateway itself? I
double checked that the parameters used to send the UDP datagrams are
identical on both machines.