[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20181201160021.GA4948@Mindship-05.localdomain>
Date: Sat, 1 Dec 2018 17:00:21 +0100
From: Jouke Witteveen <j.witteveen@...il.com>
To: davem@...emloft.net
Cc: netdev@...r.kernel.org
Subject: [PATCH 1/2] net: linkwatch: send change uevent on link changes
Make it easy for userspace to respond to acquisition/loss of carrier.
The uevent is picked up by udev and, on systems with systemd, the
device unit of the interface announces a configuration reload.
Signed-off-by: Jouke Witteveen <j.witteveen@...il.com>
---
I did not want to change the commit message into a systemd-howto, but
subscribing to udev events can be done through a line like
ReloadPropagatedFrom=sys-subsystem-net-devices-%i.device
in a systemd unit file.
net/core/link_watch.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/net/core/link_watch.c b/net/core/link_watch.c
index 7f51efb2b..66aeb88f8 100644
--- a/net/core/link_watch.c
+++ b/net/core/link_watch.c
@@ -162,6 +162,8 @@ static void linkwatch_do_dev(struct net_device *dev)
dev_deactivate(dev);
netdev_state_change(dev);
+
+ kobject_uevent(&dev->dev.kobj, KOBJ_CHANGE);
}
dev_put(dev);
}
--
2.19.2
Powered by blists - more mailing lists