summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* fixup! cli: add nmc_property_set_int() functionth/bgo580018_autoconnect_priority-1Jiří Klimeš2014-08-291-20/+0
| | | | | | Revert "cli: add nmc_property_set_int() function" This reverts commit 5fccb0bdc98ef9f79172878ead2fb32bf363949f.
* fixup! core: prefer connections with higher autoconnect-priorityJiří Klimeš2014-08-291-1/+1
|
* fixup! cli: support connection.autoconnect-priority propertyJiří Klimeš2014-08-292-9/+12
|
* fixup! libnm: add NMSettingConnection:autoconnect-priority settingJiří Klimeš2014-08-292-13/+15
|
* core: prefer connections with higher autoconnect-priorityThomas Haller2014-08-261-0/+27
| | | | | | https://bugzilla.gnome.org/show_bug.cgi?id=580018 Signed-off-by: Thomas Haller <thaller@redhat.com>
* core/policy: refactor auto_activate_device() to use a GPtrArrayThomas Haller2014-08-261-5/+13
| | | | | | | | Next we want to sort the array, g_slist_sort() is not guaranteed to be stable, while g_ptr_array_sort() is. Also, sorting a GSList has worse performance. Signed-off-by: Thomas Haller <thaller@redhat.com>
* core: remove nm_device_get_best_auto_connection()Thomas Haller2014-08-263-54/+10
| | | | | | | | | | | | nm_device_get_best_auto_connection() was only used at one place. It's function is rather simple, it just iterated over a list finding the first can_auto_connect() connection. At the very least, the name was misleading, because it did not return the 'best', but the 'first' connection. Get rid of the function altogehter. Signed-off-by: Thomas Haller <thaller@redhat.com>
* core: add nm_device_can_auto_connect() functionThomas Haller2014-08-262-0/+32
| | | | Signed-off-by: Thomas Haller <thaller@redhat.com>
* libnm: add _nm_utils_slist_to_ptr_array()Thomas Haller2014-08-262-0/+29
| | | | Signed-off-by: Thomas Haller <thaller@redhat.com>
* cli: support connection.autoconnect-priority propertyThomas Haller2014-08-262-23/+35
| | | | Signed-off-by: Thomas Haller <thaller@redhat.com>
* cli: add nmc_property_set_int() functionThomas Haller2014-08-261-0/+20
| | | | Signed-off-by: Thomas Haller <thaller@redhat.com>
* cli: fix type when setting variadic argument in nmc_property_set_uint()Thomas Haller2014-08-261-1/+1
| | | | Signed-off-by: Thomas Haller <thaller@redhat.com>
* libnm: add NMSettingConnection:autoconnect-priority settingThomas Haller2014-08-253-0/+42
| | | | | | | | | | | | The autoconnect priority has (currently) only any relevance, if the connection is autoconnect too. The priority defaults to zero, with higher numbers meaning preferred. Currently we limit the range from [0,1000], but still set the type to int32. Later we might relax this restriction to allow for further use. Signed-off-by: Thomas Haller <thaller@redhat.com>
* glib-compat: fix compatibility wrapper for g_type_ensure()Thomas Haller2014-08-251-11/+12
| | | | | | | | | The previous implementaiton of the compatibility wrapper failed with clang when used inside a macro. This seems like a compiler error not to ignore the deprecation. Workaround by refactoring the g_type_ensure() wrapper. Signed-off-by: Thomas Haller <thaller@redhat.com>
* core: refactor nm_utils_complete_generic() not to use a dynamic format stringThomas Haller2014-08-2516-31/+39
| | | | | | | | For NMDeviceWifi and NMDeviceWimax, the printf format string for nm_utils_complete_generic() was created based on ssid/nsp. Since these input strings are untrusted, this is a serious bug. Signed-off-by: Thomas Haller <thaller@redhat.com>
* po: fix an error in a plural form of a Russian translation (bgo #735186)Jiří Klimeš2014-08-251-1/+1
| | | | | | | The error was produced by: msgfmt -vc ru.po https://bugzilla.gnome.org/show_bug.cgi?id=735186
* cli: simplify do_connections() now that we don't wait for "connection-read"Jiří Klimeš2014-08-221-129/+79
| | | | | | nm_remote_settings_list_connections() ensures the connections are loaded first. We check "help" commands before getting connections, because it is time intensive action.
* cli: fix 'nmcli connection' so that it returns correct exit codeJiří Klimeš2014-08-221-12/+2
| | | | | | | | It was broken by commit 57e802f3aa2aac8daba9a7a442a2393ab5888dba, which made nmcli always return success. For example: $ nmcli con add type blabla
* libnm-core: fix compile warning about unused-resultDan Winship2014-08-221-1/+1
|
* Merge branch 'th/bgo696936_normalize_settings'Thomas Haller2014-08-2245-605/+1700
|\ | | | | | | | | | | https://bugzilla.gnome.org/show_bug.cgi?id=696936 Signed-off-by: Thomas Haller <thaller@redhat.com>
| * libnm-util: properly disconnect "notify" signal for settings in NMConnectionThomas Haller2014-08-221-13/+19
| | | | | | | | | | | | | | | | | | | | When removing/replacing a NMSetting in an NMConnection, we have to disconnect setting_changed_cb() from the "notify" signal. Backport commit dfba4ce1e1c5bd0c1ae798bc538b5fab3e3faded from libnm-core. Signed-off-by: Thomas Haller <thaller@redhat.com>
| * libnm-core: fix NMSettingConnection:verify() not to modify interface-nameThomas Haller2014-08-226-118/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | 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-222-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 together 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-224-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>
| * libnm-core: make failure cases for nm_connection_normalize() more robust ↵Thomas Haller2014-08-221-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-228-0/+115
| | | | | | | | | | | | type and slave-type Signed-off-by: Thomas Haller <thaller@redhat.com>
| * tests: refactor tests to use g_test framework (g_test_add_func)Thomas Haller2014-08-222-135/+146
| | | | | | | | Signed-off-by: Thomas Haller <thaller@redhat.com>
| * core: add compatibility wrapper for g_test_add_data_func_full() to ↵Thomas Haller2014-08-221-0/+25
| | | | | | | | | | | | nm-glib-compat.h Signed-off-by: Thomas Haller <thaller@redhat.com>
| * keyfile/tests: add keyfile_read_connection_from_file() utility functionThomas Haller2014-08-221-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-221-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>
| * libnm-core: normalize NMSettingConnection:type propertyThomas Haller2014-08-225-13/+437
| | | | | | | | | | | | | | | | | | 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-221-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-221-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-2210-15/+273
| | | | | | | | | | | | | | | | | | | | 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-222-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-221-10/+17
| | | | | | | | | | | | | | 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-221-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-222-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-221-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-222-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-221-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-221-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-221-1/+131
| | | | | | | | Signed-off-by: Thomas Haller <thaller@redhat.com>
| * nmtst: add nmtst_assert_connection_equals() functionThomas Haller2014-08-221-0/+38
| | | | | | | | Signed-off-by: Thomas Haller <thaller@redhat.com>
| * nmtst: add nmtst_connection_normalize() functionThomas Haller2014-08-221-0/+65
| | | | | | | | Signed-off-by: Thomas Haller <thaller@redhat.com>
| * all: use _nm_utils_hash_values_to_slist()Thomas Haller2014-08-224-33/+12
| | | | | | | | Signed-off-by: Thomas Haller <thaller@redhat.com>
| * libnm-core: add _nm_utils_hash_values_to_slist()Thomas Haller2014-08-222-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-224-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-223-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-2215-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>