From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jouke Witteveen Subject: [PATCH 1/2] net: linkwatch: send change uevent on link changes Date: Sat, 1 Dec 2018 17:00:21 +0100 Message-ID: <20181201160021.GA4948@Mindship-05.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: netdev@vger.kernel.org To: davem@davemloft.net Return-path: Received: from mail-ed1-f66.google.com ([209.85.208.66]:41722 "EHLO mail-ed1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726887AbeLBDNS (ORCPT ); Sat, 1 Dec 2018 22:13:18 -0500 Received: by mail-ed1-f66.google.com with SMTP id z28so7266290edi.8 for ; Sat, 01 Dec 2018 08:00:28 -0800 (PST) Content-Disposition: inline Sender: netdev-owner@vger.kernel.org List-ID: 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 --- 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