Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3568924pxb; Mon, 9 Nov 2020 15:00:11 -0800 (PST) X-Google-Smtp-Source: ABdhPJx3ZRR6Zk46mENQ+BklauM8FfciRK5XyxBiwfFWXYjkVjbi9dq10/NNSBIM63hAh71NWDv5 X-Received: by 2002:a05:6402:6d6:: with SMTP id n22mr18304434edy.82.1604962811573; Mon, 09 Nov 2020 15:00:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604962811; cv=none; d=google.com; s=arc-20160816; b=uv8Ze4anBD/J3A7rBo/4LCff9Mk5s4SdNz3ylObihLhz6L8LW2SIdDpVicEAFlKrjh 7nkigRPKV4StY2OLx7lSZPt77jSARkeEmHn2Ig2Z4htGbYDfELG3wcgHakQoFL7ainXj NngBGnHf7ZkoFQPLeqLeZsLeN9yADsQFCAYBIM388VDScTvg8HwSJBdyCRR1DyU/7Xdo nrOA9uMeeULRqogxBnvvwK5ASYyeB/x+cdjREHa+YUCqkV157hKwUhkYMbKP744QeQ4X Xvhy7RnX8Xg00UiKsLdCMdvLqLzPVv1kEdgVssf0nEiAV1+fmYTBBNaA1S3P/4d4Tj93 0XRA== 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 :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=bkibsQkKxIvcEYXQB4e7WTJbj/t9wFKOI6foDOr6/u0=; b=Qc7FVjh1EL6c+Ljozp9MttB0B/Qd/k3KqMt2Hi7FnrPQ84Lt1SDGgyBSIkP3T07qzR 639P5YabRg4YRpFQDQ7AG35LAv1Vtsi5k5/hA+AGiEprOmJ1/rW2hVcZDfeBRvU/OlpU IQsN0KRFfTYVr5c28Mj/QEI8FiBgPmI93Pxf0+CIEXcBdReXkZW9X1efixY77OeU8KAM J6dfsZMxctXQUMQHtV1SkdyLRnMAF/4ZWHH87VrQVI+I1kn7cuOSJelx3u/gnXBtnwwI rB9+WzyHRBnRUxFQhlE2XKTJeX3QsBHOxHvzd3b4Nxqe1/tbviVhLx84kJHtew5fWG+9 0Xaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=EnBmwVUs; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o3si7653946ejn.637.2020.11.09.14.59.48; Mon, 09 Nov 2020 15:00:11 -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=@kernel.org header.s=default header.b=EnBmwVUs; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731177AbgKIW5p (ORCPT + 99 others); Mon, 9 Nov 2020 17:57:45 -0500 Received: from mail.kernel.org ([198.145.29.99]:35076 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730603AbgKIW5n (ORCPT ); Mon, 9 Nov 2020 17:57:43 -0500 Received: from kicinski-fedora-PC1C0HJN.hsd1.ca.comcast.net (unknown [163.114.132.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B67F7206ED; Mon, 9 Nov 2020 22:57:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604962662; bh=if5exp/aKQYCKy51vkQ7RSAFwt504BihFR3Zu9DiVfk=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=EnBmwVUsqJajO3ihH0iy/5Wy7Qw73W5v0Nch8dwmpNYCXxJVDd/p5ZWuoE5W+j81G ZNauvjWjg3xdggsvRaQIM2VMNkUQt4XofSyjD5Kq0HlJ1v9vEGJ4c5wV8aN+2lkp+s kbDYB0lBu6/bFFXD6UbXZ+7XF8533E3AEhXKjbj4= Date: Mon, 9 Nov 2020 14:57:40 -0800 From: Jakub Kicinski To: Marcelo Ricardo Leitner Cc: Petr Malat , linux-sctp@vger.kernel.org, Vlad Yasevich , Neil Horman , "David S. Miller" , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] sctp: Fix sending when PMTU is less than SCTP_DEFAULT_MINSEGMENT Message-ID: <20201109145740.5c63773e@kicinski-fedora-PC1C0HJN.hsd1.ca.comcast.net> In-Reply-To: <20201106102106.GB3556@localhost.localdomain> References: <20201105103946.18771-1-oss@malat.biz> <20201106084634.GA3556@localhost.localdomain> <20201106094824.GA7570@bordel.klfree.net> <20201106102106.GB3556@localhost.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 6 Nov 2020 07:21:06 -0300 Marcelo Ricardo Leitner wrote: > On Fri, Nov 06, 2020 at 10:48:24AM +0100, Petr Malat wrote: > > On Fri, Nov 06, 2020 at 05:46:34AM -0300, Marcelo Ricardo Leitner wrote: > > > On Thu, Nov 05, 2020 at 11:39:47AM +0100, Petr Malat wrote: > > > > 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. > > > > > > This should be being handled at sctp_packet_will_fit(): > > > > sctp_packet_will_fit() does something a little bit different, it > > allows fragmentation, if the packet must be longer than the pathmtu > > set in SCTP structures, which is never less than 512 (see > > sctp_dst_mtu()) even when the actual mtu is less than 512. > > > > One can test it by setting mtu of an interface to e.g. 300, > > and sending a longer packet (e.g. 400B): > > > psize = packet->size; > > > if (packet->transport->asoc) > > > pmtu = packet->transport->asoc->pathmtu; > > > else > > > pmtu = packet->transport->pathmtu; > > here the returned pmtu will be 512 > > Thing is, your patch is using the same vars to check for it: > + pmtu = tp->asoc ? tp->asoc->pathmtu : tp->pathmtu; > > > > > > > > > /* Decide if we need to fragment or resubmit later. */ > > > if (psize + chunk_len > pmtu) { > > This branch will not be taken as the packet length is less then 512 > > Right, ok. While then your patch will catch it because pmtu will be > SCTP_DEFAULT_MINSEGMENT, as it is checking with '<='. > > > > > > } > > > > > And the whole function will return SCTP_XMIT_OK without setting > > ipfragok. > > > > I think the idea of never going bellow 512 in sctp_dst_mtu() is to > > reduce overhead of SCTP headers, which is fine, but when we do that, > > we must be sure to allow the IP fragmentation, which is currently > > missing. > > Hmm. ip frag is probably just worse than higher header/payload > overhead. > > > > > The other option would be to keep track of the real MTU in pathmtu > > and perform max(512, pathmtu) in sctp_packet_will_fit() function. > > I need to check where this 512 came from. I don't recall it from top > of my head and it's from before git history. Maybe we should just drop > this limit, if it's artificial. IPV4_MIN_MTU is 68. > > > > > Not sure when exactly this got broken, but using MTU less than 512 > > used to work in 4.9. > > Uhh, that's a bit old already. If you could narrow it down, that would > be nice. I'm dropping this from patchwork, if you conclude that the patch is good as is please repost, thanks!