Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp386216pxb; Thu, 5 Nov 2020 02:45:45 -0800 (PST) X-Google-Smtp-Source: ABdhPJyA1EqbxUu2W4+gcoJ0DON3QV9HPckqsTaWgiNyruIfOmC66gid3kXE3SB1VqCUhC2agN70 X-Received: by 2002:a17:906:3a97:: with SMTP id y23mr1606050ejd.250.1604573144969; Thu, 05 Nov 2020 02:45:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604573144; cv=none; d=google.com; s=arc-20160816; b=KG3ZTxrBe2aA6BFOIrgchouhTXPeqizI5gx9kOhkum9EjletzGqLqgrAbmGcHMdgw+ zjBcrgZwlphuMeAoGum/p47kst8TwQrGMuskfbVOpn+8IHfmQIcPQZ8pebar3bX2gxJk DtJaNl+cQB0yUVlg9EF42j6eQJg2yMIfFbgVVM6E8fPYg9ffiQg4NsAc/RpSEpOCy+W+ 6cnJeDQj5MFW2EOAIR/akcTKdcQZDkKjf77iwjVbYB1xpPqwtMuYLXQxH7xgNnD7m01H 4J99YFFi4udTbNjWWc6jUJSY188uwaxgo2WBzyKfudo6GGsga+1P07Y2Ryd6lrE98h3B /mJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=2LczsVk+9KnBIoU2kGVEtIN/d3ykScNgtF9myRWt2BE=; b=V58xLOSbuLZvSXRoA2bAq+yydu0BvrIaMuUa3aCr9B8SrwNQKYukTxYZrcJc/CSzyn I6WQ3fA4+3NuZLWL/2/chR1JnwW05jXz+QLbRg27SxnAd+/qYb0yyTrObh6QB5jQYVtV khPvBZvLuNHAPg/iYlnbiXSsZcR5uxDuZ/8cy0cJYSKI72xdM224AmMuNyLAdLcM8MRP VI6CGV+chGyemjjieIBKBtpVetChJ7QiBrHP68sSn1R4vDaqxalG2QgXtVTkd09VeA1u 4kiHNP0Slr09MIm8fLU5vBBfdDqMfHJGdrIAIkIMYZJ9Xz1bYW5stzfBoArYej5WyfIN 1VDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@malat-biz.20150623.gappssmtp.com header.s=20150623 header.b=sxH0VQ9L; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k9si855370edv.487.2020.11.05.02.45.22; Thu, 05 Nov 2020 02:45:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@malat-biz.20150623.gappssmtp.com header.s=20150623 header.b=sxH0VQ9L; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729908AbgKEKmb (ORCPT + 99 others); Thu, 5 Nov 2020 05:42:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37242 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728999AbgKEKma (ORCPT ); Thu, 5 Nov 2020 05:42:30 -0500 Received: from mail-ej1-x643.google.com (mail-ej1-x643.google.com [IPv6:2a00:1450:4864:20::643]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6B29FC0613D2 for ; Thu, 5 Nov 2020 02:42:30 -0800 (PST) Received: by mail-ej1-x643.google.com with SMTP id p5so1931779ejj.2 for ; Thu, 05 Nov 2020 02:42:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=malat-biz.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=2LczsVk+9KnBIoU2kGVEtIN/d3ykScNgtF9myRWt2BE=; b=sxH0VQ9LsmCqBEh36Md+jDI84/cUS6/ExbEeJpMqt25TRt3OdtRoIsEAVH/mMYRCuR MDB4MnE5xF5eYdTPzubvU2GJ3XaLgYeaIbA6o+Vg/+hM3sXcnvxqnvLWUTNVaOzcqW4l fO0oojmYdSEg0Xteeqh0Px1WgafShCjHI5Ks09lWp4FwzVE0RSrCuSvkN33kSk3HMr4R 2kbQjefLhUrC9ZC9xy/pnphk63ciIZL48lZcsQBCubUoQ5ZEvw1awHUY5b9xdsGvEpcb OPSlKawicSLvejkOn66/dp+eqyk7FMTGd4Na5IcMFcaq2ZXPkaou2nxO/a/1jlNTuvsI GNIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=2LczsVk+9KnBIoU2kGVEtIN/d3ykScNgtF9myRWt2BE=; b=QhBBSSZQZWUy5jj+3xD/l4BNxDEBtvu4yTQjsGgke5qmGdrjAOAQ5BUN044lnHM4SE w17d1JnTqVQZPBM9/MIUQOV+5IRAGG6YpEJsRkDhYeMdYcTPplLe/UH23sQLvA5Y4Hjj xvosGap9M/lr9Dycu8+ZNr932C7M+dFKCHX06eRJWp01gEkctewdjLnqGKmPGr6TApBx YVC6Uv0FPlJZutWXpUZQeB1Rysf0Iywt9voMdmzyzujzcmElU7JerKn6k7D4vTc5ZcYQ cnf4F23b3ycm5vDjzN0Leb/VgJyKXhMmeZsmyAuvI4SI+1DldyfK5qo2Qv3PVeeJo1Sn wxfA== X-Gm-Message-State: AOAM533cWD+F/jkZDveC/WCqyPaoTnfWTror0K3j3xb7rteEwc7LHTTA Et2jTM5Vx3lS2lq3LMuiTHE3sA== X-Received: by 2002:a17:906:5247:: with SMTP id y7mr1552389ejm.503.1604572949188; Thu, 05 Nov 2020 02:42:29 -0800 (PST) Received: from ntb.petris.klfree.cz (snat2.klfree.cz. [81.201.48.25]) by smtp.googlemail.com with ESMTPSA id by8sm648864edb.49.2020.11.05.02.42.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Nov 2020 02:42:28 -0800 (PST) From: Petr Malat To: linux-sctp@vger.kernel.org Cc: Petr Malat , Vlad Yasevich , Neil Horman , Marcelo Ricardo Leitner , "David S. Miller" , Jakub Kicinski , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] sctp: Fix sending when PMTU is less than SCTP_DEFAULT_MINSEGMENT Date: Thu, 5 Nov 2020 11:39:47 +0100 Message-Id: <20201105103946.18771-1-oss@malat.biz> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Function sctp_dst_mtu() never returns lower MTU than SCTP_TRUNC4(SCTP_DEFAULT_MINSEGMENT) even when the actual MTU is less, in which case we rely on the IP fragmentation and must enable it. Signed-off-by: Petr Malat --- net/sctp/output.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/net/sctp/output.c b/net/sctp/output.c index 1441eaf460bb..87a96cf6bfa4 100644 --- a/net/sctp/output.c +++ b/net/sctp/output.c @@ -552,6 +552,7 @@ int sctp_packet_transmit(struct sctp_packet *packet, gfp_t gfp) struct sk_buff *head; struct sctphdr *sh; struct sock *sk; + u32 pmtu; pr_debug("%s: packet:%p\n", __func__, packet); if (list_empty(&packet->chunk_list)) @@ -559,6 +560,13 @@ int sctp_packet_transmit(struct sctp_packet *packet, gfp_t gfp) chunk = list_entry(packet->chunk_list.next, struct sctp_chunk, list); sk = chunk->skb->sk; + /* Fragmentation on the IP level if the actual PMTU could be less + * than SCTP_DEFAULT_MINSEGMENT. See sctp_dst_mtu(). + */ + pmtu = tp->asoc ? tp->asoc->pathmtu : tp->pathmtu; + if (pmtu <= SCTP_DEFAULT_MINSEGMENT) + packet->ipfragok = 1; + /* check gso */ if (packet->size > tp->pathmtu && !packet->ipfragok) { if (!sk_can_gso(sk)) { -- 2.20.1