netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net 3/3] ipv4: Fix ip-header identification for gso packets.
@ 2013-03-25  3:36 Pravin B Shelar
  2013-03-26 17:34 ` Pravin Shelar
  0 siblings, 1 reply; 3+ messages in thread
From: Pravin B Shelar @ 2013-03-25  3:36 UTC (permalink / raw)
  To: davem, netdev; +Cc: amwang, Pravin B Shelar

ip-header id needs to be incremented even if IP_DF flag is set.
This behaviour was changed in commit 490ab08127cebc25e3a26
(IP_GRE: Fix IP-Identification).

Following patch fixes it so that identification is always
incremented.

Reported-by: Cong Wang <amwang@redhat.com>
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
---
 include/net/ipip.h |   16 ++++++----------
 net/ipv4/af_inet.c |    3 +--
 2 files changed, 7 insertions(+), 12 deletions(-)

diff --git a/include/net/ipip.h b/include/net/ipip.h
index 0c046e3..483b91a 100644
--- a/include/net/ipip.h
+++ b/include/net/ipip.h
@@ -74,15 +74,11 @@ static inline void tunnel_ip_select_ident(struct sk_buff *skb,
 {
 	struct iphdr *iph = ip_hdr(skb);
 
-	if (iph->frag_off & htons(IP_DF))
-		iph->id	= 0;
-	else {
-		/* Use inner packet iph-id if possible. */
-		if (skb->protocol == htons(ETH_P_IP) && old_iph->id)
-			iph->id	= old_iph->id;
-		else
-			__ip_select_ident(iph, dst,
-					  (skb_shinfo(skb)->gso_segs ?: 1) - 1);
-	}
+	/* Use inner packet iph-id if possible. */
+	if (skb->protocol == htons(ETH_P_IP) && old_iph->id)
+		iph->id	= old_iph->id;
+	else
+		__ip_select_ident(iph, dst,
+				  (skb_shinfo(skb)->gso_segs ?: 1) - 1);
 }
 #endif
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
index 9e5882c..70b2d4c 100644
--- a/net/ipv4/af_inet.c
+++ b/net/ipv4/af_inet.c
@@ -1334,8 +1334,7 @@ static struct sk_buff *inet_gso_segment(struct sk_buff *skb,
 				iph->frag_off |= htons(IP_MF);
 			offset += (skb->len - skb->mac_len - iph->ihl * 4);
 		} else  {
-			if (!(iph->frag_off & htons(IP_DF)))
-				iph->id = htons(id++);
+			iph->id = htons(id++);
 		}
 		iph->tot_len = htons(skb->len - skb->mac_len);
 		iph->check = 0;
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net 3/3] ipv4: Fix ip-header identification for gso packets.
  2013-03-25  3:36 [PATCH net 3/3] ipv4: Fix ip-header identification for gso packets Pravin B Shelar
@ 2013-03-26 17:34 ` Pravin Shelar
  2013-03-26 17:50   ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Pravin Shelar @ 2013-03-26 17:34 UTC (permalink / raw)
  To: davem, netdev; +Cc: amwang

This issue is present in net-tree. Can you apply this patch net-tree?

Thanks.

On Sun, Mar 24, 2013 at 8:36 PM, Pravin B Shelar <pshelar@nicira.com> wrote:
> ip-header id needs to be incremented even if IP_DF flag is set.
> This behaviour was changed in commit 490ab08127cebc25e3a26
> (IP_GRE: Fix IP-Identification).
>
> Following patch fixes it so that identification is always
> incremented.
>
> Reported-by: Cong Wang <amwang@redhat.com>
> Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
> ---
>  include/net/ipip.h |   16 ++++++----------
>  net/ipv4/af_inet.c |    3 +--
>  2 files changed, 7 insertions(+), 12 deletions(-)
>
> diff --git a/include/net/ipip.h b/include/net/ipip.h
> index 0c046e3..483b91a 100644
> --- a/include/net/ipip.h
> +++ b/include/net/ipip.h
> @@ -74,15 +74,11 @@ static inline void tunnel_ip_select_ident(struct sk_buff *skb,
>  {
>         struct iphdr *iph = ip_hdr(skb);
>
> -       if (iph->frag_off & htons(IP_DF))
> -               iph->id = 0;
> -       else {
> -               /* Use inner packet iph-id if possible. */
> -               if (skb->protocol == htons(ETH_P_IP) && old_iph->id)
> -                       iph->id = old_iph->id;
> -               else
> -                       __ip_select_ident(iph, dst,
> -                                         (skb_shinfo(skb)->gso_segs ?: 1) - 1);
> -       }
> +       /* Use inner packet iph-id if possible. */
> +       if (skb->protocol == htons(ETH_P_IP) && old_iph->id)
> +               iph->id = old_iph->id;
> +       else
> +               __ip_select_ident(iph, dst,
> +                                 (skb_shinfo(skb)->gso_segs ?: 1) - 1);
>  }
>  #endif
> diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
> index 9e5882c..70b2d4c 100644
> --- a/net/ipv4/af_inet.c
> +++ b/net/ipv4/af_inet.c
> @@ -1334,8 +1334,7 @@ static struct sk_buff *inet_gso_segment(struct sk_buff *skb,
>                                 iph->frag_off |= htons(IP_MF);
>                         offset += (skb->len - skb->mac_len - iph->ihl * 4);
>                 } else  {
> -                       if (!(iph->frag_off & htons(IP_DF)))
> -                               iph->id = htons(id++);
> +                       iph->id = htons(id++);
>                 }
>                 iph->tot_len = htons(skb->len - skb->mac_len);
>                 iph->check = 0;
> --
> 1.7.1
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net 3/3] ipv4: Fix ip-header identification for gso packets.
  2013-03-26 17:34 ` Pravin Shelar
@ 2013-03-26 17:50   ` David Miller
  0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2013-03-26 17:50 UTC (permalink / raw)
  To: pshelar; +Cc: netdev, amwang

From: Pravin Shelar <pshelar@nicira.com>
Date: Tue, 26 Mar 2013 10:34:17 -0700

> This issue is present in net-tree. Can you apply this patch net-tree?

Good point, applied to 'net', thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-03-26 17:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-25  3:36 [PATCH net 3/3] ipv4: Fix ip-header identification for gso packets Pravin B Shelar
2013-03-26 17:34 ` Pravin Shelar
2013-03-26 17:50   ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).