All of lore.kernel.org
 help / color / mirror / Atom feed
From: Toshiaki Makita <toshiaki.makita1@gmail.com>
To: Ivan Vecera <ivecera@redhat.com>, netdev@vger.kernel.org
Cc: vyasevich@gmail.com
Subject: Re: [PATCH net v2] macvtap: fix network header pointer for VLAN tagged pkts
Date: Tue, 21 Jul 2015 23:44:58 +0900	[thread overview]
Message-ID: <55AE5AEA.5010802@gmail.com> (raw)
In-Reply-To: <1437463115-2881-1-git-send-email-ivecera@redhat.com>

On 15/07/21 (火) 16:18, Ivan Vecera wrote:
> Network header is set with offset ETH_HLEN but it is not true for VLAN
> (multiple-)tagged and results in checksum issues in lower devices.
> 
> v2: leave skb->protocol untouched (thx Vlad), comment added
> 
> Signed-off-by: Ivan Vecera <ivecera@redhat.com>
> ---
>   drivers/net/macvtap.c | 7 +++++++
>   1 file changed, 7 insertions(+)
> 
> diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c
> index 3b933bb..b75776b 100644
> --- a/drivers/net/macvtap.c
> +++ b/drivers/net/macvtap.c
> @@ -796,6 +796,13 @@ static ssize_t macvtap_get_user(struct macvtap_queue *q, struct msghdr *m,
>   	skb_reset_mac_header(skb);
>   	skb->protocol = eth_hdr(skb)->h_proto;
>   
> +	/* Move network header to the right position for VLAN tagged packets */
> +	if (skb_vlan_tagged(skb)) {

I guess you don't need the condition skb_vlan_tag_present(skb), i.e.,

if (skb->protocol == htons(ETH_P_8021Q) ||
    skb->protocol == htons(ETH_P_8021AD))

> +		int depth;
> +		__vlan_get_protocol(skb, skb->protocol, &depth);

__vlan_get_protocol() can fail, and then, depth will not be initialized.

> +		skb_set_network_header(skb, depth);

I think you should set network_header after
skb_probe_transport_header(). It calls skb_flow_dissect_flow_keys(),
which seems to expect network_header to be ETH_HLEN.

Toshiaki Makita

      reply	other threads:[~2015-07-21 14:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-21  7:18 [PATCH net v2] macvtap: fix network header pointer for VLAN tagged pkts Ivan Vecera
2015-07-21 14:44 ` Toshiaki Makita [this message]

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=55AE5AEA.5010802@gmail.com \
    --to=toshiaki.makita1@gmail.com \
    --cc=ivecera@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=vyasevich@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.