Skip to content

Commit 330305c

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]> Signed-off-by: Pravin B Shelar <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 9fe16b7 commit 330305c

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
@@ -77,15 +77,11 @@ static inline void tunnel_ip_select_ident(struct sk_buff *skb,
7777
{
7878
struct iphdr *iph = ip_hdr(skb);
7979

80-
if (iph->frag_off & htons(IP_DF))
81-
iph->id = 0;
82-
else {
83-
/* Use inner packet iph-id if possible. */
84-
if (skb->protocol == htons(ETH_P_IP) && old_iph->id)
85-
iph->id = old_iph->id;
86-
else
87-
__ip_select_ident(iph, dst,
88-
(skb_shinfo(skb)->gso_segs ?: 1) - 1);
89-
}
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);
9086
}
9187
#endif

net/ipv4/af_inet.c

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

0 commit comments

Comments
 (0)