Re: signal for (De)ActivateConnection?
- From: mh mike franken de (Michael Hirmke)
- To: networkmanager-list gnome org
- Subject: Re: signal for (De)ActivateConnection?
- Date: 07 Dec 2017 22:44:00 +0100
Hi Thomas,
thx for your answer.
[...]
And update of NM shouldn't change behavior for you. Can you detail what
causes the breaking?
I'm not sure, I just noticed a few days ago, that my script doesn't work
any more and that I don't get a DeviceAdd signal any more.
To answer your last question about what I want to achieve:
I want to run certain GUI programs depending on certain network
connections coming up or going down. So I wrote a perl script around the
Net::DBus module. This script gets started via KDE autostart and waits
for signals telling it what is going on regarding network connections.
[...]
/org/freedesktop/NetworkManager/Devices/* is different from
/org/freedesktop/NetworkManager/ActiveConnection/* is different from
/org/freedesktop/NetworkManager/Settings/*
I know, but I don't know how to bring the bits and pieces together.
When I started scripting, I thought that I'd need the DeviceAdd and
DeviceRemoved signals to achieve my goal, but in the meantime I begin to
understand, that I have to wait for connections coming up.
I didn't find an appropriate example, though.
An ActiveConnection connects the connection profile with the networking
device, while the profile is activated on a device..
DeviceAdded/DeviceRemove notifies you about devices. A PropertyChanged
signal for property ActiveConnections, notifies you about a change in
the list of all active connections (which is add or removal).
So how do I find out, that the PropertyChanged signal comes from a
network connection coming up or going down?
VPN connections for NetworkManager are a bit wired. VPN connections are
a subclass of active connections.
If you have a tun/tap based VPN (like OpenVPN), then the VPN's device
is not the tun/tap device, but instead the device with the default
route. As you see with `nmcli device`.
No, there isn't a device, though I'm quite sure it was in earlier
versions of NetworkManager (or perhaps strongswan).
You don't say what you want to do, but usually you need to look at one
or more D-Bus objects and their state.
You would look at the presence and state of the active-connection (or
VPN connection), in addition to the state of the device. However, as
said, in case of VPNs, the device is not what you might expect it is.
Do I need to check for devices at all?
See the D-Bus API documentation:
https://developer.gnome.org/NetworkManager/stable/spec.html
Yes, this is my main source, but I don't understand everything described
there 8-<
best,
Thomas
Bye.
Michael.
--
Michael Hirmke
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]