summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* shared/compat: add compat for nm_setting_vpn_get_data_keys() and ↵th/vpn-secrets-bgo790655Thomas Haller2017-11-223-1/+91
| | | | nm_setting_vpn_get_secret_keys()
* shared: add nm-utils/nm-compat.hThomas Haller2017-11-223-0/+54
|
* libnm: cleanup NMSettingVpn's foreach functionsThomas Haller2017-11-221-19/+41
| | | | | | | | | | | | Previously, g_hash_table_get_keys() would already allocate a GList list, which then gets copied to another GSList. Don't do that. Just allocate one array to keep all the elements. Also, as we now use nm_setting_vpn_get_secret_keys() and nm_setting_vpn_get_data_keys(), note that the keys are sorted and hence the order is stable.
* libnm: add nm_setting_vpn_get_data_keys() and ↵Thomas Haller2017-11-223-0/+87
| | | | | | | | | | nm_setting_vpn_get_secret_keys() API It's rather limiting that the only API to access *all* keys is nm_setting_vpn_foreach_data_item() and nm_setting_vpn_foreach_secret(). API like nm_setting_vpn_get_num_secrets() is not useful, at least as long as you cannot access the item by index.
* clients: some cleanup of requesting VPN secretsThomas Haller2017-11-226-169/+179
|
* core/vpn: mark secret hints as constThomas Haller2017-11-225-18/+22
|
* libnm: use cleanup attribute in nm_vpn_service_plugin_read_vpn_details()Thomas Haller2017-11-221-16/+5
|
* libnm: use nm_free_secret()Thomas Haller2017-11-222-21/+2
|
* libnm: use stack allocated temporary string for property nameThomas Haller2017-11-222-35/+32
|
* platform: don't return zero from nmp_object_id_hash()Thomas Haller2017-11-221-1/+1
| | | | | | | There is no principle problem with returning zero has hash value. But just don't do it. Our hash functions should not return zero. Instead, return nm_hash_static(). This is why the function exists.
* platform: move nmp_object_equal() to header for inlineThomas Haller2017-11-222-7/+7
|
* shared: add nm_construct_name_a() macroThomas Haller2017-11-221-0/+22
|
* libnm: reuse implementation for NMVpnPluginOld's util functionsThomas Haller2017-11-221-120/+3
| | | | They are identical, and both public API. Merge.
* contrib: use less in NM-log to pre-process inputThomas Haller2017-11-211-2/+2
| | | | | | | GNU less supports filters. That makes it nice to use instead of cat. Also, less is well suited for output to a pipe. With this, `NM-log nm-log.txt.gz` works as you would expect
* libnm: merge branch 'th/bond-stable-strdict-order'Thomas Haller2017-11-216-73/+154
|\
| * libnm: cache lookup index for nm_setting_bond_get_option()Thomas Haller2017-11-211-15/+27
| |
| * libnm: stable order in _nm_utils_strdict_to_dbus()Thomas Haller2017-11-211-5/+33
| |
| * ifcfg-rh: avoid duplicate lookup of bond-option in write_bond_setting()Thomas Haller2017-11-211-10/+3
| | | | | | | | | | Now that nm_setting_bond_get_option() has a stable order (alphabetically), we no longer need to sort it.
| * libnm: sort entries in nm_setting_bond_get_option()Thomas Haller2017-11-211-11/+19
| | | | | | | | | | | | Since the order was arbitrary before, we can also sort it. Also rework it, to avoid the creating a temporary GList of keys.
| * libnm/trivial: reorder code in libnm-core/nm-setting-bond.cThomas Haller2017-11-211-45/+61
| |
| * shared: add NMUtilsNamedEntryThomas Haller2017-11-211-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It is common to have some data indexed by a name. If you want to sort a list of such data, you would have to re-implement your own compare function each time. Instead, add NMUtilsNamedEntry which as first field has the name. So, you can create your own struct: struct my_data { const char *name; ... other fields } and compare them with with nm_utils_named_entry_cmp(). For convenience, add another struct NMUtilsNamedValue, which has only one data field, a pointer.
| * ifcfg-rh/tests: test writing multiple bond optionsThomas Haller2017-11-212-1/+5
|/
* settings: preserve agent-owned secrets on connection addBeniamino Galvani2017-11-211-19/+32
| | | | | | | | | | | | Settings plugins now return the connection that was reread from file when adding a connection, which means that any agent-owned secret is lost. Ensure that we don't forget agent-owned secrets by caching them and readding them to the new connection returned by plugins. Fixes: 8a1d483ca867aa02a155bab934b19d74abac902c Fixes: b4594af55e0665917c48f0dd3cd56b49f2ea1f78 https://bugzilla.gnome.org/show_bug.cgi?id=789383
* ifcfg-rh: sort bond options when writing a connectionBeniamino Galvani2017-11-211-13/+14
| | | | | | | | | Bond options are stored in a hash table and the order in which they are returned by the API is not guaranteed. Sort them alphabetically so that a connection will always be written in the same way, even if the internal implementation of the hash table or the hashing function changes, as it did in commit a6be2f4aa907 ("all: use nm_str_hash() instead of g_str_hash()").
* cli: fix connection type completionBeniamino Galvani2017-11-201-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Don't show completion for all setting types but only for base ones. Before: $ nmcli connection add type <TAB> 802-11-olpc-mesh ethernet ppp 802-11-wireless generic pppoe 802-11-wireless-security gsm proxy 802-1x infiniband serial 802-3-ethernet ip-tunnel team adsl ipv4 team-port bluetooth ipv6 tun bond macsec user bridge macvlan vlan bridge-port olpc-mesh vpn cdma ovs-bridge vxlan connection ovs-interface wifi dcb ovs-patch wifi-sec dummy ovs-port wimax After: $ nmcli connection add type <TAB> 802-11-olpc-mesh cdma macsec team 802-11-wireless dummy macvlan tun 802-3-ethernet ethernet olpc-mesh vlan adsl generic ovs-bridge vpn bluetooth gsm ovs-interface vxlan bond infiniband ovs-port wifi bridge ip-tunnel pppoe wimax
* test: conditionally enable assertion macros depending on libnm versionThomas Haller2017-11-201-3/+2
| | | | | The test utility library "nm-utils/nm-test-utils.h" is also used by applet and VPN plugins. They may not yet use 1.10 API.
* keyfile: fix escaping ascii control characters in nm_keyfile_key_encode()Thomas Haller2017-11-202-1/+6
| | | | | | | | Matters when backslash escaping ascii charaters <= 0xF, to produce "\\XX" instead of "\\ X". For example tabulator is "\\09". This also can trigger an nm_assert() failure, when building with --with-more-asserts=5 (or higher).
* shared: add nm_auto_free_secret macroThomas Haller2017-11-201-0/+24
|
* device: check captured IPv6 configuration in check_and_add_ipv6ll_addr()Beniamino Galvani2017-11-201-2/+2
| | | | | | | | | | | | | | | | | check_and_add_ipv6ll_addr() checks whether a link-local address is already present in priv->ip6_config and if so, it returns with no action. priv->ip6_config is only updated after a merge-and-apply or (in an idle source) when the external configuration changes and so there is no guarantee that the addresses there are up-to-date. priv->ext_ip6_config_captured should be checked instead, because it is updated from platform right before starting the generation of a link-local address. Note that also linklocal6_start() already checks the captured external configuration rather than priv->ip6_config. https://bugzilla.redhat.com/show_bug.cgi?id=1500350
* dns: don't stat relative paths when detecting resolved useThomas Haller2017-11-191-1/+4
| | | | | | | | NetworkManager daemon has no defined working directory. It makes no sense to ever open or stat relative paths. Just skip them. https://bugzilla.gnome.org/show_bug.cgi?id=790446
* dns: check for relative paths and stub-resolve.conf when detecting ↵Dimitri John Ledkov2017-11-191-0/+5
| | | | | | | | | | | | systemd-resolved Fix resolved detection, the symlink target is usually relative to the root, such that in chroots the file points to a file inside the chroot. But keep absolute targets too, as these may have been in use with older version of systemd. Add support for stub-resolv.conf detection. https://bugzilla.gnome.org/show_bug.cgi?id=790446
* device: don't touch external devicesBeniamino Galvani2017-11-171-0/+6
| | | | | | | | If a device is 'external' (which means that NM generated an in-memory connection to only to track the device state) we should not change its IP configuration. https://bugzilla.redhat.com/show_bug.cgi?id=1512316
* device: start managing external devices on reapplyBeniamino Galvani2017-11-171-0/+3
| | | | | | | | | In the next commit we will modify ipX_config_merge_and_apply to never touch external devices. When a "reapply" call is issued on an external device we are no longer simply tracking its state but we are actively managing it and so its sys-iface-state must be promoted to managed. https://bugzilla.redhat.com/show_bug.cgi?id=1512316
* core/vpn: log capabilities of secret-agentThomas Haller2017-11-171-2/+11
|
* core: don't reset existing routes when merging IP settingBeniamino Galvani2017-11-172-4/+0
| | | | | | | | | | | Don't reset existing routes if ipvx.ignore-auto-routes=yes: callers should already avoid adding them when not needed. Previously we would also reset the manual gateway route just added. Fixes: 5c299454b49b165f645c25fd3e083c0bb747ad91 https://bugzilla.gnome.org/show_bug.cgi?id=790423
* vpn: avoid adding unneeded routes when ipvx.ignore-auto-routes=yesBeniamino Galvani2017-11-171-6/+10
| | | | | | Instead of adding routes and then let nm_ipx_config_merge_setting() remove them, don't add them in the first place when ipvx.ignore-auto-routes=yes.
* platform: merge branch 'th/platform-test-netns-bgo790214'Thomas Haller2017-11-172-2/+18
|\ | | | | | | https://bugzilla.gnome.org/show_bug.cgi?id=790214
| * platform/tests: skip netns tests if we fail to create a new NMPNetns instanceth/platform-test-netns-bgo790214Thomas Haller2017-11-161-2/+13
| | | | | | | | | | | | | | | | | | nmp_netns_new () might fail with: netns: failed mount --make-rslave: Invalid argument Skip the test in that case. https://bugzilla.gnome.org/show_bug.cgi?id=790214
| * platform: preserve errno when creating netns failsThomas Haller2017-11-161-0/+5
|/
* build: fix link failure of src/tests/test-systemd (2)Thomas Haller2017-11-161-3/+1
| | | | | | | Actually, test-systemd only needs siphash24.c, not the other parts. Fixes: ac95f7da0bdf46f1ebce6ef3d5afa4beeec094d8
* build: fix link failure of src/tests/test-systemdThomas Haller2017-11-161-0/+2
| | | | Fixes: ac95f7da0bdf46f1ebce6ef3d5afa4beeec094d8
* all: merge branch 'th/nm-hash-all'Thomas Haller2017-11-1650-116/+156
|\ | | | | | | https://github.com/NetworkManager/NetworkManager/pull/36
| * build: include "siphash24.c" source in "nm-hash-utils.c"Thomas Haller2017-11-162-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This allows the compiler to inline the siphash24*() functions for nm_hash_ptr() and nm_hash_str() (even without LTO). This of course only applies to nm_hash_ptr() and nm_hash_str(), which are implemented in "nm-hash-utils.c" itself. All other nm_hash_*() functions are inline functions in "nm-hash-utils.h", and thus these functions can be inlined instead. That is, in other cases, the nm_hash_*() function instead can be inlined. For nm_hash_ptr() and nm_hash_str() instead we want to inline the siphash24*() functions. So, no longer compile "siphash24.c" directly. Instead, only build "nm-hash-utils.c" which internally #include "siphash24.c".
| * all: use nm_str_hash() instead of g_str_hash()Thomas Haller2017-11-1616-29/+29
| | | | | | | | | | | | We also do this for libnm and libnm-core, where it causes visible changes in behavior. But if somebody would rely on the hashing implementation for hash tables, it would be seriously flawed.
| * all: use nm_direct_hash() instead of g_direct_hash()Thomas Haller2017-11-1621-28/+28
| | | | | | | | | | | | We also do this for libnm, where it causes visible changes in behavior. But if somebody would rely on the hashing implementation for hash tables, it would be seriously flawed.
| * all: don't use g_direct_equal() for hash table equality functionThomas Haller2017-11-1614-19/+19
| | | | | | | | | | | | | | | | | | | | GHashTable optimizes a NULL equality function to use direct pointer comparison. That saves the overhead of calling g_direct_equal(). This is also documented behavior for g_hash_table_new(). While at it, also don't pass g_direct_hash() but use the default of %NULL. The behavior is the same, but consistently don't use g_direct_hash().
| * all: include "nm-utils/nm-hash-utils.h" by defaultThomas Haller2017-11-1614-19/+4
| | | | | | | | | | | | | | | | | | Next we will use siphash24() instead of the glib version g_direct_hash() or g_str_hash(). Hence, the "nm-utils/nm-hash-utils.h" header becomes very fundamental and will be needed basically everywhere. Instead of requiring the users to include them, let it be included via "nm-default.h" header.
| * shared: use siphash24() for nm_hash_ptr()Thomas Haller2017-11-162-9/+10
| | | | | | | | | | | | siphash24() mixes the bits much better then our naive xor. Don't bypass siphash24(). We supposedly use it for the better hashing properties, so use it also for pointers.
| * shared: optimize nm_hash_str() for NULL to not use siphash24()Thomas Haller2017-11-162-5/+8
| |
| * shared: inline fast-path for hash _get_hash_key()Thomas Haller2017-11-161-2/+13
| |