Subject: Re: [PATCH net-next] ip_gre: increase inner ip header ID only for IPv4

From: Sergei Shtylyov <[email-masked]>
Date: Sat, 23 Mar 2013 19:10:46 +0400

Hello.

On 23-03-2013 9:29, Cong Wang wrote:

> From: Cong Wang <[email-masked]>

> Pravin pointed out the inner network header of a GRE tunnel packet
> could be IPv6, where there is no ID. So we should check the version.

> Cc: Pravin B Shelar <[email-masked]>
> Cc: Eric Dumazet <[email-masked]>
> Cc: "David S. Miller" <[email-masked]>
> Signed-off-by: Cong Wang <[email-masked]>

> ---
> diff --git a/net/ipv4/gre.c b/net/ipv4/gre.c
> index e20631c..a2516f5 100644
> --- a/net/ipv4/gre.c
> +++ b/net/ipv4/gre.c
[...]
> @@ -172,7 +172,12 @@ static struct sk_buff *gre_gso_segment(struct sk_buff *skb,
>   	skb->mac_len = skb_inner_network_offset(skb);
>
>   	iph = ip_hdr(skb);
> -	id = ntohs(iph->id);
> +	if (iph->version == 4) {
> +		ipv4 = true;
> +		id = ntohs(iph->id);
> +	} else
> +		ipv4 = false;

    Both arms of *if* statement should have {}, according to 
Documentation/CodingStyle chapter 3.

WBR, Sergei