From cac795966480c0bc03205d981a827a46b7a8aa2d Mon Sep 17 00:00:00 2001 From: Augustin Cavalier Date: Mon, 8 Sep 2025 13:12:27 -0400 Subject: [PATCH] openbsd_network: Increment the OPACKETS counter in ifq_dequeue. Otherwise it's never incremented, and the number of transmitted packets in ifconfig would stay 0. --- src/libs/compat/openbsd_network/compat/net/if_var.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/libs/compat/openbsd_network/compat/net/if_var.h b/src/libs/compat/openbsd_network/compat/net/if_var.h index 58d5eb48d3..7f70812d9c 100644 --- a/src/libs/compat/openbsd_network/compat/net/if_var.h +++ b/src/libs/compat/openbsd_network/compat/net/if_var.h @@ -29,13 +29,20 @@ ifq_enqueue(struct ifaltq *ifq, struct mbuf *m) return 0; } + static struct mbuf* -ifq_dequeue(struct ifaltq *ifq) +ifq_dequeue_openbsd(if_t ifp, struct ifaltq *ifq) { struct mbuf* m = NULL; IF_DEQUEUE(ifq, m); + if (m != NULL && ifq == &ifp->if_snd) { + // OpenBSD drivers don't increment the OPACKETS counter directly, + // so we do it here. + if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); + } return m; } +#define ifq_dequeue(IFQ) ifq_dequeue_openbsd(ifp, IFQ) #ifndef __cplusplus