[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20201116135522.21791-5-ms@dev.tdt.de>
Date: Mon, 16 Nov 2020 14:55:24 +0100
From: Martin Schiller <ms@....tdt.de>
To: andrew.hendry@...il.com, davem@...emloft.net, kuba@...nel.org,
xie.he.0141@...il.com
Cc: linux-x25@...r.kernel.org, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org, Martin Schiller <ms@....tdt.de>
Subject: [PATCH net-next v2 4/6] net/x25: support NETDEV_CHANGE notifier
This makes it possible to handle carrier lost and detection.
In case of carrier lost, we shutdown layer 3 and flush all sessions.
Signed-off-by: Martin Schiller <ms@....tdt.de>
---
Change from v1:
fix 'subject_prefix' and 'checkpatch' warnings
---
net/x25/af_x25.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/net/x25/af_x25.c b/net/x25/af_x25.c
index 25726120fcc7..6a95ca11694e 100644
--- a/net/x25/af_x25.c
+++ b/net/x25/af_x25.c
@@ -275,6 +275,19 @@ static int x25_device_event(struct notifier_block *this, unsigned long event,
dev->name);
x25_link_device_remove(dev);
break;
+ case NETDEV_CHANGE:
+ pr_debug("X.25: got event NETDEV_CHANGE for device: %s\n",
+ dev->name);
+ if (!netif_carrier_ok(dev)) {
+ pr_debug("X.25: Carrier lost -> set link state down: %s\n",
+ dev->name);
+ nb = x25_get_neigh(dev);
+ if (nb) {
+ x25_link_terminated(nb);
+ x25_neigh_put(nb);
+ }
+ }
+ break;
}
}
--
2.20.1
Powered by blists - more mailing lists