Netdev List
 help / color / mirror / Atom feed
From: Pravin B Shelar <pshelar@nicira.com>
To: netdev@vger.kernel.org
Cc: edumazet@google.com, jesse@nicira.com,
	Pravin B Shelar <pshelar@nicira.com>
Subject: [PATCH net-next] IP_GRE: Fix IP-Identification.
Date: Thu, 21 Feb 2013 18:18:39 -0800	[thread overview]
Message-ID: <1361499519-1715-1-git-send-email-pshelar@nicira.com> (raw)

Use ip_select_ident_more() to generate and account ids for all
segments that can be used for segments of a gso packet.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
---
 net/ipv4/af_inet.c |    6 ++++--
 net/ipv4/ip_gre.c  |    4 +++-
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
index e225a4e..2992f37 100644
--- a/net/ipv4/af_inet.c
+++ b/net/ipv4/af_inet.c
@@ -1327,8 +1327,10 @@ static struct sk_buff *inet_gso_segment(struct sk_buff *skb,
 			if (skb->next != NULL)
 				iph->frag_off |= htons(IP_MF);
 			offset += (skb->len - skb->mac_len - iph->ihl * 4);
-		} else
-			iph->id = htons(id++);
+		} else  {
+			if (!(iph->frag_off & htons(IP_DF)))
+				iph->id = htons(id++);
+		}
 		iph->tot_len = htons(skb->len - skb->mac_len);
 		iph->check = 0;
 		iph->check = ip_fast_csum(skb_network_header(skb), iph->ihl);
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index 5ef4da7..3c6f2e2 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -970,7 +970,9 @@ static netdev_tx_t ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev
 	iph->daddr		=	fl4.daddr;
 	iph->saddr		=	fl4.saddr;
 	iph->ttl		=	ttl;
-	iph->id			=	0;
+
+	ip_select_ident_more(iph, &rt->dst, NULL,
+			     (skb_shinfo(skb)->gso_segs ?: 1) - 1);
 
 	if (ttl == 0) {
 		if (skb->protocol == htons(ETH_P_IP))
-- 
1.7.1

             reply	other threads:[~2013-02-22  2:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-22  2:18 Pravin B Shelar [this message]
2013-02-22  2:35 ` [PATCH net-next] IP_GRE: Fix IP-Identification Eric Dumazet
2013-02-22  3:42   ` Pravin Shelar
2013-02-22  6:06     ` Eric Dumazet
2013-02-22  7:17       ` pravin

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=1361499519-1715-1-git-send-email-pshelar@nicira.com \
    --to=pshelar@nicira.com \
    --cc=edumazet@google.com \
    --cc=jesse@nicira.com \
    --cc=netdev@vger.kernel.org \
    /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