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>

next in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.

------=_NextPart_000_0001_01CB92A3.31D1F900
Content-Type: text/plain;
	charset="windows-1251"
Content-Transfer-Encoding: quoted-printable

Hi!


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

=A0
--
Rozhuk Ivan
=A0=20


------=_NextPart_000_0001_01CB92A3.31D1F900
Content-Type: application/octet-stream;
	name="ng_ether.patch"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="ng_ether.patch"

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

------=_NextPart_000_0001_01CB92A3.31D1F900--




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