skb_gso_transport_seglen() adds the SCTP common header for an SCTP GSO packet only in its unencapsulated branch. SCTP over UDP (RFC 6951) sends its GSO packets encapsulated: sctp_v4_xmit() and sctp_v6_xmit() add SKB_GSO_UDP_TUNNEL_CSUM and set skb->encapsulation and the inner transport header at the SCTP header. The encapsulated branch then counts only the outer UDP header, and skb_gso_size_check() adds the length of each frag_list member, which holds the chunks of one segment: every segment is counted 12 bytes short. The MTU checks of ip_forward(), ip6_forward(), ip_finish_output_gso() and ip6_finish_output_gso() then let segments that exceed the MTU by up to 12 bytes leave whole. Add the SCTP header in the encapsulated branch as well. An SCTP association over UDP with a 1500-byte path MTU, forwarded by a router whose egress has a 1496-byte MTU (QEMU, network namespaces): on net the router hands the egress 20 (IPv4) and 28 (IPv6) GSO packets with segments of up to 1500 bytes, in each of 2 runs; with this change none, and it counts the packets it refuses in FragFails and Ip6InTooBigErrors (5 runs, one with KASAN). The missing case was pointed out by the Sashiko review of the inner UDP header fix. Fixes: 600af7fd809a ("sctp: support for sending packet over udp4 sock") Fixes: 259db53ba593 ("sctp: support for sending packet over udp6 sock") Signed-off-by: Julius Bairaktaris --- Changes in v2: - No change; resend, rebased on net. - v1: https://lore.kernel.org/netdev/95ea9cf917be201aae1fd8c59d7a2582a7bbece1.1795884313.git.julius@bairaktaris.de/ v1: new (Sashiko on ipmr v6 3/5). net/core/gso.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/core/gso.c b/net/core/gso.c index eb95c9d2819b1..d62ced6f74f2a 100644 --- a/net/core/gso.c +++ b/net/core/gso.c @@ -158,6 +158,8 @@ static unsigned int skb_gso_transport_seglen(const struct sk_buff *skb) thlen += inner_tcp_hdrlen(skb); else if (shinfo->gso_type & SKB_GSO_UDP_L4) thlen += sizeof(struct udphdr); + else if (unlikely(skb_is_gso_sctp(skb))) + thlen += sizeof(struct sctphdr); } else if (likely(shinfo->gso_type & (SKB_GSO_TCPV4 | SKB_GSO_TCPV6))) { thlen = tcp_hdrlen(skb); } else if (unlikely(skb_is_gso_sctp(skb))) { -- 2.53.0