public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Jouke Witteveen <j.witteveen@gmail.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org
Subject: [PATCH 1/2] net: linkwatch: send change uevent on link changes
Date: Sat, 1 Dec 2018 17:00:21 +0100	[thread overview]
Message-ID: <20181201160021.GA4948@Mindship-05.localdomain> (raw)

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@gmail.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

             reply	other threads:[~2018-12-02  3:13 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-01 16:00 Jouke Witteveen [this message]
2018-12-01 17:14 ` [PATCH 1/2] net: linkwatch: send change uevent on link changes Stephen Hemminger
2018-12-05  4:49 ` David Miller
2018-12-05 13:50   ` Jouke Witteveen
2018-12-05 19:45     ` David Miller
2018-12-05 22:38       ` Jouke Witteveen
2018-12-06  0:34         ` David Miller
2018-12-06  8:59           ` Jouke Witteveen
2018-12-06 20:10             ` David Miller
2018-12-06 20:40               ` Jouke Witteveen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181201160021.GA4948@Mindship-05.localdomain \
    --to=j.witteveen@gmail.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox