Skip to content

Commit

Permalink
ipv4: Fix ip-header identification for gso packets.
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
Pravin B Shelar authored and davem330 committed Mar 25, 2013
1 parent 5594c32 commit 25c7704
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
16 changes: 6 additions & 10 deletions include/net/ipip.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 1 addition & 2 deletions net/ipv4/af_inet.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 25c7704

Please sign in to comment.