summaryrefslogtreecommitdiff
path: root/libnm/nm-device-bond.c
Commit message (Collapse)AuthorAgeFilesLines
* libnm: use the o.fd.DBus.ObjectManager API for object managementlr/object-managerLubomir Rintel2016-11-101-5/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This speeds up the initial object tree load significantly. Also, it reduces the object management complexity by shifting the duties to GDBusObjectManager. The lifetime of all NMObjects is now managed by the NMClient via the object manager. The NMClient creates the NMObjects for GDBus objects, triggers the initialization and serves as an object registry (replaces the nm-cache). The ObjectManager uses the o.fd.DBus.ObjectManager API to learn of the object creation, removal and property changes. It takes care of the property changes so that we don't have to and lets us always see a consistent object state. Thus at the time we learn of a new object we already know its properties. The NMObject unfortunately can't be made synchronously initializable as the NMRemoteConnection's settings are not managed with standard o.fd.DBus Properties and ObjectManager APIs and thus are not known to the ObjectManager. Thus most of the asynchronous object property changing code in nm-object.c is preserved. The objects notify the properties that reference them of their initialization in from their init_finish() methods, thus the asynchronously created objects are not allowed to fail creation (or the dependees would wait forever). Not a problem -- if a connection can't get its Settings, it's either invisible or being removed (presumably we'd learn of the removal from the object manager soon). The NMObjects can't be created by the object manager itself, since we can't determine the resulting object type in proxy_type() yet (we can't tell from the name and can't access the interface list). Therefore the GDBusObject is coupled with a NMObject later on. Lastly, now that all the objects are managed by the object manager, the NMRemoteSettings and NMManager go away when the daemon is stopped. The complexity of dealing with calls to NMClient that would require any of the resources that these objects manage (connection or device lists, etc.) had to be moved to NMClient. The bright side is that his allows for removal all of the daemon presence tracking from NMObject.
* libnm: coerce empty strings to NULL for D-Bus propertiesThomas Haller2016-10-241-1/+1
| | | | | | | | | | | | | | | | On D-Bus level, string (s) or object paths (o) cannot be NULL. Thus, whenver server exposes such an object, it gets automatically coerced to "" or "/", respectively. On client side, libnm should coerce certain properties back, for which "" is just not a sensible value. For example, an empty NM_DEVICE_ETHERNET_HW_ADDRESS should be instead exposed as NULL. Technically, this is an API change. However, all users were well advised to expect both NULL and "" as possible return values and handle them accordingly.
* all: modify line separator comments to be 80 chars wideThomas Haller2016-10-031-1/+1
| | | | sed 's#^/\*\{5\}\*\+/$#/*****************************************************************************/#' $(git grep -l '\*\{5\}' | grep '\.[hc]$') -i
* all: cleanup includes and let "nm-default.h" include "config.h"Thomas Haller2016-02-191-5/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | - All internal source files (except "examples", which are not internal) should include "config.h" first. As also all internal source files should include "nm-default.h", let "config.h" be included by "nm-default.h" and include "nm-default.h" as first in every source file. We already wanted to include "nm-default.h" before other headers because it might contains some fixes (like "nm-glib.h" compatibility) that is required first. - After including "nm-default.h", we optinally allow for including the corresponding header file for the source file at hand. The idea is to ensure that each header file is self contained. - Don't include "config.h" or "nm-default.h" in any header file (except "nm-sd-adapt.h"). Public headers anyway must not include these headers, and internal headers are never included after "nm-default.h", as of the first previous point. - Include all internal headers with quotes instead of angle brackets. In practice it doesn't matter, because in our public headers we must include other headers with angle brackets. As we use our public headers also to compile our interal source files, effectively the result must be the same. Still do it for consistency. - Except for <config.h> itself. Include it with angle brackets as suggested by https://www.gnu.org/software/autoconf/manual/autoconf.html#Configuration-Headers
* all: drop includes to <glib/gi18n.h> for "nm-default.h"Dan Winship2015-08-051-1/+0
| | | | | | | The localization headers are now included via "nm-default.h". Also fixes several places, where we wrongly included <glib/gi18n-lib.h> instead of <glib/gi18n.h>. For example under "clients/" directory.
* all: make use of new header file "nm-default.h"Thomas Haller2015-08-051-1/+1
|
* all: rename nm-glib-compat.h to nm-glib.h, use everywhereDan Winship2015-07-241-2/+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).
* libnm*: fix library gettext usageDan Winship2014-11-131-1/+1
| | | | | | | | | | | | | | | | | Libraries need to include <gi18n-lib.h>, not <gi18n.h>, so that _() will get defined to "dgettext (GETTEXT_DOMAIN, string)" rather than "gettext (string)" (which will use the program's default domain, which works fine for programs in the NetworkManager tree, but not for external users). Likewise, we need to call bindtextdomain() so that gettext can find the translations if the library is installed in a different prefix from the program using it (and bind_textdomain_codeset(), so it will know the translations are in UTF-8 even if the locale isn't). (The fact that no one noticed this was broken before is because the libraries didn't really start returning useful translated strings much until 0.9.10, and none of the out-of-tree clients have been updated to actually show those strings to users yet.)
* all: consistently include config.hDan Winship2014-11-131-1/+2
| | | | | | | | | | | config.h should be included from every .c file, and it should be included before any other include. Fix that. (As a side effect of how I did this, this also changes us to consistently use "config.h" rather than <config.h>. To the extent that it matters [which is not much], quotes are more correct anyway, since we're talking about a file in our own build tree, not a system include.)
* libnm: merge device-type-specific errors into NMDeviceErrorDan Winship2014-10-221-42/+6
| | | | | | | | | | | | | | | | | | | | As with the settings, each device type was defining its own error type, containing either redundant or non-useful error codes. Drop all of the subtype-specific errors, and reduce things to just NM_DEVICE_ERROR_FAILED, NM_DEVICE_ERROR_INCOMPATIBLE_CONNECTION, and NM_DEVICE_ERROR_INVALID_CONNECTION. The device-type-specific errors were only returned from their nm_device_connection_compatible() implementations, so this is also a good opportunity to simplify those, by moving duplicated functionality into the base NMDevice implementation, and then allowing the subclasses to assume that the connection has already been validated in their own code. Most of the implementations now just check that the connection has the correct type for the device (which can't be done at the NMDevice level since some device types (eg, Ethernet) support multiple connection types.) Also, make sure that all of the error messages are localized.
* libnm: further NULL-vs-empty-array fixesDan Winship2014-10-191-0/+4
| | | | | | | | | | | | In some cases, code may look at the value of an array-valued property during object initialization, before NMObject has set it to its actual initial value. So ensure that we initialize all such properties to an empty array, rather than leaving them NULL. Also fix another bug in NMClient that could result in priv->active_connections being NULL during certain signal emissions, and fix nm_client_get_active_connections() to not return NULL when NM was not running.
* libnm: let NMObject create all D-Bus proxiesDan Winship2014-09-181-6/+3
| | | | | | | | | | | | Add _nm_object_class_add_interface(), for declaring that a class implements a particular interface, and then have NMObject create the corresponding proxies itself. (The subclass can get a copy with _nm_object_get_proxy() if it needs it for something). (In GDBus, creating a proxy is a heavier operation than in dbus-glib, so we'll need to create the proxies asynchronously. Moving the creation to NMObject makes that easier since we can do it as part of the existing init/init_async.)
* libnm: change empty-GPtrArray-return semanticsDan Winship2014-09-041-1/+1
| | | | | | | | | | libnm functions that return GPtrArrays of objects had a rule that if the array was empty, they would return NULL rather than a 0-length array. As it turns out, this is just a nuisance to clients, since in most places the code for the non-empty case would end up doing the right thing for the empty case as well (and where it doesn't, we can check "array->len == 0" just as easily as "array == NULL"). So just return the 0-length array instead.
* libnm: drop NM_TYPE_OBJECT_ARRAY, use G_TYPE_PTR_ARRAYDan Winship2014-09-041-9/+7
| | | | | | | | | | | | | Use G_TYPE_PTR_ARRAY for GPtrArray-of-NMObject-valued properties, because it has better introspection/bindings support. As with the strdict change in libnm-core, we need to manually copy the array in get_property() implementations, to preserve the standard semantics that get_property() returns a copy, not the internal array. (This patch also changes those properties so that they are always non-NULL until dispose(); previously some of them could be either NULL or 0-length at different times.)
* all: stop using virtual interface-name propertiesDan Winship2014-09-041-1/+1
| | | | | | | | | | | | The virtual :interface-name properties (eg, NMDeviceBond:interface-name) are deprecated in favor of NMSettingConnection:interface-name, and nm_connection_verify() ensures that their values are kept in sync. So (a) there is no need to set those properties when we can just set NMSettingConnection:interface-name instead, and (b) we can replace any calls to the setting-specific get_interface_name() methods with nm_connection_get_interface_name() or nm_setting_connection_get_interface_name().
* libnm, libnm-glib: fix cut-and-paste-osDan Winship2014-08-181-5/+5
| | | | | | Several nm-device-*.c files apparently originally used nm-device-ethernet.c as a template, but missed a reference to "eth" in class_init.
* libnm-core: include ETH_ALEN/INFINIBAND_ALEN defines in nm-utils.hDan Winship2014-08-071-1/+0
| | | | | | | | Include <linux/if_ether.h> and <linux/if_infiniband.h> from nm-utils.h, to get ETH_ALEN and INFINIBAND_ALEN, and remove those includes (as well as <net/ethernet.h> and <netinet/ether.h>, and various headers that had been included to get the ARPHRD_* constants) from other files where they're not needed now.
* libnm: make the the use of GInitable mandatoryDan Winship2014-08-011-5/+0
| | | | | | | | | | | Remove _nm_object_ensure_inited(), etc; objects that implement GInitable are now mandatory-to-init(). Remove constructor() implementations that sometimes return NULL; do all the relevant checking in init() instead. Make nm_client_new() and nm_remote_settings_new() take a GCancellable and a GError**.
* libnm: add init_dbus() virtual method to NMObjectDan Winship2014-08-011-15/+10
| | | | | | | | | | | | Rather than having each object type override constructed() to call _nm_object_register_properties(), have NMObject call a virtual method on the subclass to ask it to register them. Move some code around in nm-client.c and nm-object.c so that all D-Bus-related initialization happens in init_dbus(), and non-D-Bus-related stuff stays in construct(). (This simplifies the next commit.)
* libnm: remove _new functions from NMObject subclassesDan Winship2014-08-011-25/+0
| | | | | Most NMObjects should not be manually created, they should only be received from NMClient or NMRemoteSettings.
* libnm: remove Since tags and NM_AVAILABLE_IN_* attributesDan Winship2014-08-011-4/+0
| | | | Everything currently in libnm has always been there.
* libnm: add libnm/libnm-core (part 1)Dan Winship2014-08-011-0/+347
This commit begins creating the new "libnm", which will replace libnm-util and libnm-glib. The main reason for the libnm-util/libnm-glib split is that the daemon needs to link to libnm-util (to get NMSettings, NMConnection, etc), but can't link to libnm-glib (because it uses many of the same type names as the NetworkManager daemon. eg, NMDevice). So the daemon links to only libnm-util, but basically all clients link to both. With libnm, there will be only a single client-visible library, and NetworkManager will internally link against a private "libnm-core" containing the parts that used to be in libnm-util. (The "libnm-core" parts still need to be in their own directory so that the daemon can see those header files without also seeing the ones in libnm/ that conflict with its own headers.) [This commit just copies the source code from libnm-util/ to libnm-core/, and libnm-glib/ to libnm/: mkdir -p libnm-core/tests/ mkdir -p libnm/tests/ cp libnm-util/*.[ch] libnm-util/nm-version.h.in libnm-core/ rm -f libnm-core/nm-version.h libnm-core/nm-setting-template.[ch] libnm-core/nm-utils-enum-types.[ch] cp libnm-util/tests/*.[ch] libnm-core/tests/ cp libnm-glib/*.[ch] libnm/ rm -f libnm/libnm_glib.[ch] libnm/libnm-glib-test.c libnm/nm-glib-enum-types.[ch] cp libnm-glib/tests/*.[ch] libnm/tests/ ]