summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* **ADJUST COMMIT MESSAGE BEFORE MERGING** libnm-util: properly disconnect ↵th/bgo696936_normalize_settings-2Thomas Haller2014-08-141-13/+19
| | | | | | | | | | | | "notify" signal for settings in NMConnection When removing/replacing a NMSetting in an NMConnection, we have to disconnect setting_changed_cb() from the "notify" signal. Backport commit 5f730d3d3223bd664892ccca5cd35e95c9fe873f from libnm-core. Signed-off-by: Thomas Haller <thaller@redhat.com>
* libnm-core: fix NMSettingConnection:verify() not to modify interface-nameThomas Haller2014-08-145-114/+51
| | | | | | | | | | | | | verify() used to modify interface-name of the base settings. This is discouraged, because verify() should not touch the connection. For libnm-core we can change behavior and only modify the connection in normalize(). Also, be more strict not to verify() sucessfully on invalid interface-name. Signed-off-by: Thomas Haller <thaller@redhat.com>
* libnm-core: allow nm_setting_verify() to succeed individually without ↵Thomas Haller2014-08-142-1/+18
| | | | | | | | | | | @all_settings When calling nm_setting_verify() without providing any settings in @all_settings, we assume that the setting on its own might be valid. Only when checked togehter with all settings, we want to consider the setting in the full context. nm_connection_verify() ensures to pass on a list of settings. Signed-off-by: Thomas Haller <thaller@redhat.com>
* libnm-core: add normalize of MTU for NMSettingInfinibandThomas Haller2014-08-144-2/+86
| | | | | | | | | | | | | | | | | Previously, NMSettingInfiniband:verify() silently modifies the setting for invalid MTU. verify() should not do that. For libnm-core we can change behavior and implement normalization of MTU. This changes behavior for NMSettingInfiniband:verify() so that MTU gets no longer fixed by verify() alone. Instead verify() fails with a verification error. Due the possibility to normalize the MTU, NM still can receive invalid settings and fix it. For libnm-core we don't change behavior, merely add a code comment. Signed-off-by: Thomas Haller <thaller@redhat.com>
* fixup! libnm-core: make failure cases for nm_connection_normalize() more ↵Thomas Haller2014-08-141-2/+4
| | | | robust against bugs
* libnm-core: make failure cases for nm_connection_normalize() more robust ↵Thomas Haller2014-08-141-9/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | against bugs We would expect that attempts to normalize a connection are successful as verify() indicates. This way, a connection is not modified if it cannot be fixed, and a connection will be valid and modified after attempts to normalization. However, there might be subtle, unexpected ways how this can fail. For example, if NMSettingConnection:verify() detects a missing base type setting, it returns NORMALIZABLE_ERROR if it finds a valid NMSettingConnection:type. Normalization then adds an empty, default setting. However, a new verify() might fail due to other reasons. This would be a bug in NMSettingConnection:verify() which must not indicate that it is able to normalize the connection, when it actually is unable to do so. Such bugs need fixing, but the code should be more robust to this case because there might be complex, unanticipated situations. Especially since NM relies on having a valid connection after normalize(), so a strict error-out behavior is important. Signed-off-by: Thomas Haller <thaller@redhat.com>
* keyfile/tests: test reading minimal keyfiles that needs normalization of ↵Thomas Haller2014-08-148-0/+115
| | | | | | type and slave-type Signed-off-by: Thomas Haller <thaller@redhat.com>
* keyfile/tests: add keyfile_read_connection_from_file() utility functionThomas Haller2014-08-141-0/+16
| | | | Signed-off-by: Thomas Haller <thaller@redhat.com>
* keyfile: don't add [connection].type base setting which is done by ↵Thomas Haller2014-08-141-21/+0
| | | | | | | | | nm_connection_normalize() This undoes commit 9f8b7ff51dfd7cdb828fe5e7b50016c5587e8657 but the same functionality is now provided via normalize(). Signed-off-by: Thomas Haller <thaller@redhat.com>
* fixup! libnm-core: normalize NMSettingConnection:type propertyThomas Haller2014-08-142-20/+303
|
* libnm-core: normalize NMSettingConnection:type propertyThomas Haller2014-08-145-13/+141
| | | | | | | | | nm_connection_normalize() can now detect the 'type' property based on existing base settings. It can also create a (default) base setting. Signed-off-by: Thomas Haller <thaller@redhat.com>
* libnm-core: stricter verification of NMSettingConnection:type propertyThomas Haller2014-08-141-18/+29
| | | | | | | Now also verify the 'type' property regardless of existing @all_settings. Signed-off-by: Thomas Haller <thaller@redhat.com>
* keyfile: remove ensure_slave_setting() when reading connectionThomas Haller2014-08-141-31/+4
| | | | | | | | | | nm_connection_normalize() can now add the slave setting as needed. Remove the duplicate functionality. This undoes commit 664d64e0c04bd4b83137a682ff9a9881966f6f94 but the same functionality is now provided via normalize(). Signed-off-by: Thomas Haller <thaller@redhat.com>
* libnm-core: normalize slave-type and slave-settings of connectionsThomas Haller2014-08-1410-15/+272
| | | | | | | | | | Some NMSettingConnection:slave-type types require a matching slave #NMSetting. Add normalization of either the 'slave-type' property or the slave-setting. Also be more strict in NMSettingConnection:verify() to enforce an existing slave-setting depending on the slave-type. Signed-off-by: Thomas Haller <thaller@redhat.com>
* libnm-core: move validation of NMSettingConnection:type to ↵Thomas Haller2014-08-142-40/+23
| | | | | | | | | NMSettingConnection:verify() Partly it was already there. This makes NMSettingConnection:verify() stricter then before, but validates the same as of NMConnection:_nm_connection_verify(). Signed-off-by: Thomas Haller <thaller@redhat.com>
* libnm-core: properly disconnect "notify" signal for settings in NMConnectionThomas Haller2014-08-141-13/+19
| | | | | | | When removing/replacing a NMSetting in an NMConnection, we have to disconnect setting_changed_cb() from the "notify" signal. Signed-off-by: Thomas Haller <thaller@redhat.com>
* libnm-core: don't set GError on invalid @connection argument in ↵Thomas Haller2014-08-141-10/+2
| | | | | | | | | | _nm_connection_verify() In general, we don't set errors if passing a completely invalid @self pointer to a method. We usually also don't set the error argument when asserting. So, just drop it. Signed-off-by: Thomas Haller <thaller@redhat.com>
* libnm-core: add _nm_setting_find_in_list_required() functionThomas Haller2014-08-142-0/+34
| | | | | | | | | | | This is an utility function that can be called during verify() to find an NMSetting from @all_settings. This is especially useful for looking up the NMSettingConnection which usually is present. So just get it quickly. In the unexpected case that it is missing, it sets @error and we can return. Signed-off-by: Thomas Haller <thaller@redhat.com>
* ifcfg-rh: remove verify() connection during readingThomas Haller2014-08-141-34/+0
| | | | | | | | | | | | | At the end of reading the connection, reader calls nm_connection_normalize() to normalize the connection. Normalization inplicitly verifies the connection. Doing a verify along the way is not needed and even harmful. Soon further checks will be added that make verify() fail, but normalize() can fix the connection. So, while reading, we might actually have an invalid connection, that will be normalized as last step. Signed-off-by: Thomas Haller <thaller@redhat.com>
* keyfile: let reader normalize() the connection, not only verify()Thomas Haller2014-08-142-10/+10
| | | | | | | | The new nm_connection_normalize() function allows to fixup an incomplete connection. The keyfile reader should call normalize on a connection, so that we can implement common normalizations there instead of inside the settings plugin. Signed-off-by: Thomas Haller <thaller@redhat.com>
* keyfile/tests: refactor tests to use nmtst_assert_connection_equals() functionThomas Haller2014-08-141-14/+8
| | | | | | | Needed in the next commit when we have to normalize the connection before comparing. Signed-off-by: Thomas Haller <thaller@redhat.com>
* keyfile: add NMSettingConnection in reader if missingThomas Haller2014-08-141-30/+32
| | | | | | | | The recent change c88b832ce9510bdcb2df2bf7e02b1ded88154581 allows for missing 'id' and 'uuid' entries. Further make the keyfile reader more accepting, by creating a missing NMSettingConnection. Signed-off-by: Thomas Haller <thaller@redhat.com>
* nmtst: add assertion functions for verify() connectionThomas Haller2014-08-141-0/+130
| | | | Signed-off-by: Thomas Haller <thaller@redhat.com>
* nmtst: add nmtst_assert_connection_equals() functionThomas Haller2014-08-141-0/+38
| | | | Signed-off-by: Thomas Haller <thaller@redhat.com>
* nmtst: add nmtst_connection_normalize() functionThomas Haller2014-08-141-0/+65
| | | | Signed-off-by: Thomas Haller <thaller@redhat.com>
* libnm-core: fix crash in NMSettingAdsl:verify()Thomas Haller2014-08-141-7/+9
| | | | Signed-off-by: Thomas Haller <thaller@redhat.com>
* all: use _nm_utils_hash_values_to_slist()Thomas Haller2014-08-144-30/+9
| | | | Signed-off-by: Thomas Haller <thaller@redhat.com>
* libnm-core: add _nm_utils_hash_values_to_slist()Thomas Haller2014-08-142-0/+31
| | | | Signed-off-by: Thomas Haller <thaller@redhat.com>
* libnm: move declaration of NM_SETTING_SECRET_FLAGS_ALL to nm-core-internal.hThomas Haller2014-08-144-8/+10
| | | | | | | | As NM_SETTING_SECRET_FLAGS_ALL is used in libnm/nm-vpn-plugin-utils.c, it is exposed as internal API and should be declared in nm-core-internal.h. Signed-off-by: Thomas Haller <thaller@redhat.com>
* libnm-core: declare NM_SETTING_COMPARE_FLAG_INFERRABLE flag in ↵Thomas Haller2014-08-143-8/+10
| | | | | | | | | "nm-core-internal.h" As this flag is used by NM-core, move it to nm-core-internal.h header file. Signed-off-by: Thomas Haller <thaller@redhat.com>
* all: add nm-core-internal.h headerThomas Haller2014-08-1415-83/+82
| | | | | | | | | | | | | | | | Add a header file to expose private utility functions from libnm-core that can be used by NetworkManager (core) and libnm.so. The header is also used to give privileged access to libnm-core. Since NM links statically, these functions are not exported and not part of public ABI. This also removes the NM_UTILS_PRIVATE_CALL() macro and libnm.so no longer exports nm_utils_get_private(). Before, this functionality was partly declared in nm-utils-private.h. This was wrong because nm-utils-private.h is for functionality entirely private to libnm-core. Signed-off-by: Thomas Haller <thaller@redhat.com>
* contrib/rpm: fix --quick option of build_clean.shThomas Haller2014-08-141-0/+2
| | | | Signed-off-by: Thomas Haller <thaller@redhat.com>
* build: fix generate-setting-docs.py to work with python3Thomas Haller2014-08-121-3/+5
| | | | Signed-off-by: Thomas Haller <thaller@redhat.com>
* core: fix build with toolchains not exporting CLOCK_BOOTTIMEPeter Korsgaard2014-08-111-0/+9
| | | | | | | | | E.G. uClibc 0.9.33 and earlier. https://bugzilla.gnome.org/show_bug.cgi?id=734599 Signed-off-by: Peter Korsgaard <peter@korsgaard.com> Signed-off-by: Thomas Haller <thaller@redhat.com>
* dhcp: fix killing wrong process ID on dhclient releaseDan Williams2014-08-082-9/+14
| | | | | | | | The prototype of dhclient_start() changed in 30cdd1248 but that commit didn't update stop() correctly. Clearly treating a gboolean as pid_t isn't going to work. Second, we don't want to watch the child process on DHCP release because we're just going to kill it shortly after.
* libnm-util: don't warn about unrecognized propertiesDan Winship2014-08-081-2/+4
| | | | | | | | | | libnm-util is expected to end up behind the curve in terms of knowing about new NMSetting properties, so if it sees an unknown property, it should just assume that there will also be a backward-compatibility equivalent rather than printing a warning. (In particular, it should not warn when it sees the "ipv4.address-labels" property now that it now longer knows about it.)
* core: fix a warning and a leakDan Winship2014-08-081-1/+2
| | | | | | | | | For devices where we don't set the hardware address at construct time, the first call to nm_device_update_hw_address() was hitting a return-if-fail. Also, when updating the hardware address, we were leaking the old value.
* libnm-glib/test: fix test failure for test-remote-settings-clientThomas Haller2014-08-081-1/+1
| | | | | | | | | Due to behavioral change of test-networkmanager-service.py, the test /remote_settings/remove_connection fails (test_remove_connection() at test-remote-settings-client.c:318). Fixes: 66a34803293e1012d7a1728d503dd64a1d906366 Signed-off-by: Thomas Haller <thaller@redhat.com>
* nmtst: fix memory leak in nmtst_create_minimal_connection()Thomas Haller2014-08-071-1/+3
| | | | Signed-off-by: Thomas Haller <thaller@redhat.com>
* libnm-core, libnm-util: convert test-crypto, test-setting-8021x.c to gtestutilsDan Winship2014-08-076-257/+342
| | | | | | | | | | | Rather than having test-crypto and test-setting-8021x be programs that you have to pass arguments to to get them to run a single test, just have them run all of the tests themselves. This lets us get rid of the big "check-local" rule in Makefile.am and just use TESTS to run everything. https://bugzilla.gnome.org/show_bug.cgi?id=734388
* Merge branch 'libnm-nmobj' (bgo #734228)Dan Winship2014-08-0722-1274/+656
|\
| * libnm: add a test for connection-deleted-while-being-createdDan Winship2014-08-072-19/+78
| | | | | | | | | | | | | | Since NMRemoteSettings doesn't announce new connections until it has fetched their properties, it's possible that a connection could get deleted while we're waiting for it to be created. NMRemoteSettings has code to deal with this, so add a test to make sure that it works.
| * nmtst: add nmtst_create_minimal_connection() functionThomas Haller2014-08-071-0/+44
| | | | | | | | Signed-off-by: Thomas Haller <thaller@redhat.com>
| * libnm: fix a g_signal_handler_find() call in NMRemoteSettingsDan Winship2014-08-071-2/+2
| | | | | | | | | | | | | | | | | | NMRemoteSettings was looking for a signal handler on an NMRemoteConnection using only G_SIGNAL_MATCH_FUNC, which means it would get tripped up if a connection was known to two different NMRemoteSettings objects at once. Although that can't happen now, it might in the future if NMRemoteConnection became an NMObject, so use G_SIGNAL_MATCH_DATA too.
| * libnm: remove NMRemoteConnection::updated signalDan Winship2014-08-073-38/+5
| | | | | | | | | | | | | | | | Remove NMRemoteConnection::updated, which since 0.9.10 has been redundant with NMConnection::changed. (We still handle the incoming D-Bus signal, we just don't re-emit it as "updated", since the call to nm_connection_replace_settings() already results in it emitting "changed".)
| * libnm: port NMRemoteSettings to NMObjectDan Winship2014-08-0710-907/+334
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | NMRemoteSettings duplicates a bunch of NMObject's functionality that it doesn't need to. In libnm-glib, it wouldn't have been possible to port NMRemoteSettings to NMObject without breaking ABI, but now in libnm we can do that. As a side effect of this, NMRemoteSettings gains a "connections" property, and "connection-added" and "connection-removed" signals (with the former replacing the old "new-connection" signal). This also removes the "connections-loaded" signal, since the connections will now always be loaded (via the initialization of the "connections" property) during init()/init_async(). Also, this removes NMRemoteConnection's "removed" signal, since it's redundant with the new NMRemoteSettings::connection-removed (and having the signal on NMRemoteSettings instead is more consistent with other objects).
| * libnm: add NMRemoteConnection:visible propertyDan Winship2014-08-074-28/+68
| | | | | | | | | | Rather than having a private "visible" signal, have a public "visible" property.
| * libnm: remove redundant NM name watching codeDan Winship2014-08-073-139/+72
| | | | | | | | | | | | | | | | | | | | | | | | | | | | NMClient was watching to see whether NetworkManager was running, but its parent class NMObject was already doing that anyway, so NMClient doesn't need to do it itself. This also requires making NMClient:init_async() wait for NMObject's init_async() code to finish before calling GetPermissions, rather than running the two in parallel like before (since we don't know if NM is running or not until after NMObject's init_async() returns). This is probably more correct anyway in terms of inheritance, and it's not as much slower than the original code as it sounds, since previously we were calling NameHasOwner twice (in serial) anyway.
| * libnm: synchronize NMClient and NMRemoteSettings "is NM running" propertiesDan Winship2014-08-0713-112/+112
| | | | | | | | | | Rename NMClient:manager-running and NMRemoteSettings:service-running to both be :nm-running.
| * libnm, libnm-glib: belatedly replace _nm_client_is_object_path()Dan Winship2014-08-072-92/+4
|/ | | | | | | _nm_client_is_object_path() had been copied from g_variant_is_object_path() with a note that it should be replaced when we depended on GLib > 2.24, but it got missed when we actually updated the dependency. Fix it now. (Also fix a nearby typo.)