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-next>] [day] [month] [year] [list]
Message-Id: <20220602081929.21929-1-kaarelp2rtel@gmail.com>
Date:   Thu,  2 Jun 2022 11:19:29 +0300
From:   Kaarel Pärtel <kaarelp2rtel@...il.com>
To:     Wolfgang Grandegger <wg@...ndegger.com>,
        Marc Kleine-Budde <mkl@...gutronix.de>,
        "David S. Miller" <davem@...emloft.net>,
        Eric Dumazet <edumazet@...gle.com>,
        Jakub Kicinski <kuba@...nel.org>,
        Paolo Abeni <pabeni@...hat.com>
Cc:     Kaarel Pärtel <kaarelp2rtel@...il.com>,
        linux-can@...r.kernel.org, netdev@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: [PATCH] net: add operstate for vcan and dummy

The idea here is simple. The vcan and the dummy network devices
currently do not set the operational state of the interface.
The result is that the interface state will be UNKNOWN.

The kernel considers the unknown state to be the same as up:
https://elixir.bootlin.com/linux/latest/source/include/linux/netdevice.h#L4125

However for users this creates confusion:
https://serverfault.com/questions/629676/dummy-network-interface-in-linux

The change in this patch is very simple. When the interface is set up, the
operational state is set to IF_OPER_UP.

Signed-off-by: Kaarel Pärtel <kaarelp2rtel@...il.com>
---
 drivers/net/can/vcan.c | 1 +
 drivers/net/dummy.c    | 1 +
 2 files changed, 2 insertions(+)

diff --git a/drivers/net/can/vcan.c b/drivers/net/can/vcan.c
index a15619d883ec..79768f9d4294 100644
--- a/drivers/net/can/vcan.c
+++ b/drivers/net/can/vcan.c
@@ -162,6 +162,7 @@ static void vcan_setup(struct net_device *dev)
 
 	dev->netdev_ops		= &vcan_netdev_ops;
 	dev->needs_free_netdev	= true;
+	dev->operstate = IF_OPER_UP;
 }
 
 static struct rtnl_link_ops vcan_link_ops __read_mostly = {
diff --git a/drivers/net/dummy.c b/drivers/net/dummy.c
index f82ad7419508..ab128f66de00 100644
--- a/drivers/net/dummy.c
+++ b/drivers/net/dummy.c
@@ -133,6 +133,7 @@ static void dummy_setup(struct net_device *dev)
 
 	dev->min_mtu = 0;
 	dev->max_mtu = 0;
+	dev->operstate = IF_OPER_UP;
 }
 
 static int dummy_validate(struct nlattr *tb[], struct nlattr *data[],
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ