* [PATCH] net: l2tp_eth: fix max_mtu
@ 2016-10-20 20:08 Asbjoern Sloth Toennesen
2016-10-20 21:19 ` Asbjoern Sloth Toennesen
0 siblings, 1 reply; 3+ messages in thread
From: Asbjoern Sloth Toennesen @ 2016-10-20 20:08 UTC (permalink / raw)
To: David S . Miller; +Cc: linux-kernel, netdev, Jarod Wilson
Fixes: 61e84623ace3 ("net: centralize net_device min/max MTU checking")
CC: netdev@vger.kernel.org
CC: Jarod Wilson <jarod@redhat.com>
Signed-off-by: Asbjoern Sloth Toennesen <asbjorn@asbjorn.st>
---
net/l2tp/l2tp_eth.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/net/l2tp/l2tp_eth.c b/net/l2tp/l2tp_eth.c
index 965f7e3..ba82dcc 100644
--- a/net/l2tp/l2tp_eth.c
+++ b/net/l2tp/l2tp_eth.c
@@ -259,6 +259,7 @@ static int l2tp_eth_create(struct net *net, u32 tunnel_id, u32 session_id, u32 p
session->mtu = dev->mtu - session->hdr_len;
dev->mtu = session->mtu;
dev->needed_headroom += session->hdr_len;
+ dev->max_mtu = ETH_MAX_MTU - dev->needed_headroom;
priv = netdev_priv(dev);
priv->dev = dev;
--
2.9.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] net: l2tp_eth: fix max_mtu
2016-10-20 20:08 [PATCH] net: l2tp_eth: fix max_mtu Asbjoern Sloth Toennesen
@ 2016-10-20 21:19 ` Asbjoern Sloth Toennesen
2016-10-21 3:19 ` Jarod Wilson
0 siblings, 1 reply; 3+ messages in thread
From: Asbjoern Sloth Toennesen @ 2016-10-20 21:19 UTC (permalink / raw)
To: David S . Miller; +Cc: linux-kernel, netdev, Jarod Wilson, R Parameswaran
[-- Attachment #1: Type: text/plain, Size: 862 bytes --]
On Thu, 20 Oct 2016 20:08:26 +0000 (UTC), ast@asbjorn.biz wrote:
> diff --git a/net/l2tp/l2tp_eth.c b/net/l2tp/l2tp_eth.c
> index 965f7e3..ba82dcc 100644
> --- a/net/l2tp/l2tp_eth.c
> +++ b/net/l2tp/l2tp_eth.c
> @@ -259,6 +259,7 @@ static int l2tp_eth_create(struct net *net, u32 tunnel_id, u32 session_id, u32 p
> session->mtu = dev->mtu - session->hdr_len;
> dev->mtu = session->mtu;
> dev->needed_headroom += session->hdr_len;
> + dev->max_mtu = ETH_MAX_MTU - dev->needed_headroom;
I forgot to add that subtracting dev->needed_headroom doesn't
give the exact maximum MTU, but one that is a bit too high.
It could also just be set to ETH_MAX_MTU, to indicate that
the encapsulation is not included.
Calculations like in R. Parameswaran's patch is needed for the
exact one.
https://lkml.org/lkml/2016/10/17/3
--
Best regards
Asbjørn Sloth Tønnesen
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] net: l2tp_eth: fix max_mtu
2016-10-20 21:19 ` Asbjoern Sloth Toennesen
@ 2016-10-21 3:19 ` Jarod Wilson
0 siblings, 0 replies; 3+ messages in thread
From: Jarod Wilson @ 2016-10-21 3:19 UTC (permalink / raw)
To: Asbjoern Sloth Toennesen
Cc: David S . Miller, linux-kernel, netdev, R Parameswaran
On Thu, Oct 20, 2016 at 09:19:29PM +0000, Asbjoern Sloth Toennesen wrote:
> On Thu, 20 Oct 2016 20:08:26 +0000 (UTC), ast@asbjorn.biz wrote:
> > diff --git a/net/l2tp/l2tp_eth.c b/net/l2tp/l2tp_eth.c
> > index 965f7e3..ba82dcc 100644
> > --- a/net/l2tp/l2tp_eth.c
> > +++ b/net/l2tp/l2tp_eth.c
> > @@ -259,6 +259,7 @@ static int l2tp_eth_create(struct net *net, u32 tunnel_id, u32 session_id, u32 p
> > session->mtu = dev->mtu - session->hdr_len;
> > dev->mtu = session->mtu;
> > dev->needed_headroom += session->hdr_len;
> > + dev->max_mtu = ETH_MAX_MTU - dev->needed_headroom;
>
> I forgot to add that subtracting dev->needed_headroom doesn't
> give the exact maximum MTU, but one that is a bit too high.
> It could also just be set to ETH_MAX_MTU, to indicate that
> the encapsulation is not included.
>
> Calculations like in R. Parameswaran's patch is needed for the
> exact one.
> https://lkml.org/lkml/2016/10/17/3
Argh. So there are a tiny handful of drivers that call ether_setup, but
have no ndo_change_mtu at all, which thus previously, had no mtu range
checks other than mtu < 0, and now have a range check of 68 to 1500...
Since there was no range at all before, feature-parity here should be
min_mtu = 0, max_mtu = ETH_MAX_MTU. I think I see five other cases that
are in a similar situation:
net/atm/br2684.c
net/bluetooth/bnep/netdev.c
net/dsa/slave.c
net/irda/irda_device.c
net/irda/irlan/irlan_eth.c
Honestly, I think dsa is the only one where it likely actually matters,
but I'll send a patch addressing all of those plus l2tp_eth in half a sec.
--
Jarod Wilson
jarod@redhat.com
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-10-21 3:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-20 20:08 [PATCH] net: l2tp_eth: fix max_mtu Asbjoern Sloth Toennesen
2016-10-20 21:19 ` Asbjoern Sloth Toennesen
2016-10-21 3:19 ` Jarod Wilson
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).