Re: signal for (De)ActivateConnection?

On Tue, 2017-12-05 at 18:53 +0100, Michael Hirmke wrote:
Hi *,


after one of the latest NetworkManager upgrades one of my perl
stopped working, obviously because listening to dbus' NetworkManager
DeviceAdded/DeviceRemoved signals no longer covers my strongswan vpn

And update of NM shouldn't change behavior for you. Can you detail what
causes the breaking?

  dbus-monitor --system "interface='org.freedesktop.NetworkManager'"
I see, that a PropertiesChanged signal is fired and a new entry
appears in the list of active connections, as soon as the vpn
is established.

So my question is: How do I handle this programmatically?
Do I listen to PropertiesChanged signals in addition to
DeviceAdded/DeviceRemoved signals? And if so, how do I know that
PropertiesChanged means that a new connection appeared and what
connection that is?

/org/freedesktop/NetworkManager/Devices/* is different from 
/org/freedesktop/NetworkManager/ActiveConnection/* is different from

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).

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`.

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.

See the D-Bus API documentation:


Attachment: signature.asc
Description: This is a digitally signed message part

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]