From: Andrew Lunn <andrew@lunn.ch>
To: Antonio Quartulli <antonio@openvpn.net>
Cc: netdev@vger.kernel.org, David Miller <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
linux-kernel@vger.kernel.org
Subject: Re: [RFC 1/1] net: introduce OpenVPN Data Channel Offload (ovpn-dco)
Date: Thu, 28 Jul 2022 15:12:16 +0200 [thread overview]
Message-ID: <YuKLMIJcb9OkBHry@lunn.ch> (raw)
In-Reply-To: <d645f6e1-d977-e2ea-1f8e-0b5458c9438e@openvpn.net>
On Thu, Jul 28, 2022 at 09:44:18AM +0200, Antonio Quartulli wrote:
> Hi,
>
> On 19/07/2022 17:37, Andrew Lunn wrote:
> > > +static int ovpn_net_change_mtu(struct net_device *dev, int new_mtu)
> > > +{
> > > + if (new_mtu < IPV4_MIN_MTU ||
> > > + new_mtu + dev->hard_header_len > IP_MAX_MTU)
> > > + return -EINVAL;
> >
> > If you set dev->min_mtu and dev->max_mtu, the core will validate this
> > for you, see dev_validate_mtu().
>
> Yeah, thanks for the pointer.
>
> >
> > > +static int ovpn_get_link_ksettings(struct net_device *dev,
> > > + struct ethtool_link_ksettings *cmd)
> > > +{
> > > + ethtool_convert_legacy_u32_to_link_mode(cmd->link_modes.supported, 0);
> > > + ethtool_convert_legacy_u32_to_link_mode(cmd->link_modes.advertising, 0);
> >
> > These two should not be needed. Look at tun, veth etc, they don't set
> > them.
>
> I found this in tun.c:
>
> 3512 ethtool_link_ksettings_zero_link_mode(cmd, supported);
> 3513 ethtool_link_ksettings_zero_link_mode(cmd, advertising);
>
> Which seems a more appropriate version of my code, no?
I would trace is backwards. Where is cmd coming from? In order to
avoid unintentional information leaks, the core should be clearing any
memory which gets passed to a driver which might optionally be filled
in and then returned to user space. So take a look in net/ethtool, and
see if there is a memset() or a kzalloc() etc. If it is already been
zero'ed, you don't need this.
Andrew
next prev parent reply other threads:[~2022-07-28 13:12 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-19 1:47 [RFC 0/1] Introducing OpenVPN Data Channel Offload Antonio Quartulli
2022-07-19 1:47 ` [RFC 1/1] net: introduce OpenVPN Data Channel Offload (ovpn-dco) Antonio Quartulli
2022-07-19 15:19 ` Andrew Lunn
2022-07-19 15:21 ` Antonio Quartulli
2022-07-19 15:25 ` Andrew Lunn
2022-07-28 7:41 ` Antonio Quartulli
2022-07-28 13:07 ` Andrew Lunn
2022-07-28 13:16 ` Antonio Quartulli
2022-08-03 15:42 ` Stephen Hemminger
2022-08-03 15:48 ` Antonio Quartulli
2022-08-03 16:19 ` Stephen Hemminger
2022-08-04 7:34 ` Antonio Quartulli
2022-07-28 16:28 ` Jakub Kicinski
2022-07-28 19:16 ` Antonio Quartulli
2022-07-19 15:37 ` Andrew Lunn
2022-07-28 7:44 ` Antonio Quartulli
2022-07-28 13:12 ` Andrew Lunn [this message]
2022-08-03 15:31 ` [RFC v2] " Antonio Quartulli
2022-08-12 18:34 ` Sergey Ryazanov
2022-08-12 18:44 ` Stephen Hemminger
2022-08-30 22:35 ` Sergey Ryazanov
2022-08-12 21:05 ` Antonio Quartulli
2022-08-31 3:15 ` Sergey Ryazanov
2022-09-09 20:40 ` Antonio Quartulli
2022-09-13 0:49 ` Sergey Ryazanov
2022-08-03 16:04 ` [RFC 1/1] " Joe Perches
2022-08-04 7:35 ` Antonio Quartulli
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=YuKLMIJcb9OkBHry@lunn.ch \
--to=andrew@lunn.ch \
--cc=antonio@openvpn.net \
--cc=davem@davemloft.net \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/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 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).