Skip to content

Commit 25c7704

Browse files
Pravin B Shelardavem330
authored andcommitted
ipv4: Fix ip-header identification for gso packets.
ip-header id needs to be incremented even if IP_DF flag is set. This behaviour was changed in commit 490ab08 (IP_GRE: Fix IP-Identification). Following patch fixes it so that identification is always incremented. Reported-by: Cong Wang <[email protected]> Acked-by: Cong Wang <[email protected]> Signed-off-by: Pravin B Shelar <[email protected]>
1 parent 5594c32 commit 25c7704

File tree

2 files changed

+7
-12
lines changed

2 files changed

+7
-12
lines changed

include/net/ipip.h

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -74,15 +74,11 @@ static inline void tunnel_ip_select_ident(struct sk_buff *skb,
7474
{
7575
struct iphdr *iph = ip_hdr(skb);
7676

77-
if (iph->frag_off & htons(IP_DF))
78-
iph->id = 0;
79-
else {
80-
/* Use inner packet iph-id if possible. */
81-
if (skb->protocol == htons(ETH_P_IP) && old_iph->id)
82-
iph->id = old_iph->id;
83-
else
84-
__ip_select_ident(iph, dst,
85-
(skb_shinfo(skb)->gso_segs ?: 1) - 1);
86-
}
77+
/* Use inner packet iph-id if possible. */
78+
if (skb->protocol == htons(ETH_P_IP) && old_iph->id)
79+
iph->id = old_iph->id;
80+
else
81+
__ip_select_ident(iph, dst,
82+
(skb_shinfo(skb)->gso_segs ?: 1) - 1);
8783
}
8884
#endif

net/ipv4/af_inet.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1334,8 +1334,7 @@ static struct sk_buff *inet_gso_segment(struct sk_buff *skb,
13341334
iph->frag_off |= htons(IP_MF);
13351335
offset += (skb->len - skb->mac_len - iph->ihl * 4);
13361336
} else {
1337-
if (!(iph->frag_off & htons(IP_DF)))
1338-
iph->id = htons(id++);
1337+
iph->id = htons(id++);
13391338
}
13401339
iph->tot_len = htons(skb->len - skb->mac_len);
13411340
iph->check = 0;

0 commit comments

Comments
 (0)