Netdev Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] net/ipv4: always honour route mtu during forwarding
@ 2020-09-23 4:40 Maciej Żenczykowski
2020-09-23 4:46 ` Maciej Żenczykowski
` (2 more replies)
0 siblings, 3 replies; 11+ messages in thread
From: Maciej Żenczykowski @ 2020-09-23 4:40 UTC (permalink / raw)
To: Maciej Żenczykowski, David S . Miller
Cc: Linux Network Development Mailing List, Willem de Bruijn,
Lorenzo Colitti, Sunmeet Gill, Vinay Paradkar, Tyler Wear,
David Ahern
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
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH] net/ipv4: always honour route mtu during forwarding
2020-09-23 4:40 [PATCH] net/ipv4: always honour route mtu during forwarding Maciej Żenczykowski
@ 2020-09-23 4:46 ` Maciej Żenczykowski
2020-09-23 4:51 ` [PATCH v2] " Maciej Żenczykowski
[not found] ` <202009240537.PKBbxi6l%lkp@intel.com>
2020-09-24 4:21 ` kernel test robot
2 siblings, 1 reply; 11+ messages in thread
From: Maciej Żenczykowski @ 2020-09-23 4:46 UTC (permalink / raw)
To: Maciej Żenczykowski, David S . Miller
Cc: Linux Network Development Mailing List, Willem de Bruijn,
Lorenzo Colitti, Sunmeet Gill, Vinay Paradkar, Tyler Wear,
David Ahern
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.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v2] net/ipv4: always honour route mtu during forwarding
2020-09-23 4:46 ` Maciej Żenczykowski
@ 2020-09-23 4:51 ` Maciej Żenczykowski
2020-09-23 8:46 ` Eric Dumazet
0 siblings, 1 reply; 11+ messages in thread
From: Maciej Żenczykowski @ 2020-09-23 4:51 UTC (permalink / raw)
To: Maciej Żenczykowski, David S . Miller
Cc: Linux Network Development Mailing List, Willem de Bruijn,
Lorenzo Colitti, Sunmeet Gill, Vinay Paradkar, Tyler Wear,
David Ahern
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 | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/include/net/ip.h b/include/net/ip.h
index b09c48d862cc..c2188bebbc54 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -436,12 +436,17 @@ static inline unsigned int ip_dst_mtu_maybe_forward(const struct dst_entry *dst,
bool forwarding)
{
struct net *net = dev_net(dst->dev);
+ unsigned int mtu;
if (net->ipv4.sysctl_ip_fwd_use_pmtu ||
ip_mtu_locked(dst) ||
!forwarding)
return dst_mtu(dst);
+ /* 'forwarding = true' case should always honour route mtu */
+ 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
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH v2] net/ipv4: always honour route mtu during forwarding
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 20:18 ` [PATCH v3] " Maciej Żenczykowski
0 siblings, 2 replies; 11+ messages in thread
From: Eric Dumazet @ 2020-09-23 8:46 UTC (permalink / raw)
To: Maciej Żenczykowski, Maciej Żenczykowski, David S . Miller
Cc: Linux Network Development Mailing List, Willem de Bruijn,
Lorenzo Colitti, Sunmeet Gill, Vinay Paradkar, Tyler Wear,
David Ahern
On 9/23/20 6:51 AM, Maciej Żenczykowski 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>
Note that my email address is more like : <edumazet@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 | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/include/net/ip.h b/include/net/ip.h
> index b09c48d862cc..c2188bebbc54 100644
> --- a/include/net/ip.h
> +++ b/include/net/ip.h
> @@ -436,12 +436,17 @@ static inline unsigned int ip_dst_mtu_maybe_forward(const struct dst_entry *dst,
> bool forwarding)
> {
> struct net *net = dev_net(dst->dev);
> + unsigned int mtu;
>
> if (net->ipv4.sysctl_ip_fwd_use_pmtu ||
> ip_mtu_locked(dst) ||
> !forwarding)
> return dst_mtu(dst);
>
> + /* 'forwarding = true' case should always honour route mtu */
> + mtu = dst_metric_raw(dst, RTAX_MTU);
> + if (mtu) return mtu;
if (mtu)
return mtu;
Apparently route mtu are capped to 65520, not sure where it is done exactly IP_MAX_MTU being 65535)
# ip ro add 1.1.1.4 dev wlp2s0 mtu 100000
# ip ro get 1.1.1.4
1.1.1.4 dev wlp2s0 src 192.168.8.147 uid 0
cache mtu 65520
> +
> return min(READ_ONCE(dst->dev->mtu), IP_MAX_MTU);
> }
>
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2] net/ipv4: always honour route mtu during forwarding
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
1 sibling, 1 reply; 11+ messages in thread
From: David Ahern @ 2020-09-23 14:36 UTC (permalink / raw)
To: Eric Dumazet, Maciej Żenczykowski, Maciej Żenczykowski,
David S . Miller
Cc: Linux Network Development Mailing List, Willem de Bruijn,
Lorenzo Colitti, Sunmeet Gill, Vinay Paradkar, Tyler Wear,
David Ahern
On 9/23/20 2:46 AM, Eric Dumazet wrote:
>> diff --git a/include/net/ip.h b/include/net/ip.h
>> index b09c48d862cc..c2188bebbc54 100644
>> --- a/include/net/ip.h
>> +++ b/include/net/ip.h
>> @@ -436,12 +436,17 @@ static inline unsigned int ip_dst_mtu_maybe_forward(const struct dst_entry *dst,
>> bool forwarding)
>> {
>> struct net *net = dev_net(dst->dev);
>> + unsigned int mtu;
>>
>> if (net->ipv4.sysctl_ip_fwd_use_pmtu ||
>> ip_mtu_locked(dst) ||
>> !forwarding)
>> return dst_mtu(dst);
>>
>> + /* 'forwarding = true' case should always honour route mtu */
>> + mtu = dst_metric_raw(dst, RTAX_MTU);
>> + if (mtu) return mtu;
>
>
> if (mtu)
> return mtu;
>
> Apparently route mtu are capped to 65520, not sure where it is done exactly IP_MAX_MTU being 65535)
ip_metrics_convert seems to be the place"
if (type == RTAX_MTU && val > 65535 - 15)
val = 65535 - 15;
going back through the code moves, and it was added by Dave with
710ab6c03122c
>
> # ip ro add 1.1.1.4 dev wlp2s0 mtu 100000
> # ip ro get 1.1.1.4
> 1.1.1.4 dev wlp2s0 src 192.168.8.147 uid 0
> cache mtu 65520
>
>
>
>
>> +
>> return min(READ_ONCE(dst->dev->mtu), IP_MAX_MTU);
>> }
>>
>>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2] net/ipv4: always honour route mtu during forwarding
2020-09-23 14:36 ` David Ahern
@ 2020-09-23 19:02 ` David Miller
0 siblings, 0 replies; 11+ messages in thread
From: David Miller @ 2020-09-23 19:02 UTC (permalink / raw)
To: dsahern
Cc: eric.dumazet, zenczykowski, maze, netdev, willemb, lorenzo,
sgill, vparadka, twear, dsahern
From: David Ahern <dsahern@gmail.com>
Date: Wed, 23 Sep 2020 08:36:50 -0600
> On 9/23/20 2:46 AM, Eric Dumazet wrote:
>> Apparently route mtu are capped to 65520, not sure where it is done exactly IP_MAX_MTU being 65535)
>
> ip_metrics_convert seems to be the place"
> if (type == RTAX_MTU && val > 65535 - 15)
> val = 65535 - 15;
>
> going back through the code moves, and it was added by Dave with
> 710ab6c03122c
At the time of that commit IP_MAX_MTU only existed in net/ipv4/route.c
and it's value was 0xFFF0.
So I didn't add anything :-) Just moving stuff around.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v3] net/ipv4: always honour route mtu during forwarding
2020-09-23 8:46 ` Eric Dumazet
2020-09-23 14:36 ` David Ahern
@ 2020-09-23 20:18 ` Maciej Żenczykowski
2020-09-24 9:14 ` Eric Dumazet
2020-09-25 2:54 ` David Miller
1 sibling, 2 replies; 11+ messages in thread
From: Maciej Żenczykowski @ 2020-09-23 20:18 UTC (permalink / raw)
To: Maciej Żenczykowski, David S . Miller
Cc: Linux Network Development Mailing List, Eric Dumazet,
Willem de Bruijn, Lorenzo Colitti, Sunmeet Gill, Vinay Paradkar,
Tyler Wear, David Ahern
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 <edumazet@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 | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/include/net/ip.h b/include/net/ip.h
index b09c48d862cc..2a52787db64a 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -436,12 +436,18 @@ static inline unsigned int ip_dst_mtu_maybe_forward(const struct dst_entry *dst,
bool forwarding)
{
struct net *net = dev_net(dst->dev);
+ unsigned int mtu;
if (net->ipv4.sysctl_ip_fwd_use_pmtu ||
ip_mtu_locked(dst) ||
!forwarding)
return dst_mtu(dst);
+ /* 'forwarding = true' case should always honour route mtu */
+ 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
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH] net/ipv4: always honour route mtu during forwarding
[not found] ` <202009240537.PKBbxi6l%lkp@intel.com>
@ 2020-09-24 1:06 ` Maciej Żenczykowski
0 siblings, 0 replies; 11+ messages in thread
From: Maciej Żenczykowski @ 2020-09-24 1:06 UTC (permalink / raw)
To: kernel test robot
Cc: David S . Miller, kbuild-all, clang-built-linux,
Linux Network Development Mailing List, Willem de Bruijn,
Lorenzo Colitti, Sunmeet Gill, Vinay Paradkar, Tyler Wear,
David Ahern
On Wed, Sep 23, 2020 at 2:34 PM kernel test robot <lkp@intel.com> wrote:
>
> Hi "Maciej,
>
> Thank you for the patch! Perhaps something to improve:
This patchset was already superseded precisely because of this issue.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] net/ipv4: always honour route mtu during forwarding
2020-09-23 4:40 [PATCH] net/ipv4: always honour route mtu during forwarding Maciej Żenczykowski
2020-09-23 4:46 ` Maciej Żenczykowski
[not found] ` <202009240537.PKBbxi6l%lkp@intel.com>
@ 2020-09-24 4:21 ` kernel test robot
2 siblings, 0 replies; 11+ messages in thread
From: kernel test robot @ 2020-09-24 4:21 UTC (permalink / raw)
To: Maciej Żenczykowski, Maciej Żenczykowski, David S . Miller
Cc: kbuild-all, Linux Network Development Mailing List,
Willem de Bruijn, Lorenzo Colitti, Sunmeet Gill, Vinay Paradkar,
Tyler Wear, David Ahern
[-- Attachment #1: Type: text/plain, Size: 2589 bytes --]
Hi "Maciej,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on net-next/master]
[also build test WARNING on net/master linus/master sparc-next/master next-20200923]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Maciej-enczykowski/net-ipv4-always-honour-route-mtu-during-forwarding/20200923-124249
base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 748d1c8a425ec529d541f082ee7a81f6a51fa120
config: parisc-randconfig-c003-20200923 (attached as .config)
compiler: hppa64-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=parisc
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
In file included from include/net/busy_poll.h:18,
from fs/select.c:32:
include/net/ip.h: In function 'ip_dst_mtu_maybe_forward':
>> include/net/ip.h:446:2: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
446 | unsigned int mtu = dst_metric_raw(dst, RTAX_MTU);
| ^~~~~~~~
# https://github.com/0day-ci/linux/commit/d9552d77468fe90224e07225cfc8c3f838b28b1b
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Maciej-enczykowski/net-ipv4-always-honour-route-mtu-during-forwarding/20200923-124249
git checkout d9552d77468fe90224e07225cfc8c3f838b28b1b
vim +446 include/net/ip.h
434
435 static inline unsigned int ip_dst_mtu_maybe_forward(const struct dst_entry *dst,
436 bool forwarding)
437 {
438 struct net *net = dev_net(dst->dev);
439
440 if (net->ipv4.sysctl_ip_fwd_use_pmtu ||
441 ip_mtu_locked(dst) ||
442 !forwarding)
443 return dst_mtu(dst);
444
445 /* 'forwarding = true' case should always honour route mtu */
> 446 unsigned int mtu = dst_metric_raw(dst, RTAX_MTU);
447 if (mtu) return mtu;
448
449 return min(READ_ONCE(dst->dev->mtu), IP_MAX_MTU);
450 }
451
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 24597 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v3] net/ipv4: always honour route mtu during forwarding
2020-09-23 20:18 ` [PATCH v3] " Maciej Żenczykowski
@ 2020-09-24 9:14 ` Eric Dumazet
2020-09-25 2:54 ` David Miller
1 sibling, 0 replies; 11+ messages in thread
From: Eric Dumazet @ 2020-09-24 9:14 UTC (permalink / raw)
To: Maciej Żenczykowski
Cc: Maciej Żenczykowski, David S . Miller,
Linux Network Development Mailing List, Willem de Bruijn,
Lorenzo Colitti, Sunmeet Gill, Vinay Paradkar, Tyler Wear,
David Ahern
On Wed, Sep 23, 2020 at 10:18 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
>
>
> Signed-off-by: Maciej Żenczykowski <maze@google.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v3] net/ipv4: always honour route mtu during forwarding
2020-09-23 20:18 ` [PATCH v3] " Maciej Żenczykowski
2020-09-24 9:14 ` Eric Dumazet
@ 2020-09-25 2:54 ` David Miller
1 sibling, 0 replies; 11+ messages in thread
From: David Miller @ 2020-09-25 2:54 UTC (permalink / raw)
To: zenczykowski
Cc: maze, netdev, edumazet, willemb, lorenzo, sgill, vparadka, twear,
dsahern
From: Maciej Żenczykowski <zenczykowski@gmail.com>
Date: Wed, 23 Sep 2020 13:18:15 -0700
> 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>
Applied and queued up for -stable, thank you.
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2020-09-25 2:54 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-23 4:40 [PATCH] net/ipv4: always honour route mtu during forwarding Maciej Żenczykowski
2020-09-23 4:46 ` Maciej Żenczykowski
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
[not found] ` <202009240537.PKBbxi6l%lkp@intel.com>
2020-09-24 1:06 ` [PATCH] " Maciej Żenczykowski
2020-09-24 4:21 ` kernel test robot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).