ip_gre: increase inner ip header ID during segmentation
authorCong Wang <amwang@redhat.com>
Fri, 22 Mar 2013 00:31:31 +0000 (00:31 +0000)
committerDavid S. Miller <davem@davemloft.net>
Fri, 22 Mar 2013 14:23:34 +0000 (10:23 -0400)
According to the previous discussion [1] on netdev list, DaveM insists
we should increase the IP header ID for each segmented packets.
This patch fixes it.

Cc: Pravin B Shelar <pshelar@nicira.com>
Cc: Eric Dumazet <edumazet@google.com>
Cc: "David S. Miller" <davem@davemloft.net>
Signed-off-by: Cong Wang <amwang@redhat.com>
1. http://marc.info/?t=136384172700001&r=1&w=2
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/gre.c

index 7a4c710c4cddef241766bf5816b20ef768e8a45b..e20631cb418573599e68b3e94a69f76f00e0f73f 100644 (file)
@@ -125,8 +125,9 @@ static struct sk_buff *gre_gso_segment(struct sk_buff *skb,
        netdev_features_t enc_features;
        int ghl = GRE_HEADER_SECTION;
        struct gre_base_hdr *greh;
+       struct iphdr *iph;
        int mac_len = skb->mac_len;
-       int tnl_hlen;
+       int tnl_hlen, id;
        bool csum;
 
        if (unlikely(skb_shinfo(skb)->gso_type &
@@ -170,6 +171,8 @@ static struct sk_buff *gre_gso_segment(struct sk_buff *skb,
        skb_set_network_header(skb, skb_inner_network_offset(skb));
        skb->mac_len = skb_inner_network_offset(skb);
 
+       iph = ip_hdr(skb);
+       id = ntohs(iph->id);
        /* segment inner packet. */
        enc_features = skb->dev->hw_enc_features & netif_skb_features(skb);
        segs = skb_mac_gso_segment(skb, enc_features);
@@ -179,6 +182,8 @@ static struct sk_buff *gre_gso_segment(struct sk_buff *skb,
        skb = segs;
        tnl_hlen = skb_tnl_header_len(skb);
        do {
+               iph = (struct iphdr *)skb->data;
+               iph->id = htons(id++);
                __skb_push(skb, ghl);
                if (csum) {
                        __be32 *pcsum;