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: <b2ef76f2-cf4e-3d14-7436-8c66e63776ba@intel.com>
Date:   Fri, 10 Jan 2020 14:02:23 -0800
From:   Johnathan Mantey <johnathanx.mantey@...el.com>
To:     netdev@...r.kernel.org
Cc:     sam@...dozajonas.com, davem@...emloft.net
Subject: [PATCH] Propagate NCSI channel carrier loss/gain events to the kernel

>From 76d99782ec897b010ba507895d60d27dca8dca44 Mon Sep 17 00:00:00 2001
From: Johnathan Mantey <johnathanx.mantey@...el.com>
Date: Fri, 10 Jan 2020 12:46:17 -0800
Subject: [PATCH] Propagate NCSI channel carrier loss/gain events to the
kernel

Problem statement:
Insertion or removal of a network cable attached to a NCSI controlled
network channel does not notify the kernel of the loss/gain of the
network link.

The expectation is that /sys/class/net/eth(x)/carrier will change
state after a pull/insertion event. In addition the carrier_up_count
and carrier_down_count files should increment.

Change statement:
Use the NCSI Asynchronous Event Notification handler to detect a
change in a NCSI link.
Add code to propagate carrier on/off state to the network interface.
The on/off state is only modified after the existing code identifies
if the network device HAD or HAS a link state change.

Test procedure:
Connected a L2 switch with only two ports connected.
One port was a DHCP corporate net, the other port attached to the NCSI
controlled NIC.

Starting with the L2 switch with DC on, check to make sure the NCSI
link is operating.
cat /sys/class/net/eth1/carrier
1
cat /sys/class/net/eth1/carrier_up_count
0
cat /sys/class/net/eth1/carrier_down_count
0

Remove DC from the L2 switch, and check link state
cat /sys/class/net/eth1/carrier
0
cat /sys/class/net/eth1/carrier_up_count
0
cat /sys/class/net/eth1/carrier_down_count
1

Restore DC to the L2 switch, and check link state
cat /sys/class/net/eth1/carrier
1
cat /sys/class/net/eth1/carrier_up_count
1
cat /sys/class/net/eth1/carrier_down_count
1

Signed-off-by: Johnathan Mantey <johnathanx.mantey@...el.com>
---
 net/ncsi/ncsi-aen.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/net/ncsi/ncsi-aen.c b/net/ncsi/ncsi-aen.c
index b635c194f0a8..274c415dcead 100644
--- a/net/ncsi/ncsi-aen.c
+++ b/net/ncsi/ncsi-aen.c
@@ -89,6 +89,12 @@ static int ncsi_aen_handler_lsc(struct ncsi_dev_priv
*ndp,
     if ((had_link == has_link) || chained)
         return 0;
 
+    if (had_link) {
+        netif_carrier_off(ndp->ndev.dev);
+    } else {
+        netif_carrier_on(ndp->ndev.dev);
+    }
+
     if (!ndp->multi_package && !nc->package->multi_channel) {
         if (had_link) {
             ndp->flags |= NCSI_DEV_RESHUFFLE;
-- 
2.24.1



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ