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] [day] [month] [year] [list]
Date: Thu, 9 May 2024 22:16:57 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Ratheesh Kannoth <rkannoth@...vell.com>
Cc: Shradha Gupta <shradhagupta@...ux.microsoft.com>,
	"David S. Miller" <davem@...emloft.net>,
	Eric Dumazet <edumazet@...gle.com>,
	Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
	Bjorn Helgaas <bhelgaas@...gle.com>,
	Jonathan Corbet <corbet@....net>,
	Haiyang Zhang <haiyangz@...rosoft.com>,
	Randy Dunlap <rdunlap@...radead.org>,
	Johannes Berg <johannes.berg@...el.com>,
	Breno Leitao <leitao@...ian.org>, linux-kernel@...r.kernel.org,
	netdev@...r.kernel.org, Shradha Gupta <shradhagupta@...rosoft.com>
Subject: Re: [PATCH net-next v3] net: Add sysfs atttribute for max_mtu

On Thu, May 09, 2024 at 03:12:25PM +0530, Ratheesh Kannoth wrote:
> On 2024-05-09 at 14:41:23, Shradha Gupta (shradhagupta@...ux.microsoft.com) wrote:
> > For drivers like MANA, max_mtu value is populated with the value of
> > maximum MTU that the underlying hardware can support.
> IIUC, this reads dev->mtu.

I think you are misunderstanding the code.

> > +NETDEVICE_SHOW_RO(max_mtu, fmt_dec);

/* generate a show function for simple field */
#define NETDEVICE_SHOW(field, format_string)				\
static ssize_t format_##field(const struct net_device *dev, char *buf)	\
{									\
	return sysfs_emit(buf, format_string, dev->field);		\
}									\
static ssize_t field##_show(struct device *dev,				\
			    struct device_attribute *attr, char *buf)	\
{									\
	return netdev_show(dev, attr, buf, format_##field);		\
}									\

#define NETDEVICE_SHOW_RO(field, format_string)				\
NETDEVICE_SHOW(field, format_string);					\
static DEVICE_ATTR_RO(field)

So field is max_mtu, so that dev->field gets expanded to dev->max_mtu.

> you can read the same using ifconfig

We stopped using ifconfig years ago. You actually mean "ip link show"

> or any thing that uses SIOCGIFMTU. why do you need to add a new sysfs ?

SIOCGIFMTU is still implemented, but obsolete, replaced by netlink, as
Eric pointed out.

	Andrew

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ