From: Phil Sutter <phil@nwl.cc>
To: David Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org, johann.baudy@gnu-log.net, eric.dumazet@gmail.com
Subject: Re: sending VLAN packets via packet_mmap
Date: Mon, 11 Oct 2010 15:15:00 +0200 [thread overview]
Message-ID: <20101011131500.GA12342@orbit.nwl.cc> (raw)
In-Reply-To: <20101006.235343.98903661.davem@davemloft.net>
David,
On Wed, Oct 06, 2010 at 11:53:43PM -0700, David Miller wrote:
> From: Phil Sutter <phil@nwl.cc>
> Date: Thu, 30 Sep 2010 21:24:14 +0200
>
> > The actual problem in tpacket_snd() is this:
> >
> > | reserve = dev->hard_header_len;
> > | [...]
> > | if (size_max > dev->mtu + reserve)
> > | size_max = dev->mtu + reserve;
> >
> > I guess the check is there to avoid skb overflows on malicious data
> > input. Is this correct? Are there other reasons for it's existence?
>
> We can add a special allowance of 4 extra bytes in this size check
> _iff_ the device is ethernet and the NETIF_F_VLAN_CHALLENGED netdev
> feature bit is not set.
Making sure the device can actually handle the additional data, good
point!
Perhaps a bit philosophical, but what about NETIF_F_HW_VLAN_TX? AFAICT,
NICs providing that feature insert the VLAN header themselfs, correct?
Therefore __vlan_hwaccel_put_tag() just sets skb->vlan_tci. In order to
make use of that feature, one could always insert the VLAN header in the
kernel using vlan_put_tag(), depending on tpacket2_hdr.tp_vlan_tci
(probably in combination with VLAN_TAG_PRESENT to allow for VLAN ID 0).
Resumptively speaking, I'm probably talking about another feature
instead of solution for the bug in first place so I'll reply to this
mail with a patch implementing the suggested solution.
Greetings, Phil
next prev parent reply other threads:[~2010-10-11 13:15 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-30 19:24 sending VLAN packets via packet_mmap Phil Sutter
2010-10-07 6:53 ` David Miller
2010-10-11 13:15 ` Phil Sutter [this message]
2010-10-11 13:25 ` [PATCH] af_packet: account for VLAN when checking packet size Phil Sutter
2010-10-11 14:03 ` Eric Dumazet
2010-10-11 16:01 ` David Miller
2010-10-11 17:29 ` Phil Sutter
2010-10-12 17:19 ` Michael S. Tsirkin
2010-10-12 17:40 ` David Miller
2010-10-22 8:41 ` Simon Horman
2010-10-27 15:48 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20101011131500.GA12342@orbit.nwl.cc \
--to=phil@nwl.cc \
--cc=davem@davemloft.net \
--cc=eric.dumazet@gmail.com \
--cc=johann.baudy@gnu-log.net \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).