Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 11 Feb 2026 15:07:44 -0800
From:      Gleb Smirnoff <glebius@freebsd.org>
To:        Martin Mayer <martin.mayer@m2-it-solutions.de>
Cc:        Zhenlei Huang <zlei@freebsd.org>, "freebsd-net@freebsd.org" <freebsd-net@freebsd.org>
Subject:   Re: promisc/netgraph question
Message-ID:  <aY0LwFfMgooz17pW@cell.glebi.us>
In-Reply-To: <FR2PPF447E0FD2F9C187C52046BA74A61A1BC67A@FR2PPF447E0FD2F.DEUP281.PROD.OUTLOOK.COM>
References:  <FR2PPF447E0FD2F4AB3B97FDEBCB7FC5404BC9FA@FR2PPF447E0FD2F.DEUP281.PROD.OUTLOOK.COM> <FR2PPF447E0FD2FA1F4CFD7A4DF76B5DDD1BC9FA@FR2PPF447E0FD2F.DEUP281.PROD.OUTLOOK.COM> <20260130234931.073ec5df@nuclight.lan> <FR2PPF447E0FD2FF81BF6D4A7538B0D0894BC9CA@FR2PPF447E0FD2F.DEUP281.PROD.OUTLOOK.COM> <BFA9B02C-7B09-42D5-8DD4-381BA276B68A@FreeBSD.org> <aYDemGI4X7CeifE7@cell.glebi.us> <FR2PPF447E0FD2F9C187C52046BA74A61A1BC67A@FR2PPF447E0FD2F.DEUP281.PROD.OUTLOOK.COM>

index | next in thread | previous in thread | raw e-mail

[-- Attachment #1 --]
On Sat, Feb 07, 2026 at 10:26:07AM +0000, Martin Mayer wrote:
M> Based on the previous comments, I can conclude that the current behavior can be called a bug.
M> How should we proceed? Does somebody who is more familiar with the topic open a bug or should I register to the bugtracker and open an issue?

Can you please test the attached patch?

-- 
Gleb Smirnoff

[-- Attachment #2 --]
commit eda1e75240758a12c58599b831961016cfcb1e03
Author: Gleb Smirnoff <glebius@FreeBSD.org>
Date:   Wed Feb 11 15:04:43 2026 -0800

    ethernet: restore M_PROMISC if ng_ether(4) or bridge(4) return a packet

diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c
index 812a31595df9..fac0d9fb6462 100644
--- a/sys/net/if_ethersubr.c
+++ b/sys/net/if_ethersubr.c
@@ -515,6 +515,7 @@ static void
 ether_input_internal(struct ifnet *ifp, struct mbuf *m)
 {
 	struct ether_header *eh;
+	u_int pflag;
 	u_short etype;
 
 	if ((ifp->if_flags & IFF_UP) == 0) {
@@ -640,6 +641,7 @@ ether_input_internal(struct ifnet *ifp, struct mbuf *m)
 	if (ifp->if_l2com != NULL) {
 		KASSERT(ng_ether_input_p != NULL,
 		    ("%s: ng_ether_input_p is NULL", __func__));
+		pflag = m->m_flags & M_PROMISC;
 		m->m_flags &= ~M_PROMISC;
 		(*ng_ether_input_p)(ifp, &m);
 		if (m == NULL) {
@@ -647,6 +649,7 @@ ether_input_internal(struct ifnet *ifp, struct mbuf *m)
 			return;
 		}
 		eh = mtod(m, struct ether_header *);
+		m->m_flags |= pflag;
 	}
 
 	/*
@@ -660,6 +663,7 @@ ether_input_internal(struct ifnet *ifp, struct mbuf *m)
 	 * should be re-examined.
 	 */
 	if (ifp->if_bridge != NULL || (m->m_flags & M_BRIDGE_INJECT) != 0) {
+		pflag = m->m_flags & M_PROMISC;
 		m->m_flags &= ~M_PROMISC;
 		BRIDGE_INPUT(ifp, m);
 		if (m == NULL) {
@@ -667,6 +671,7 @@ ether_input_internal(struct ifnet *ifp, struct mbuf *m)
 			return;
 		}
 		eh = mtod(m, struct ether_header *);
+		m->m_flags |= pflag;
 	}
 
 #if defined(INET) || defined(INET6)
home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?aY0LwFfMgooz17pW>