lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <01adab06-78c9-421e-bd3f-453e948f5bbb@lunn.ch>
Date: Wed, 6 Mar 2024 20:40:21 +0100
From: Andrew Lunn <andrew@...n.ch>
To: Antonio Quartulli <antonio@...nvpn.net>
Cc: netdev@...r.kernel.org, Jakub Kicinski <kuba@...nel.org>,
	Sergey Ryazanov <ryazanov.s.a@...il.com>,
	Paolo Abeni <pabeni@...hat.com>, Eric Dumazet <edumazet@...gle.com>
Subject: Re: [PATCH net-next v2 22/22] ovpn: add basic ethtool support

On Wed, Mar 06, 2024 at 04:42:03PM +0100, Antonio Quartulli wrote:
> On 05/03/2024 00:04, Andrew Lunn wrote:
> > On Mon, Mar 04, 2024 at 04:09:13PM +0100, Antonio Quartulli wrote:
> > > Signed-off-by: Antonio Quartulli <antonio@...nvpn.net>
> > > ---
> > >   drivers/net/ovpn/main.c | 32 ++++++++++++++++++++++++++++++++
> > >   1 file changed, 32 insertions(+)
> > > 
> > > diff --git a/drivers/net/ovpn/main.c b/drivers/net/ovpn/main.c
> > > index 95a94ccc99c1..9dfcf2580659 100644
> > > --- a/drivers/net/ovpn/main.c
> > > +++ b/drivers/net/ovpn/main.c
> > > @@ -13,6 +13,7 @@
> > >   #include "ovpnstruct.h"
> > >   #include "packet.h"
> > > +#include <linux/ethtool.h>
> > >   #include <linux/genetlink.h>
> > >   #include <linux/module.h>
> > >   #include <linux/moduleparam.h>
> > > @@ -83,6 +84,36 @@ static const struct net_device_ops ovpn_netdev_ops = {
> > >   	.ndo_get_stats64        = dev_get_tstats64,
> > >   };
> > > +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);
> > > +	cmd->base.speed	= SPEED_1000;
> > > +	cmd->base.duplex = DUPLEX_FULL;
> > > +	cmd->base.port = PORT_TP;
> > > +	cmd->base.phy_address = 0;
> > > +	cmd->base.transceiver = XCVR_INTERNAL;
> > > +	cmd->base.autoneg = AUTONEG_DISABLE;
> > 
> > Why? It is a virtual device. Speed and duplex is meaningless. You
> > could run this over FDDI, HIPPI, or RFC 1149? So why PORT_TP?
> 
> To be honest, I couldn't find any description to help me with deciding what
> to set there and I just used a value I saw in other Ethernet drivers.
> 
> Do you have any recommendation?
> For the other fields: do you think they make sense? The speed value is
> always debatable...The actual speed depends on the transport interface and
> there might be multiple involved. Maybe SPEED_UNKNOWN is more appropriate?

Turn it around. What is your use case? What is using this information?
I would just not implement this function. But maybe you know of
something which actually requires it?

> > > +	strscpy(info->bus_info, "ovpn", sizeof(info->bus_info));
> > 
> > This is also not accurate. There is no bus involved.
> 
> Should I just leave it empty then?
> 
> My concern is that a user expects $something and it will crash on my empty
> string. But if empty is allowed, I will just go with it.

Empty is allowed. The bridge uses "N/A", which i would say is also
correct. tun/tap does however use "tun", so "ovpn" is not that
different i supposes.

	Andrew


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ