From: David Miller <davem@davemloft.net>
To: nikolay@redhat.com
Cc: netdev@vger.kernel.org, vyasevic@redhat.com,
eric.dumazet@gmail.com, dborkman@redhat.com
Subject: Re: [PATCH net v2] net: fix wrong mac_len calculation for vlans
Date: Sun, 01 Jun 2014 19:40:04 -0700 (PDT) [thread overview]
Message-ID: <20140601.194004.1037431819001171433.davem@davemloft.net> (raw)
In-Reply-To: <1401293028-18685-1-git-send-email-nikolay@redhat.com>
From: Nikolay Aleksandrov <nikolay@redhat.com>
Date: Wed, 28 May 2014 18:03:48 +0200
> After 1e785f48d29a ("net: Start with correct mac_len in
> skb_network_protocol") skb->mac_len is used as a start of the
> calculation in skb_network_protocol() but that is not always correct. If
> skb->protocol == 8021Q/AD, usually the vlan header is already inserted
> in the skb (i.e. vlan reorder hdr == 0). Usually when the packet enters
> dev_hard_xmit it has mac_len == 0 so we take 2 bytes from the
> destination mac address (skb->data + VLAN_HLEN) as a type in
> skb_network_protocol() and return vlan_depth == 4. In the case where TSO is
> off, then the mac_len is set but it's == 18 (ETH_HLEN + VLAN_HLEN), so
> skb_network_protocol() returns a type from inside the packet and
> offset == 22. Also make vlan_depth unsigned as suggested before.
> As suggested by Eric Dumazet, move the while() loop in the if() so we
> can avoid additional testing in fast path.
...
> CC: Vlad Yasevich <vyasevic@redhat.com>
> CC: Eric Dumazet <eric.dumazet@gmail.com>
> CC: Daniel Borkman <dborkman@redhat.com>
> CC: David S. Miller <davem@davemloft.net>
>
> Fixes:1e785f48d29a ("net: Start with correct mac_len in
> skb_network_protocol")
> Signed-off-by: Nikolay Aleksandrov <nikolay@redhat.com>
Applied, thanks Nikolay.
prev parent reply other threads:[~2014-06-02 2:40 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-28 16:03 [PATCH net v2] net: fix wrong mac_len calculation for vlans Nikolay Aleksandrov
2014-06-02 2:40 ` David Miller [this message]
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=20140601.194004.1037431819001171433.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=dborkman@redhat.com \
--cc=eric.dumazet@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=nikolay@redhat.com \
--cc=vyasevic@redhat.com \
/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).