From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.4 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8032FC4363D for ; Wed, 23 Sep 2020 04:46:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1F4212068D for ; Wed, 23 Sep 2020 04:46:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="JEoBZ8FY" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726891AbgIWEqf (ORCPT ); Wed, 23 Sep 2020 00:46:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56744 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726198AbgIWEqe (ORCPT ); Wed, 23 Sep 2020 00:46:34 -0400 Received: from mail-il1-x142.google.com (mail-il1-x142.google.com [IPv6:2607:f8b0:4864:20::142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C54D2C061755 for ; Tue, 22 Sep 2020 21:46:34 -0700 (PDT) Received: by mail-il1-x142.google.com with SMTP id t12so19553883ilh.3 for ; Tue, 22 Sep 2020 21:46:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=ulI5qxFqTka4MOw4nshJNvRiW8jBuPa+dt9ToQRATHU=; b=JEoBZ8FY8dqPXybezw+QpM1tagoB04gcNP4rZiD3Tdna8B9/IsEfhpGy00NiL2/BYo 6H1ZM8OC+Mslh+P0NNU7+PzWrYQJe63ZEjYLgULtW6RCKoXVYDWavDLcQ4txFyMbyRbK Pf5Wo+CsgmcE8l5gy1dM1q+CmYGzED/wxYINfpH3YOOWW24jaOfFXT8Zkx28aNXxaINJ /1sVlyR8xGYXWA7z/z9jRFWp9U5AJtABf7qEjr2mDYeolfFa1ZaN6GK5RT+2WdZ/rhbL Wn6DfIpqX3wGS+Q/jlY3st6M4S4yutPqTvpe49HxmXo1ZPozXC6XjGDTDaYStVgSo5mh vpHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=ulI5qxFqTka4MOw4nshJNvRiW8jBuPa+dt9ToQRATHU=; b=RYFJzFaNxlqJarG1xLr4hmUJa/joawH4WoiJnX2LgKV4zz+ko+XQSVlz1EAfPmVnVI mA7b1Zz8eVXIuFLJuYgLKGGstomLwBnZVG5Or6ImwMbwASBT5ID4/5xrTfNO8N4do9Iu 6suMAhU649qfLYg1w22vdRyTFh3XS8VfXFVYDqHWACKbcBvqnzZGiC0UCw7NwMsNuLEw Vcggv5eDM5wye528X2HV4qwYfQMz+fo7xG/IcxmZBWUWANDjvXo4RodHr4DpgjrdE037 faKmdFLhUX4Er4fhR6roWJsc7w0N12ioZh9+UmRkHvJHXfHVpBC3MwDeGwyRQ49PmH0s U9cQ== X-Gm-Message-State: AOAM530DwULTRwGI3qZMNNNcZyAzvbH7OwTKe/T57RdW5435zWXfrsKQ LIiBXUO18qwz/fkJM7VqF18A4607Szaf5LmwDFQLX74R82U= X-Google-Smtp-Source: ABdhPJyc5oqk2HU723FKsR9gAtXF+5pVRSm5TBXQHWJfvu4wbZ9S15SO1DJfv2mudJ/1vRxSBUg0EaEmy6P4dvNJuZo= X-Received: by 2002:a92:8b0e:: with SMTP id i14mr7264181ild.28.1600836393790; Tue, 22 Sep 2020 21:46:33 -0700 (PDT) MIME-Version: 1.0 References: <20200923044059.3442423-1-zenczykowski@gmail.com> In-Reply-To: <20200923044059.3442423-1-zenczykowski@gmail.com> From: =?UTF-8?Q?Maciej_=C5=BBenczykowski?= Date: Tue, 22 Sep 2020 21:46:22 -0700 Message-ID: Subject: Re: [PATCH] net/ipv4: always honour route mtu during forwarding To: =?UTF-8?Q?Maciej_=C5=BBenczykowski?= , "David S . Miller" Cc: Linux Network Development Mailing List , Willem de Bruijn , Lorenzo Colitti , Sunmeet Gill , Vinay Paradkar , Tyler Wear , David Ahern Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Tue, Sep 22, 2020 at 9:41 PM Maciej =C5=BBenczykowski wrote: > > From: Maciej =C5=BBenczykowski > > Documentation/networking/ip-sysctl.txt:46 says: > ip_forward_use_pmtu - BOOLEAN > By default we don't trust protocol path MTUs while forwarding > because they could be easily forged and can lead to unwanted > fragmentation by the router. > You only need to enable this if you have user-space software > which tries to discover path mtus by itself and depends on the > kernel honoring this information. This is normally not the case. > Default: 0 (disabled) > Possible values: > 0 - disabled > 1 - enabled > > Which makes it pretty clear that setting it to 1 is a potential > security/safety/DoS issue, and yet it is entirely reasonable to want > forwarded traffic to honour explicitly administrator configured > route mtus (instead of defaulting to device mtu). > > Indeed, I can't think of a single reason why you wouldn't want to. > Since you configured a route mtu you probably know better... > > It is pretty common to have a higher device mtu to allow receiving > large (jumbo) frames, while having some routes via that interface > (potentially including the default route to the internet) specify > a lower mtu. > > Note that ipv6 forwarding uses device mtu unless the route is locked > (in which case it will use the route mtu). > > This approach is not usable for IPv4 where an 'mtu lock' on a route > also has the side effect of disabling TCP path mtu discovery via > disabling the IPv4 DF (don't frag) bit on all outgoing frames. > > I'm not aware of a way to lock a route from an IPv6 RA, so that also > potentially seems wrong. > > Signed-off-by: Maciej =C5=BBenczykowski > Cc: Eric Dumazet > Cc: Willem de Bruijn > Cc: Lorenzo Colitti > Cc: Sunmeet Gill (Sunny) > Cc: Vinay Paradkar > Cc: Tyler Wear > Cc: David Ahern > --- > include/net/ip.h | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/include/net/ip.h b/include/net/ip.h > index b09c48d862cc..1262011d00b8 100644 > --- a/include/net/ip.h > +++ b/include/net/ip.h > @@ -442,6 +442,10 @@ static inline unsigned int ip_dst_mtu_maybe_forward(= const struct dst_entry *dst, > !forwarding) > return dst_mtu(dst); > > + /* 'forwarding =3D true' case should always honour route mtu */ > + unsigned int mtu =3D dst_metric_raw(dst, RTAX_MTU); > + if (mtu) return mtu; > + > return min(READ_ONCE(dst->dev->mtu), IP_MAX_MTU); > } > > -- > 2.28.0.681.g6f77f65b4e-goog Eh, what I get for last minute removal of 'if (forwarding) {}' wrapper.