Netdev List
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Michal Kubecek <mkubecek@suse.cz>
Cc: netdev@vger.kernel.org, netfilter-devel@vger.kernel.org
Subject: Re: Can we rely on ethernet header padding?
Date: Tue, 19 Mar 2013 08:21:35 -0700	[thread overview]
Message-ID: <1363706495.2558.14.camel@edumazet-glaptop> (raw)
In-Reply-To: <20130319150545.GA18218@unicorn.suse.cz>

On Tue, 2013-03-19 at 16:05 +0100, Michal Kubecek wrote:
> Hello,
> 
> a customer of ours ran into
> 
>   http://bugzilla.netfilter.org/show_bug.cgi?id=765
> 
> They checked that commit a504b86e prevents the crash but I'm not sure it
> is sufficient.
> 
> The crash happens when br_nf_pre_routing_finish_bridge() calls
> neigh_hh_bridge() which copies not only destination MAC address but also
> the padding with it. IIUC this is for performance reasons (so that
> aligned 8 bytes are copied rather than 6).
> 
> But I wonder whether we can rely on the fact that every skb on an
> ethernet-like device has ethernet header padded at least to the 16 bytes
> expected by neigh_hh_bridge() and neigh_hh_output() or whether the
> bridge code should make sure. I tried to look for such test but couldn't
> find any, even if commit a504b86e description mentions reallocating the
> skb rather than a crash.

Thats a side effect.

Before calling netif_rx() the driver usually calls eth_type_trans()
to pull the ethernet header, so there is the room for 14 bytes.

Normally a driver has NET_SKB_PAD bytes of headroom before the ethernet
header, so the bridge code is safe only if all drivers use this
NET_SKB_PAD padding on receive side. And they really should for
performance reasons.

Better not touch bridge code to catch offending drivers






  reply	other threads:[~2013-03-19 15:21 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-19 15:05 Can we rely on ethernet header padding? Michal Kubecek
2013-03-19 15:21 ` Eric Dumazet [this message]
2013-03-19 15:48   ` Michal Kubecek
2013-03-19 21:25     ` Stephen Hemminger
2013-03-20  9:54       ` Michal Kubecek

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=1363706495.2558.14.camel@edumazet-glaptop \
    --to=eric.dumazet@gmail.com \
    --cc=mkubecek@suse.cz \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@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