git: 8209ceeb7504 - main - if_bridge: count the drops on the fragmentation path
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 11 Sep 2026 17:16:27 UTC
The branch main has been updated by netchild:
URL: https://cgit.FreeBSD.org/src/commit/?id=8209ceeb7504417c49fae77de4c77286eccb8746
commit 8209ceeb7504417c49fae77de4c77286eccb8746
Author: Alexander Leidinger <netchild@FreeBSD.org>
AuthorDate: 2026-09-04 07:36:10 +0000
Commit: Alexander Leidinger <netchild@FreeBSD.org>
CommitDate: 2026-09-11 17:16:09 +0000
if_bridge: count the drops on the fragmentation path
bridge_pfil() returned a fragmentation failure without counting it,
and bridge_fragment() dropped a chain on three allocation failures
without counting those either.
Count the first on the filtered interface and the others with
ips_odropped, which is what ip_fragment() uses for the same failure
and what bridge_fragment() already uses for its success case.
Reviewed by: gallatin
Differential Revision: https://reviews.freebsd.org/D59391
Assisted-by: Claude Code (Fable 5, Opus 5)
---
sys/net/if_bridge.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/sys/net/if_bridge.c b/sys/net/if_bridge.c
index f45b0a5822c9..b8dc3b70d832 100644
--- a/sys/net/if_bridge.c
+++ b/sys/net/if_bridge.c
@@ -3943,6 +3943,7 @@ bridge_pfil(struct mbuf **mp, struct ifnet *bifp, struct ifnet *ifp, int dir)
#ifdef INET
struct ip *ip = NULL;
int hlen = 0;
+ struct ifnet *errifp = (bifp != NULL) ? bifp : ifp;
#endif
snap = 0;
@@ -4117,6 +4118,9 @@ bridge_pfil(struct mbuf **mp, struct ifnet *bifp, struct ifnet *ifp, int dir)
if (i > ifp->if_mtu) {
error = bridge_fragment(ifp, mp, &eh2, snap,
&llc1);
+ if (error != 0)
+ if_inc_counter(errifp,
+ IFCOUNTER_OERRORS, 1);
return (error);
}
}
@@ -4370,8 +4374,10 @@ bridge_fragment(struct ifnet *ifp, struct mbuf **mp, struct ether_header *eh,
int error = -1;
if (m->m_len < sizeof(struct ip) &&
- (m = m_pullup(m, sizeof(struct ip))) == NULL)
+ (m = m_pullup(m, sizeof(struct ip))) == NULL) {
+ KMOD_IPSTAT_INC(ips_odropped);
goto dropit;
+ }
ip = mtod(m, struct ip *);
m->m_pkthdr.csum_flags |= CSUM_IP;
@@ -4390,6 +4396,7 @@ bridge_fragment(struct ifnet *ifp, struct mbuf **mp, struct ether_header *eh,
M_PREPEND(mcur, sizeof(struct llc), M_NOWAIT);
if (mcur == NULL) {
error = ENOBUFS;
+ KMOD_IPSTAT_INC(ips_odropped);
if (mprev != NULL)
mprev->m_nextpkt = nextpkt;
goto dropit;
@@ -4400,6 +4407,7 @@ bridge_fragment(struct ifnet *ifp, struct mbuf **mp, struct ether_header *eh,
M_PREPEND(mcur, ETHER_HDR_LEN, M_NOWAIT);
if (mcur == NULL) {
error = ENOBUFS;
+ KMOD_IPSTAT_INC(ips_odropped);
if (mprev != NULL)
mprev->m_nextpkt = nextpkt;
goto dropit;