summaryrefslogtreecommitdiff
path: root/src/nm-active-connection.h
AgeCommit message (Collapse)AuthorFilesLines
2017-03-17active-connection: emit a StateChanged signal on state changesLubomir Rintel1-1/+5
It includes a reason code that makes it possible for the clients to be more reasonable about error messages. The reason code is essentially copied from the VPN, plus three more reasons that were useful for non-VPN connections.
2017-03-16device: track system interface state in NMDeviceThomas Haller1-2/+0
When deciding whether to touch a device we sometimes look at whether the active connection is external/assumed. In many cases however, there is no active connection around (e.g. while moving the device from state unmanaged to disconnected before assuming). So in most cases we instead look at the device-state-reason to decide whether to touch the interface (see nm_device_state_reason_check()). Often it's desirable to have no state and passing data as function arguments. However, the state reason has to be passed along several hops (e.g. a queued state change). Or a change to a master/slave can affect the slave/master, where we pass on the state reason. Or an intermediate event might invalidate a previous state reason. Passing the state whether to touch a device or not as a state-reason is cumbersome and limited. Instead, the device should be aware of whats going on. Add a sys-iface-state with: - SYS_IFACE_STATE_EXTERNAL: meaning, NM should not touch it - SYS_IFACE_STATE_ASSUME: meaning, NM is gracefully taking over - SYS_IFACE_STATE_MANAGED: meaning, the device is managed by NM - SYS_IFACE_STATE_REMOVED: the device no longer exists This replaces most checks of nm_device_state_reason_check() and nm_active_connection_get_activation_type() by instead looking at the sys-iface-state of the device. This patch probably has still issues, but the previous behavior was not very clear either. We will need to identify those issues in future tests and tweak the behavior. At least, now there is one flag that describes how to behave.
2017-03-16core/trivial: rename activation-type related checks for device and ↵Thomas Haller1-1/+1
active-connection nm_device_uses_assumed_connection() basically called nm_active_connection_get_assumed() on the device. Rename those functions to be closer to the activation-type flags. The concepts of "assume", "external", and "assume_or_external" will make sense with the following commits.
2017-03-16active-connection: use activation-type for active connection instead of ↵Thomas Haller1-3/+0
assumed flag
2017-03-16core: add activation-type property to active-connectionThomas Haller1-0/+3
It is still unused, but will be useful to mark a connection whether it is a full activation or assumed.
2016-10-03core: refactor private data for NMExportedObject and othersThomas Haller1-0/+3
2016-09-26core: allow passing an applied connection to nm_act_request_new()Beniamino Galvani1-0/+1
This is useful for the checkpoint/restore functionality to revert both the applied and the settings connections.
2016-03-26active-connection: add parent active connection trackingLubomir Rintel1-0/+6
Make it possible to let active connection know about an active connection it depends on and emit a signal when the parent is active.
2016-02-16core: add version-id to NMActiveConnectionThomas Haller1-0/+3
This field will be later used by NMDevice's Reapply and GetAppliedConnection methods. The usecase is to first fetch the currently applied connection, adjust it and reapply it. Using the version-id, a concurrent modification can be detected and Reapply can reject the invocation.
2015-09-18core: separate active and applied connectionLubomir Rintel1-7/+12
Clone the connection upon activation. This makes it safe for the user to modify the original connection while it is activated. This involves several changes: - NMActiveConnection gets @settings_connection and @applied_connection. To support add-and-activate, we constructing a NMActiveConnection with no connection set. Previously, we would set the "connection" field to a temporary NMConnection. Now NMManager piggybacks this temporary connection as object-data (TAG_ACTIVE_CONNETION_ADD_AND_ACTIVATE). - get rid of the functions nm_active_connection_get_connection_type() and nm_active_connection_get_connection_uuid(). From their names it is unclear whether this returns the settings or applied connection. The (few) callers should figure that out themselves. - rename nm_active_connection_get_id() to nm_active_connection_get_settings_connection_id(). This function is only used internally for logging. - dispatcher calls now get two connections as well. The applied-connection is used for the connection data, while the settings-connection is used for the connection path. - needs special handling for properties that apply immediately when changed (nm_device_reapply_settings_immediately()). Co-Authored-By: Thomas Haller <thaller@redhat.com> https://bugzilla.gnome.org/show_bug.cgi?id=724041
2015-07-24core: move D-Bus export/unexport into NMExportedObjectDan Winship1-4/+0
Move D-Bus export/unexport handling into NMExportedObject and remove type-specific export/get_path methods (export paths are now specified at the class level, and NMExportedObject handles the counters for all exported types automatically). Since all exportable objects now use the same get_path() method, we can also add some helper methods to simplify get_property() implementations for object-path and object-path-array properties.
2015-07-24core: add an NMExportedObject base classDan Winship1-4/+3
Add NMExportedObject, make it the base class of all D-Bus-exported types, and move the nm-properties-changed-signal logic into it. (Also, make NMSettings use the same properties-changed code as everything else, which it was not previously doing, presumably for historical reasons). (This is mostly just shuffling code around at this point, but NMExportedObject will be more important in the gdbus port, since gdbus-codegen doesn't do a very good job of supporting objects that export multiple interfaces [as each NMDevice subclass does, for example], so we will need more glue/helper code in NMExportedObject then.)
2015-07-24all: rename nm-glib-compat.h to nm-glib.h, use everywhereDan Winship1-1/+1
Rather than randomly including one or more of <glib.h>, <glib-object.h>, and <gio/gio.h> everywhere (and forgetting to include "nm-glib-compat.h" most of the time), rename nm-glib-compat.h to nm-glib.h, include <gio/gio.h> from there, and then change all .c files in NM to include "nm-glib.h" rather than including the glib headers directly. (Public headers files still have to include the real glib headers, since nm-glib.h isn't installed...) Also, remove glib includes from header files that are already including a base object header file (which must itself already include the glib headers).
2015-06-09nm-manager: add 'metered' propertyBeniamino Galvani1-1/+5
This introduces a global metered property which makes easier for clients to obtain the metered status of the current primary connection.
2014-11-06vpn/core: move VPN gateway route between devices when routing changesDan Williams1-0/+7
2014-08-16all: fix up multiple-include-guard definesDan Winship1-3/+3
Previously, src/nm-ip4-config.h, libnm/nm-ip4-config.h, and libnm-glib/nm-ip4-config.h all used "NM_IP4_CONFIG_H" as an include guard, which meant that nm-test-utils.h could not tell which of them was being included (and so, eg, if you tried to include nm-ip4-config.h in a libnm test, it would fail to compile because nm-test-utils.h was referring to symbols in src/nm-ip4-config.h). Fix this by changing the include guards in the non-API-stable parts of the tree: - libnm-glib/nm-ip4-config.h remains NM_IP4_CONFIG_H - libnm/nm-ip4-config.h now uses __NM_IP4_CONFIG_H__ - src/nm-ip4-config.h now uses __NETWORKMANAGER_IP4_CONFIG_H__ And likewise for all other headers. The two non-"nm"-prefixed headers, libnm/NetworkManager.h and src/NetworkManagerUtils.h are now __NETWORKMANAGER_H__ and __NETWORKMANAGER_UTILS_H__ respectively, which, while not entirely consistent with the general scheme, do still mostly make sense in isolation.
2014-07-23core: fill in nm-types.h, clean out other headersDan Winship1-3/+2
Clean up some of the cross-includes between headers (which made it so that, eg, if you included NetworkManagerUtils.h in a test program, you would need to build the test with -I$(top_srcdir)/src/platform, and if you included nm-device.h you'd need $(POLKIT_CFLAGS)) by moving all GObject struct definitions for src/ and src/settings/ into nm-types.h (which already existed to solve the NMDevice/NMActRequest circular references). Update various .c files to explicitly include the headers they used to get implicitly, and remove some now-unnecessary -I options from Makefiles.
2014-03-05core: rename function nm_active_connection_get_name() to ↵Thomas Haller1-1/+1
nm_active_connection_get_id() Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-03-05core: add 'type' and 'id' property for NMActiveConnection (rh #1061822)Jiří Klimeš1-0/+6
https://bugzilla.redhat.com/show_bug.cgi?id=1061822
2013-12-19core: add IP/DHCP config properties to o.fd.NM.Connection.ActiveDan Winship1-0/+4
Add IP and DHCP config properties to the D-Bus ActiveConnection objects. For device connections, this is redundant with the properties already on the Device object, but for VPN connections, this information was not previously available.
2013-12-03settings: port NMAgentManager, etc, to use NMAuthSubjectDan Winship1-2/+0
Rather than explicitly passing around a UID and a flag saying whether or not it's relevant. (This also fixes a bug where the wrong UID was being recorded in nm-settings-connection.c::auth_start(), which caused problems such as agent-owned secrets not getting saved because of a perceived UID mismatch.)
2013-11-08core: add nm_active_connection_[get|set]_assumed()Dan Williams1-0/+5
Various code during the activation paths will want to know whether the connection is assumed or not, so that it doesn't do stuff that touches the device.
2013-10-31core: allow ActiveConnections to be created without a deviceDan Williams1-1/+3
The device may not be created yet (in the case of software devices) when the ActiveConnection is created; in that case we still want to proceed with authorization for the connection, but we'll create the device when authorization is complete.
2013-10-31core: have ActiveConnection track device state instead of subclassesDan Williams1-1/+8
Both NMActRequest and NMVPNConnection need to track their device's state, so instead of both subclasses having to do so, consolidate that code into the superclass.
2013-10-31core: indicate via a property when master connections are ready for slavesDan Williams1-0/+3
Add a 'master-ready' property to NMActiveConnection that NMDevice can watch for to indicate that the master connection/device is ready to accept slaves. Since the slave device's ActiveConnection is already tracking its master connection, and since ActiveConnections don't enter the ACTIVATING state until their device is ready for slaves, it's pretty trivial to implement this property.
2013-10-31core: allow ActiveConnection connection to be changedDan Williams1-0/+3
For the case of AddAndActivate, which needs to set the final connection after authentication is done and NMSettings has returned the final connection.
2013-10-31core: watch master ActiveConnections and follow master deactivationDan Williams1-0/+2
2013-10-31core: switch NMActiveConnection master to an NMActiveConnection instead of ↵Dan Williams1-2/+3
NMDevice We need to track the master active connection, since it may require authentication or other operations to complete before the device actually starts activating.
2013-10-31core: allow active connection 'master' to be set after object creationDan Williams1-0/+2
We want to create the object earlier now, and figuring out the master is a lot of code that we don't want to run before creating the object. The master still must be set before exporting the object over D-Bus though, as before.
2013-10-31core: add authorization code to NMActiveConnectionDan Williams1-2/+12
In preparation for killing PendingActivation; copy and rework the PendingActivation authorization code for NMActiveConnection.
2013-10-31core: pass NMAuthSubject around activation paths instead of uid + dbus senderDan Williams1-2/+4
2013-08-22core: remove assume from nm-activation-requestPavel Šimerda1-3/+0
Whether an active connection is assumed or connected from scratch is only important during nm_device_activate(). When the activation process is set up, there's no difference from any other active connection. Acked-by: Dan Winship <danw@gnome.org> Acked-by: Thomas Haller <thaller@redhat.com>
2013-05-20core: make nm-properties-changed-signal always export the right propertiesDan Winship1-2/+0
Change the way that nm-properties-changed-signal works, and parse the dbus-binding-tool-generated info to get the exact list of properties that it's expected to export. This makes NM_PROPERTY_PARAM_NO_EXPORT unnecessary, and also fixes the problem of properties like NMDevice:hw-address being exported on classes where it shouldn't be.
2012-12-17core: move most activation request logic to the active connection classDan Williams1-5/+23
We'll want to use NMActiveConnection more in the manager and also fold the PendingActivation functionality into it. All this functionality applies to the VPN connections too, so it makes sense to have it all in the base class instead of both NMActRequest and NMVPNConnection.
2012-09-24core: add nm_active_connection_get_name() for easy access to connection nameJiří Klimeš1-0/+1
2012-07-27core: fix NM_IS_*_CLASS(klass) macrosJiří Klimeš1-1/+1
The argument is 'klass' not 'obj'.
2012-03-01core: track active connection dependenciesDan Williams1-0/+2
Track a master active connection and emit wait/ready/fail when it changes state. This signal is intended for devices to delay their activation until a master device is ready.
2012-02-09core: make NMActiveConnection a base class for NMActRequest and NMVPNConnectionDan Williams1-22/+56
That was always the goal, but never got there. This time we need it for real to abstract handling of dependent connections so bite the bullet and make it happen.
2012-01-25bonding: export path of master device property over DBUSThomas Graf1-1/+3
Adds a new "master" property to NMActiveConnection containing the path of the master NMDevice if the connection has a master. Signed-off-by: Thomas Graf <tgraf@redhat.com>
2011-04-22api: add "Uuid" property to ActiveConnection interfaceDan Williams1-0/+2
A convenience so that clients which might key certain operations off which connections are active (checking work mail only when on VPN for example) can more easily get which connections are active. This would allow those apps to store the UUID (which they would already be doing) and not have to create a Connection proxy and then get the connection properties just to retrieve the UUID of the connection. Instead they can now get it from GetAll of the ActiveConnection object, which they would already be doing.
2011-01-25Merge remote branch 'origin/master' into rm-usersetDan Williams1-1/+8
2011-01-25vpn: fix VPN active connection D-Bus API handling (bgo #569294)Dan Williams1-2/+10
Due to limitations in dbus-glib, where one GObject cannot have more than one introspection XML object attached to it, we used to include more than one <interface> in the VPNConnection object introspection XML. This was suboptimal for two reasons: 1) it duplicated the Connection.Active introspection XML which made it harder for clients to use the introspection data in a dynamic fashion, besides looking ugly in the docs 2) not many other programs use this feature of dbus-glib, which means it didn't get a lot of testing, and broke, which sucks for NM. To fix this issue, create a base class for NMVpnConnection that handles the Connection.Active API, and make NMVpnConnection itself handle just the VPN pieces that it layers on top. This makes dbus-glib happy because we aren't using two <interface> blocks in the same introspection XML, and it makes the NM code more robust because we can re-use the existing Connection.Active introspection XML in the NMVpnConnectionBase class.
2010-08-06DBus API: removing user settings supportDaniel Gnoutcheff1-1/+0
Remove bits from the external DBus API that were once needed for user settings support.
2010-08-06core: remove internal API refs. to user settingsDaniel Gnoutcheff1-2/+0
Remove all references to connection scope and user-settings services from the various internal APIs of the daemon. The external DBus API remains unchanged, albeit in stub form for scope stuff.
2010-04-15core: add 'default6' property to ActiveConnection implementationsDan Williams1-1/+2
2008-11-032008-11-02 Dan Williams <dcbw@redhat.com>Dan Williams1-3/+2
* Add license headers to everything in src/ git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@4247 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-07-022008-07-02 Dan Williams <dcbw@redhat.com>Dan Williams1-2/+0
* introspection/nm-active-connection.xml introspection/nm-vpn-connection.xml libnm-glib/nm-active-connection.c src/nm-activation-request.c src/nm-active-connection.h src/vpn-manager/nm-vpn-connection.c - Remove "SharedServiceName" and "SharedConnection" bits from the D-Bus and libnm-glib API since sharing didn't get implemented that way git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3797 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-06-262008-06-26 Dan Williams <dcbw@redhat.com>Dan Williams1-3/+3
* Update FSF address in license headers (Michael Biebl <biebl@debian.org>) git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3775 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-04-222008-04-21 Dan Williams <dcbw@redhat.com>Dan Williams1-0/+2
* include/NetworkManager.h - Add NMActiveConnectionState enum * introspection/nm-active-connection.xml introspection/nm-vpn-connection.xml - Add 'State' property for overall active connection state - Add 'Default' property, when True means this active connection has the default route - Add PropertyChanged signals so changes actually go out over the bus * src/nm-active-connection.h - Add defines for State & Default properties * src/nm-activation-request.c - Add 'state' and 'default' properties, hook up to device 'state-changed' signal to determine active connection state * src/vpn-manager/nm-vpn-connection.c src/vpn-manager/nm-vpn-connection.h src/vpn-manager/nm-vpn-manager.c src/vpn-manager/nm-vpn-service.c - Rename old 'state' to 'vpn-state' - Rename nm_vpn_connection_get_state() -> nm_vpn_connection_get_vpn_state() - Add 'state' and 'default' properties, hook up to the vpn connection's 'vpn-state-changed' signal * libnm-glib/nm-active-connection.c libnm-glib/nm-active-connection.h - Add new 'state' and 'default' properties and accessors * libnm-glib/nm-vpn-connection.c libnm-glib/nm-vpn-connection.h - Rename old 'state' property to 'vpn-state' - Add new 'state' and 'default' properties and accessors git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3582 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-03-262008-03-26 Dan Williams <dcbw@redhat.com>Dan Williams1-0/+42
Rework VPN connection handling for a more consistent D-Bus API. The VPNManager object has been removed, and active VPN connections are now the same as any other active connection. The Manager object's ActivateConnection and DeactivateConnection methods are used to start and stop a VPN connection, and the VPNConnection objects are subclasses of the ActiveConnection objects. When activating a VPN connection, pass the path of the active connection to which the VPN connection is tied in the 'specific_object' argument. Consequently, the libnm-glib API has been reworked to match this arrangement, with the VPNManager object removed, and the NMVPNConnection objects now being subclasses of NMActiveConnection. git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3504 4912f4e0-d625-0410-9fb7-b9a5a253dbdc