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: <20140130150503.GA29607@redhat.com>
Date:	Thu, 30 Jan 2014 16:05:48 +0100
From:	Veaceslav Falico <vfalico@...hat.com>
To:	Tom Gundersen <teg@...m.no>
Cc:	netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
	Stephen Hemminger <stephen@...workplumber.org>,
	Avinash Kumar <avi.kp.137@...il.com>,
	Simon Horman <horms@...ge.net.au>,
	Marcel Holtmann <marcel@...tmann.org>,
	Greg KH <gregkh@...uxfoundation.org>,
	Kay Sievers <kay@...y.org>
Subject: Re: [PATCH] net: set default DEVTYPE for all ethernet based devices

On Thu, Jan 30, 2014 at 02:20:02PM +0100, Tom Gundersen wrote:
>In systemd's networkd and udevd, we would like to give the administrator a
>simple way to filter net devices by their DEVTYPE [0][1]. Other software
>such as ConnMan and NetworkManager uses a similar filtering already.
>
>Currently, plain ethernet devices have DEVTYPE=(null). This patch sets the
>devtype to "ethernet" instead. This avoids the need for special-casing the
>DEVTYPE=(null) case in userspace, and also avoids false positives, as there
>are several other types of netdevs that also have DEVTYPE=(null).

There are quite a few users at least in usb and wireless drivers:

net#git grep alloc_etherdev drivers/net/wireless/ drivers/net/usb | wc -l
18

In usb, though, there might be some false positives of this grep, as
there are a few devices which might be considered ethernet.

>
>Notice that this is done, as suggested by Marcel, in alloc_etherdev_mqs(),
>and as best I can tell it will not give any false positives. I considered
>doing it in ether_setup() instead as that seemed more intuitive, but that
>would give a lot of false positives indeed.
>
>[0]: <http://www.freedesktop.org/software/systemd/man/systemd-networkd.service.html#Type>
>[1]: <http://www.freedesktop.org/software/systemd/man/udev.html#Type>
>
>Signed-off-by: Tom Gundersen <teg@...m.no>
>Cc: Marcel Holtmann <marcel@...tmann.org>
>Cc: Greg KH <gregkh@...uxfoundation.org>
>Cc: Kay Sievers <kay@...y.org>
>---
> net/ethernet/eth.c | 12 +++++++++++-
> 1 file changed, 11 insertions(+), 1 deletion(-)
>
>diff --git a/net/ethernet/eth.c b/net/ethernet/eth.c
>index 8f032ba..b76dc17 100644
>--- a/net/ethernet/eth.c
>+++ b/net/ethernet/eth.c
>@@ -369,6 +369,10 @@ void ether_setup(struct net_device *dev)
> }
> EXPORT_SYMBOL(ether_setup);
>
>+static const struct device_type eth_type = {
>+	.name = "ethernet",
>+};
>+
> /**
>  * alloc_etherdev_mqs - Allocates and sets up an Ethernet device
>  * @sizeof_priv: Size of additional driver-private structure to be allocated
>@@ -387,7 +391,13 @@ EXPORT_SYMBOL(ether_setup);
> struct net_device *alloc_etherdev_mqs(int sizeof_priv, unsigned int txqs,
> 				      unsigned int rxqs)
> {
>-	return alloc_netdev_mqs(sizeof_priv, "eth%d", ether_setup, txqs, rxqs);
>+	struct net_device* dev;
>+
>+	dev = alloc_netdev_mqs(sizeof_priv, "eth%d", ether_setup, txqs, rxqs);
>+	if (dev)
>+		dev->dev.type = &eth_type;
>+
>+	return dev;
> }
> EXPORT_SYMBOL(alloc_etherdev_mqs);
>
>-- 
>1.8.5.3
>
>--
>To unsubscribe from this list: send the line "unsubscribe netdev" in
>the body of a message to majordomo@...r.kernel.org
>More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ