[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <w2l412e6f7f1005031905jf204b10ax67da6e9018ea81c4@mail.gmail.com>
Date: Tue, 4 May 2010 10:05:22 +0800
From: Changli Gao <xiaosuo@...il.com>
To: Eric Dumazet <eric.dumazet@...il.com>
Cc: David Miller <davem@...emloft.net>, netdev@...r.kernel.org
Subject: Re: [PATCH v2] ethernet: call __skb_pull() in eth_type_trans()
On Mon, May 3, 2010 at 10:44 PM, Eric Dumazet <eric.dumazet@...il.com> wrote:
>
> Hmm, I feel very uncompfortable with this patch.
>
> I am pretty sure some callers dont check minimum ethernet frame length.
>
> At least a WARN_ON_ONCE() is needed, just in case...
> In fact our stack has different requirements.
>
> Check net/ipv4/ip_gre.c for example.
>
> if (tunnel->dev->type == ARPHRD_ETHER) {
> if (!pskb_may_pull(skb, ETH_HLEN)) {
> stats->rx_length_errors++;
> stats->rx_errors++;
> goto drop;
> }
>
> iph = ip_hdr(skb);
> skb->protocol = eth_type_trans(skb, tunnel->dev);
> skb_postpull_rcsum(skb, eth_hdr(skb), ETH_HLEN);
> }
>
So the minimal packet length eth_type_trans() requires should be
ETH_HLEN, not ETH_ZLEN.
--
Regards,
Changli Gao(xiaosuo@...il.com)
Powered by blists - more mailing lists