Re: promisc/netgraph question

Gleb Smirnoff <[email protected]>
Newsgroups gmane.os.freebsd.devel.net
Message-ID <[email protected]>
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
if_ethersubr.c.patch (text/x-diff, 1.5 KB)
commit eda1e75240758a12c58599b831961016cfcb1e03
Author: Gleb Smirnoff <[email protected]>
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)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.