Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 3 Dec 2010 04:33:10 +0800
From:      "Rozhuk Ivan" <Rozhuk_I@mail.ru>
To:        <freebsd-net@freebsd.org>
Subject:   kern/152141: [vlan] encapsulate vlan in ng_ether before output to if
Message-ID:  <000001cb9260$23aeb900$6b0c2b00$@ru>

index | next in thread | raw e-mail

[-- Attachment #1 --]
Hi!


This is a patch for ng_ether_rcv_lower function in ng_ether.c to encapsulate
vlan before send to net.

 
--
Rozhuk Ivan
  


[-- Attachment #2 --]
--- /usr/src/sys/netgraph/ng_ether.c	2010-01-19 04:34:00.000000000 +0800
+++ /usr/src/sys/netgraph/ng_ether.new	2010-11-20 18:26:55.000000000 +0800
@@ -652,6 +652,20 @@
 		    ETHER_ADDR_LEN);
 	}
 
+	/*
+	 * If underlying interface can not do VLAN tag insertion itself
+	 * then attach a packet tag that holds it.
+	 */
+	if ((m->m_flags & M_VLANTAG) &&
+	    (ifp->if_capenable & IFCAP_VLAN_HWTAGGING) == 0) {
+		m = ether_vlanencap(m, m->m_pkthdr.ether_vtag);
+		if (m == NULL) {
+			ifp->if_oerrors++;
+			return (ENOBUFS);
+		}
+		m->m_flags &= ~M_VLANTAG;
+	}
+
 	/* Send it on its way */
 	return ether_output_frame(ifp, m);
 }
help

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?000001cb9260$23aeb900$6b0c2b00$>