[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1286805782.2737.25.camel@edumazet-laptop>
Date: Mon, 11 Oct 2010 16:03:02 +0200
From: Eric Dumazet <eric.dumazet@...il.com>
To: Phil Sutter <phil@....cc>
Cc: davem@...emloft.net, netdev@...r.kernel.org,
johann.baudy@...-log.net
Subject: Re: [PATCH] af_packet: account for VLAN when checking packet size
Le lundi 11 octobre 2010 à 15:25 +0200, Phil Sutter a écrit :
> Signed-off-by: Phil Sutter <phil@....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;
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists