All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Maciej Żenczykowski" <maze@google.com>
To: "Maciej Żenczykowski" <maze@google.com>,
	"David S . Miller" <davem@davemloft.net>
Cc: Linux Network Development Mailing List <netdev@vger.kernel.org>,
	Willem de Bruijn <willemb@google.com>,
	Lorenzo Colitti <lorenzo@google.com>,
	Sunmeet Gill <sgill@quicinc.com>,
	Vinay Paradkar <vparadka@qti.qualcomm.com>,
	Tyler Wear <twear@quicinc.com>, David Ahern <dsahern@kernel.org>
Subject: Re: [PATCH] net/ipv4: always honour route mtu during forwarding
Date: Tue, 22 Sep 2020 21:46:22 -0700	[thread overview]
Message-ID: <CANP3RGcTy5MyAyChUh7pTma60aLcBmOV4kKjh_OnGtBZag-gbg@mail.gmail.com> (raw)
In-Reply-To: <20200923044059.3442423-1-zenczykowski@gmail.com>

On Tue, Sep 22, 2020 at 9:41 PM Maciej Żenczykowski
<zenczykowski@gmail.com> wrote:
>
> From: Maciej Żenczykowski <maze@google.com>
>
> 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 Żenczykowski <maze@google.com>
> Cc: Eric Dumazet <maze@google.com>
> Cc: Willem de Bruijn <willemb@google.com>
> Cc: Lorenzo Colitti <lorenzo@google.com>
> Cc: Sunmeet Gill (Sunny) <sgill@quicinc.com>
> Cc: Vinay Paradkar <vparadka@qti.qualcomm.com>
> Cc: Tyler Wear <twear@quicinc.com>
> Cc: David Ahern <dsahern@kernel.org>
> ---
>  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 = true' case should always honour route mtu */
> +       unsigned int mtu = 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.

  reply	other threads:[~2020-09-23  4:46 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-23  4:40 [PATCH] net/ipv4: always honour route mtu during forwarding Maciej Żenczykowski
2020-09-23  4:46 ` Maciej Żenczykowski [this message]
2020-09-23  4:51   ` [PATCH v2] " Maciej Żenczykowski
2020-09-23  8:46     ` Eric Dumazet
2020-09-23 14:36       ` David Ahern
2020-09-23 19:02         ` David Miller
2020-09-23 20:18       ` [PATCH v3] " Maciej Żenczykowski
2020-09-24  9:14         ` Eric Dumazet
2020-09-25  2:54         ` David Miller
2020-09-23 21:33 ` [PATCH] " kernel test robot
2020-09-24  1:06   ` Maciej Żenczykowski
2020-09-24  1:06     ` Maciej Żenczykowski
2020-09-24  4:21 ` kernel test robot
2020-09-24  4:21   ` kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CANP3RGcTy5MyAyChUh7pTma60aLcBmOV4kKjh_OnGtBZag-gbg@mail.gmail.com \
    --to=maze@google.com \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=lorenzo@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=sgill@quicinc.com \
    --cc=twear@quicinc.com \
    --cc=vparadka@qti.qualcomm.com \
    --cc=willemb@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.