Skip to content

Commit 44b321e

Browse files
joshhunt-akamaidavem330
authored andcommitted
udp: fix gso_segs calculations
Commit dfec0ee ("udp: Record gso_segs when supporting UDP segmentation offload") added gso_segs calculation, but incorrectly got sizeof() the pointer and not the underlying data type. In addition let's fix the v6 case. Fixes: bec1f6f ("udp: generate gso with UDP_SEGMENT") Fixes: dfec0ee ("udp: Record gso_segs when supporting UDP segmentation offload") Signed-off-by: Josh Hunt <johunt@akamai.com> Reviewed-by: Alexander Duyck <alexander.h.duyck@linux.intel.com> Acked-by: Willem de Bruijn <willemb@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 6af1799 commit 44b321e

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

net/ipv4/udp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -856,7 +856,7 @@ static int udp_send_skb(struct sk_buff *skb, struct flowi4 *fl4,
856856

857857
skb_shinfo(skb)->gso_size = cork->gso_size;
858858
skb_shinfo(skb)->gso_type = SKB_GSO_UDP_L4;
859-
skb_shinfo(skb)->gso_segs = DIV_ROUND_UP(len - sizeof(uh),
859+
skb_shinfo(skb)->gso_segs = DIV_ROUND_UP(len - sizeof(*uh),
860860
cork->gso_size);
861861
goto csum_partial;
862862
}

net/ipv6/udp.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1143,6 +1143,8 @@ static int udp_v6_send_skb(struct sk_buff *skb, struct flowi6 *fl6,
11431143

11441144
skb_shinfo(skb)->gso_size = cork->gso_size;
11451145
skb_shinfo(skb)->gso_type = SKB_GSO_UDP_L4;
1146+
skb_shinfo(skb)->gso_segs = DIV_ROUND_UP(len - sizeof(*uh),
1147+
cork->gso_size);
11461148
goto csum_partial;
11471149
}
11481150

0 commit comments

Comments
 (0)