Date: Mon, 19 May 2008 18:24:51 -0500 From: "Christian S.J. Peron" <csjp@FreeBSD.org> To: freebsd-net@freebsd.org Subject: Re: How to inject fullsize 802.1q-tagged frame through BPF? Message-ID: <20080519232451.GA52560@sub.vaned.net> In-Reply-To: <20080519130722.GA40822@roof1.dnepro.net> References: <20080515152607.GA36663@roof1.dnepro.net> <482C6303.9000904@freebsd.org> <20080519130722.GA40822@roof1.dnepro.net>
next in thread | previous in thread | raw e-mail | index | archive | help
Eugene, Thanks for the report. I will look into this. Although this patch technically works, I think the right solution to this problem is to introduce a new DLT_ for VLAN encapsulated frames. I will look into this problem in a bit more detail. On Mon, May 19, 2008 at 04:07:22PM +0300, Eugene Perevyazko wrote: > On Thu, May 15, 2008 at 12:21:23PM -0400, Sam Leffler wrote: > > Eugene Perevyazko wrote: > > > Is there a way to inject full-mtu vlan-tagged frame through BPF on parent > > >device? > > > I'd like not to open several tenths of BPFs for each vlanN if it's > > > possible. > > > > bpf write code in the kernel calculates header size when packets are > > injected. This is likely based on the frames being stock 802.3 so would > > require mods to the bpf code to handle the additional space for the tag. > > I've made a simple patch that works for me on FreeBSD 6.2-RELEASE #1. > Not sure if this is the way to do it, but it "just works". May be someone > else will need such feature too. > > Eugene Perevyazko > > > --- bpf.c.old Mon May 19 10:47:55 2008 > +++ bpf.c Mon May 19 10:57:44 2008 > @@ -64,6 +64,7 @@ > #include <sys/socket.h> > > #include <net/if.h> > +#include <net/ethernet.h> > #include <net/bpf.h> > #include <net/bpfdesc.h> > > @@ -617,7 +618,9 @@ > return (0); > > bzero(&dst, sizeof(dst)); > - error = bpf_movein(uio, (int)d->bd_bif->bif_dlt, ifp->if_mtu, > + /* Use VLAN_MTU capability, if supported */ > + error = bpf_movein(uio, (int)d->bd_bif->bif_dlt, > + ifp->if_mtu + ( (ifp->if_capenable & IFCAP_VLAN_MTU) ? ETHER_VLAN_ENCAP_LEN : 0 ), > &m, &dst, d->bd_wfilter); > if (error) > return (error); > _______________________________________________ > freebsd-net@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-net > To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org"
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080519232451.GA52560>