Netdev List
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Phil Sutter <phil@nwl.cc>
Cc: davem@davemloft.net, netdev@vger.kernel.org, johann.baudy@gnu-log.net
Subject: Re: [PATCH] af_packet: account for VLAN when checking packet size
Date: Mon, 11 Oct 2010 16:03:02 +0200	[thread overview]
Message-ID: <1286805782.2737.25.camel@edumazet-laptop> (raw)
In-Reply-To: <1286803522-16478-1-git-send-email-phil@nwl.cc>

Le lundi 11 octobre 2010 à 15:25 +0200, Phil Sutter a écrit :
> Signed-off-by: Phil Sutter <phil@nwl.cc>
> ---
>  net/packet/af_packet.c |    6 ++++++
>  1 files changed, 6 insertions(+), 0 deletions(-)
> 
> diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
> index 9a17f28..ad37754 100644
> --- a/net/packet/af_packet.c
> +++ b/net/packet/af_packet.c
> @@ -56,6 +56,7 @@
>  #include <linux/in.h>
>  #include <linux/inet.h>
>  #include <linux/netdevice.h>
> +#include <linux/if_arp.h>
>  #include <linux/if_packet.h>
>  #include <linux/wireless.h>
>  #include <linux/kernel.h>
> @@ -983,6 +984,11 @@ static int tpacket_snd(struct packet_sock *po, struct msghdr *msg)
>  
>  	reserve = dev->hard_header_len;
>  
> +	/* allow VLAN packets when device supports them */
> +	if (likely(dev->type == ARPHRD_ETHER) &&
> +	    likely(!(dev->features & NETIF_F_VLAN_CHALLENGED)))
> +		reserve += VLAN_HLEN;
> +
>  	err = -ENETDOWN;
>  	if (unlikely(!(dev->flags & IFF_UP)))
>  		goto out_put;

If we dont test ETH_P_8021Q protocol here, we allow sending 1504 bytes
frames for MTU=1500

Should we really care ?

If not, just do

reserve = dev->hard_header_len + VLAN_HLEN;




  reply	other threads:[~2010-10-11 14:03 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
2010-10-11 13:25     ` [PATCH] af_packet: account for VLAN when checking packet size Phil Sutter
2010-10-11 14:03       ` Eric Dumazet [this message]
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=1286805782.2737.25.camel@edumazet-laptop \
    --to=eric.dumazet@gmail.com \
    --cc=davem@davemloft.net \
    --cc=johann.baudy@gnu-log.net \
    --cc=netdev@vger.kernel.org \
    --cc=phil@nwl.cc \
    /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