Skip to content

Commit d6a8c36

Browse files
Cong Wangdavem330
authored andcommitted
udp: increase inner ip header ID during segmentation
Similar to GRE tunnel, UDP tunnel should take care of IP header ID too. Cc: Pravin B Shelar <[email protected]> Cc: Eric Dumazet <[email protected]> Cc: "David S. Miller" <[email protected]> Signed-off-by: Cong Wang <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 10c0d7e commit d6a8c36

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

net/ipv4/udp.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2304,7 +2304,8 @@ static struct sk_buff *skb_udp_tunnel_segment(struct sk_buff *skb,
23042304
struct sk_buff *segs = ERR_PTR(-EINVAL);
23052305
int mac_len = skb->mac_len;
23062306
int tnl_hlen = skb_inner_mac_header(skb) - skb_transport_header(skb);
2307-
int outer_hlen;
2307+
int outer_hlen, id;
2308+
struct iphdr *iph;
23082309
netdev_features_t enc_features;
23092310

23102311
if (unlikely(!pskb_may_pull(skb, tnl_hlen)))
@@ -2315,6 +2316,8 @@ static struct sk_buff *skb_udp_tunnel_segment(struct sk_buff *skb,
23152316
skb_reset_mac_header(skb);
23162317
skb_set_network_header(skb, skb_inner_network_offset(skb));
23172318
skb->mac_len = skb_inner_network_offset(skb);
2319+
iph = ip_hdr(skb);
2320+
id = ntohs(iph->id);
23182321

23192322
/* segment inner packet. */
23202323
enc_features = skb->dev->hw_enc_features & netif_skb_features(skb);
@@ -2329,6 +2332,8 @@ static struct sk_buff *skb_udp_tunnel_segment(struct sk_buff *skb,
23292332
int udp_offset = outer_hlen - tnl_hlen;
23302333

23312334
skb->mac_len = mac_len;
2335+
iph = (struct iphdr *)skb_inner_network_header(skb);
2336+
iph->id = htons(id++);
23322337

23332338
skb_push(skb, outer_hlen);
23342339
skb_reset_mac_header(skb);

0 commit comments

Comments
 (0)