Hello.
there is a better diff suggested by bluhm@. the diff
aovoids the ABI break, so you don't need to recompile
pfctl(8).
thanks and
regards
sashan
--------8<---------------8<---------------8<------------------8<--------
diff --git a/sys/net/pf.c b/sys/net/pf.c
index 926a783f400..47eafd748df 100644
--- a/sys/net/pf.c
+++ b/sys/net/pf.c
@@ -8281,7 +8281,15 @@ pf_st_counters_inc(struct pf_pdesc *pd, struct pf_state
*st, int dirndx)
sni->sn->packets[dirndx]++;
sni->sn->bytes[dirndx] += pd->tot_len;
}
- dirndx = (pd->dir == st->direction) ? 0 : 1;
+ /*
+ * af-to states only see inbound packets; the reply
+ * is told apart by its address family.
+ */
+ if (pd->af != st->key[PF_SK_WIRE]->af)
+ dirndx = 1;
+ else
+ dirndx = (pd->dir == st->direction) ? 0 : 1;
+
st->packets[dirndx]++;
st->bytes[dirndx] += pd->tot_len;