All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Lezcano <daniel.lezcano@free.fr>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: davem@davemloft.net, kaber@trash.net, nightnord@gmail.com,
	netdev@vger.kernel.org
Subject: Re: [PATCH 2/2] dev : fix mtu check when TSO is enabled
Date: Mon, 14 Mar 2011 20:00:43 +0100	[thread overview]
Message-ID: <4D7E65DB.8070708@free.fr> (raw)
In-Reply-To: <1300122105.3423.131.camel@edumazet-laptop>

On 03/14/2011 06:01 PM, Eric Dumazet wrote:
> Le lundi 14 mars 2011 à 17:08 +0100, Daniel Lezcano a écrit :
>> In case the device where is coming from the packet has TSO enabled,
>> we should not check the mtu size value as this one could be bigger
>> than the expected value.
>>
>> This is the case for the macvlan driver when the lower device has
>> TSO enabled. The macvlan inherit this feature and forward the packets
>> without fragmenting them. Then the packets go through dev_forward_skb
>> and are dropped. This patch fix this by checking TSO is not enabled
>> when we want to check the mtu size.
>>
>> Signed-off-by: Daniel Lezcano<daniel.lezcano@free.fr>
>> Cc: Patrick McHardy<kaber@trash.net>
>> Cc: Andrian Nord<nightnord@gmail.com>
>> ---
>>   net/core/dev.c |    6 ++++--
>>   1 files changed, 4 insertions(+), 2 deletions(-)
>>
>> diff --git a/net/core/dev.c b/net/core/dev.c
>> index 6561021..010a0a9 100644
>> --- a/net/core/dev.c
>> +++ b/net/core/dev.c
>> @@ -1526,8 +1526,10 @@ int dev_forward_skb(struct net_device *dev, struct sk_buff *skb)
>>   	skb_orphan(skb);
>>   	nf_reset(skb);
>>
>> -	if (unlikely(!(dev->flags&  IFF_UP) ||
>> -		     (skb->len>  (dev->mtu + dev->hard_header_len + VLAN_HLEN)))) {
>> +	if (unlikely(!(skb->dev->features&  NETIF_F_TSO)&&
>
> Sorry, this needs a comment at least, or even better a helper function
> on its own.
>
> We test both skb->dev&  dev, pointing to different devices, this is
> really error prone.
>
> Are we sure all callers set skb->dev before calling  dev_forward_skb() ?

Thanks Eric for the comments, I will resend a new version.

   -- Daniel


  reply	other threads:[~2011-03-14 19:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-14 16:08 [PATCH 1/2] macvlan : fix checksums error when we are in bridge mode Daniel Lezcano
2011-03-14 16:08 ` [PATCH 2/2] dev : fix mtu check when TSO is enabled Daniel Lezcano
2011-03-14 17:01   ` Eric Dumazet
2011-03-14 19:00     ` Daniel Lezcano [this message]
2011-03-14 17:04 ` [PATCH 1/2] macvlan : fix checksums error when we are in bridge mode Eric Dumazet

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=4D7E65DB.8070708@free.fr \
    --to=daniel.lezcano@free.fr \
    --cc=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --cc=kaber@trash.net \
    --cc=netdev@vger.kernel.org \
    --cc=nightnord@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.