summaryrefslogtreecommitdiff
path: root/libnm
Commit message (Collapse)AuthorAgeFilesLines
* shared/tests: build "nm-utils/nm-vpn-plugin-utils.c"th/shared-bgo767697Thomas Haller2016-06-161-0/+24
| | | | For testing, add a build target to build those files too.
* shared: move shared files to subdirectory "shared/nm-utils/"Thomas Haller2016-06-161-1/+1
| | | | | | | | | | | | | The "shared" directory contains files that are possibly used by all components of NetworkManager repository. Some of these files are even copied as-is to other projects (VPN plugins, nm-applet) and used there without modification. Move those files to a separate directory. By moving them to a common directory, it is clearer that they belong together. Also, you can easier compare the copied versions to their original via $ diff -r ./shared/nm-utils/ /path/to/nm-vpn-plugin/shared/nm-utils/
* libnm/vpn: add nm_vpn_editor_plugin_load_vt()Thomas Haller2016-06-152-0/+9
| | | | | | | | | | Let VPN plugins return a virtual function table to extend the API while bypassing libnm. This allows to add and use new functionality to VPN plugins without updating libnm. The actual definitions are in a header-only file "nm-vpn-editor-plugin-call.h", which can be copied to the caller/plugin.
* libnm/vpn: pass NMVpnPluginInfo to the NMVpnEditorPlugin instanceThomas Haller2016-06-151-0/+2
| | | | | | | | | | | | | | | | | | | | | | | The NMVpnPluginInfo is essentially the .name file, that is, a configuration file about the plugin itself. Via NMVpnPluginInfo instance, the NMVpnEditorPlugin can be created. Usually, one would create a NMVpnPluginInfo (that is, reading the .name file) and then create a NMVpnEditorPlugin instance from there. In this case, usually the editor-plugin is owned by the plugin-info instance (although the API allows for creating the editor-plugin independently). Now, pass the NMVpnPluginInfo to the editor-plugin too. This is useful, because then the editor-plugin can look at the .name file. The .name file is not user configuration. Instead it is configuration about the plugin itself. Although the .name file is part of the plugin build artefacts, it is useful to allow the plugin to access the .name file. The reason is, that this can allow the user to easily change a configuration knob of the plugin without requiring to patch or the plugin.
* libnm/vpn: add nm_vpn_plugin_info_list_find_service_name() functionThomas Haller2016-06-151-0/+2
|
* libnm/vpn: add nm_vpn_plugin_info_get_aliasesThomas Haller2016-06-151-0/+1
|
* libnm: backport symbols nm_setting_ip_config_get_dns_priority to libnm_1_2_4Thomas Haller2016-06-101-0/+4
| | | | | | | | | Commit bdd0e7fec0a2af12331b815bfaf3de182ed6eebb which added symbol nm_setting_ip_config_get_dns_priority to libnm_1_4_0 was backported to nm-1-2 in commit ad1cdcf6571da23e3197b09f1b4b14d23b8899d1. Add the backported symbol to master to allow seemless upgrading from 1.2.4 to 1.4.0.
* build: add options to compile with address/undefined sanitizersBeniamino Galvani2016-06-031-3/+16
| | | | | | | This adds two new options to the configure scripts to compile NM, clients and libraries with the address and undefined-behavior sanitizers available in recent GCC versions. Clang is not supported at moment.
* all: move NM_AUTH_PERMISSION_* defines to "nm-common-macros.h" headerThomas Haller2016-06-011-14/+1
|
* manager: add Reload() D-Bus commandThomas Haller2016-06-012-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add new Reload D-Bus command to reload NetworkManager configuration. For now, this is like sending SIGHUP to the process. There are several advantages here: - it is guarded via PolicyKit authentication while signals can only be sent by root. - the user can wait for the reload to be complete instead of sending an asynchronous signal. For now, we operation completes after nm_config_reload() returns, but later we could delay the response further until specific parts are fully reloaded. - SIGHUP reloads everything including re-reading configuration from disk while SIGUSR1 reloads just certain parts such as writing out DNS configuration anew. Now, the Reload command has a flags argument which is more granular in selecting parts which are to be reloaded. For example, via signals the user can: 1) send SIGUSR1: this writes out the DNS configuration to resolv.conf and possibly reloads other parts without re-reading configuration and without restarting the DNS plugin. 2) send SIGHUP: this reloads configuration from disk, writes out resolv.conf and restarts the DNS plugin. There is no way, to only restart the DNS plugin without also reloading everything else.
* libnm: implement missing NM_AUTH_PERMISSION_SETTINGS_MODIFY_GLOBAL_DNSThomas Haller2016-06-012-1/+7
|
* libnm: export nm_setting_ip6_config_get_token() symbolBeniamino Galvani2016-05-301-0/+1
| | | | Fixes: 954d937b2f6bfe5a513497c6ea13d0651a0c0b16
* team: expose current device configuration through D-Bus and nmcliBeniamino Galvani2016-05-263-0/+44
| | | | | | | | Add a new "Config" property to the D-Bus interface for team devices and show its value through "nmcli device show". The property contains the full JSON configuration from teamd for the device. https://bugzilla.redhat.com/show_bug.cgi?id=1310435
* libnm-core: add dns-priority to NMSettingIPConfigBeniamino Galvani2016-05-121-0/+1
|
* docs: libnm: add doc comment to typesBeniamino Galvani2016-05-0536-1/+108
| | | | | | This is required to add objects in the "Types and Values" section and in the API index. Later, we may want to add useful content in those empty comments.
* libnm/vpn: add nm_vpn_plugin_info_new_search_file()Thomas Haller2016-04-221-0/+1
|
* libnm/vpn: add nm_vpn_plugin_info_supports_hints()Thomas Haller2016-04-221-0/+1
|
* libnm/vpn: add nm_vpn_plugin_info_get_auth_dialog()Thomas Haller2016-04-221-0/+1
|
* libnm/vpn: add nm_vpn_plugin_info_get_service()Thomas Haller2016-04-221-0/+1
| | | | | | | Re-add nm_vpn_plugin_info_get_service(). This function *is* useful and could be used by nm-applet. This reverts commit 3517084b92aa64817ce8cd82163e5ab6e1947017.
* libnm/vpn-service-plugin: don't register a bus name before creating the VPN ↵Lubomir Rintel2016-04-201-13/+13
| | | | | | | | | | object Otherwise NetworkManager can be too fast calling a method: <error> [1461073999.2362] vpn-connection[0x7fe39ec491e0,be049803-a705-438f-b8f5-49db87640c93,"libreswan",0]: plugin NeedSecrets request #1 failed: No such interface 'org.freedesktop.NetworkManager.VPN.Plugin' on object at path /org/freedesktop/NetworkManager/VPN/Plugin
* libnm/vpn: add nm_vpn_editor_plugin_load() functionThomas Haller2016-04-191-0/+5
| | | | | | Contrary to nm_vpn_editor_plugin_load_from_file(), this allows to specify a library name without path. In this case, g_module_open() (dlopen()) will search for a library in various system directories.
* libnm: use <> to include in public headerThomas Haller2016-04-131-1/+1
| | | | | | In a public header file ("nm-vpn-editor.h"), other public headers from NetworkManager must be included with <nm-vpn-editor-plugin.h> and not quotes.
* build: disable deprecation checks for internal compilationThomas Haller2016-04-052-3/+1
| | | | | | | | | | | | For internal compilation we want to be able to use deprecated API without warnings. Define the version min/max macros to effectively disable deprecation warnings. However, don't do it via CFLAGS option in the makefiles, instead hack it to "nm-default.h". After all, *every* source file that is for internal compilation needs to include this header as first.
* dbus: move NMWimaxNspNetworkType to nm-dbus-interface.hLubomir Rintel2016-04-051-16/+0
| | | | It's an enum used on D-Bus.
* libnm,libnm-core: add coverage supportBeniamino Galvani2016-03-291-1/+7
|
* libnm: don't check if the agent is still registered when unregisteringLubomir Rintel2016-03-291-8/+0
| | | | | | | | | | | | | | | | The name_owner_chagned() unregisters the agent if NetworkManager goes away and nmc_cleanup() also tries to unregister an agent, resulting in an assertion failure: # nmcli c up conn666 <daemon terminates> Error: Connection activation failed: Message recipient disconnected from message bus without replying (process:8746): libnm-CRITICAL **: nm_secret_agent_old_unregister: assertion 'priv->registered == TRUE' failed _internal_unregister() already contains a priv->registered check and raising an error on duplicate unregister attempt from a daemon after a restart is not a problem either, since nmc_cleanup() doesn't care about the error returned on teardown anyway.
* libnm: add code comments to hint that NMConnection might not validateThomas Haller2016-03-292-0/+18
|
* libnm: be more accepting for invalid connections from NetworkManagerThomas Haller2016-03-262-10/+5
| | | | | | | | | Relax our error checking which will allow us to try harder to make the best out of whatever NetworkManager sends us. Also, drop the g_warning(). First, now we really don't expect this function to fail. And even in that case, raising a g_warning() from the library is not very friendly to the user of libnm.
* libnm: accept invalid connections in NMVpnServicePluginThomas Haller2016-03-262-6/+6
| | | | | | | | | | | | | | | | | | | | When we receive a connection from NetworkManager it is not guaranteed that the connection verifies. For example, if the current libnm version is older then the NetworkManager version. Be more accepting and don't do any verification of the connection. For NMVpnPluginOld this change is uncritical, because there are probably no users of this API anyway. NMVpnServicePlugin is new API since nm-1-1. However, this API is already strongly used by all the plugins we ported over. So this change is affecting them. This should only matter if libnm's and NetworkManager's version differ, because NetworkManager just doesn't send out an invalid connection. It actually only matters if NetworkManager is a newer version and sends an invalid connection to the client. That is anyway badly tested and probably this changes rather improves compatibility than breaking existing users.
* libnm: accept invalid connections in NMSecretAgentOldThomas Haller2016-03-261-1/+2
| | | | | | | | | | | When we receive a connection from NetworkManager it is not guaranteed that the connection verifies. For example, if the current libnm version is older then the NetworkManager version. Be more accepting and don't do any verification of the connection. This is a change in behavior in that we accept also invalid connections and pass them down to the sub-classes.
* libnm: don't normalize connection for nm_device_get_applied_connection()Thomas Haller2016-03-261-2/+2
| | | | | | | | | | | Normalizing means that we fail on invalid connections. Which can happen when the server is newer than the libnm version. We just want to return whatever we can. The caller should make sense of this. This makes libnm more accepting and thus is not going to break existing applications. Also, nm_device_get_applied_connection() is new API since nm-1-1.
* libnm/tests: extend tests for handling invalid connections in NMClientThomas Haller2016-03-261-36/+143
|
* test-nm-client: fix the remaining counterLubomir Rintel2016-03-171-5/+6
| | | | | | | | | | | | | | | | We're expecting four callbacks: a client::devices change, client::active-connections change, client::activate callback, and a device::active-connection change. We only hook the second one in the callback to the first one, and only if client::active-connections is not set already. If it is (when running slowly in valgrind), we just decrement the counter. However, as the counter is one less than it should be, it would underflow and we wait forever* instead. For the value of forever=20s, given that's the timeout of the mockup service.
* libnm: declare internal function as staticThomas Haller2016-03-171-2/+2
|
* libnm-core: add domain-suffix-match properties to NMSetting8021xBeniamino Galvani2016-03-161-0/+2
| | | | | | | | | The new domain-suffix-match and phase2-domain-suffix-match properties can be used to match against a given server domain suffix in the dNSName elements or in the SubjectName CN of the server certificate. Also, add a comment to the old subject-match properties documentation to suggest that they are deprecated and should not be used anymore.
* nm-object: delay object property completion until the objects are initializedLubomir Rintel2016-03-141-45/+78
| | | | | | | | | | We don't want to update the properties until the objects referred are complete. Otherwise the clients get confused. Very confused: https://bugzilla.redhat.com/show_bug.cgi?id=1313866 We already delay the notification signals. Let's replace that with delaying the actual ObjectCreatedData processing instead.
* nm-object: don't leak the properties on changed signalsLubomir Rintel2016-03-081-1/+3
| | | | https://bugzilla.redhat.com/show_bug.cgi?id=1314976
* libnm: fix clearing real-devices in NMManager's free_devices()Thomas Haller2016-03-041-1/+1
| | | | Found by coverity.
* all: don't include error->code in log messagesThomas Haller2016-03-034-12/+10
| | | | | | | | | GError codes are only unique per domain, so logging the code without also indicating the domain is not helpful. And anyway, if the error messages are not distinctive enough to tell the whole story then we should fix the error messages. Based-on-patch-by: Dan Winship <danw@gnome.org>
* all: clean-up usage of GErrorThomas Haller2016-03-031-2/+2
| | | | | | | | | | | Functions that take a GError** MUST fill it in on error. There is no need to check whether error is NULL if the function it was passed to had a failing return value. Likewise, a proper GError must have a non-NULL message, so there's no need to double-check that either. Based-on-patch-by: Dan Winship <danw@gnome.org>
* libnm-glib/libnm/vpn: fix handling of ConnectInteractive() failure (rh #1298732)Dan Williams2016-03-022-10/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the plugin supports interactive mode, but the VPN binary (like vpnc or openvpn) doesn't support it, then the plugin should return NM_VPN_PLUGIN_ERROR_INTERACTIVE_NOT_SUPPORTED from its connect_interactive() hook. This lets NetworkManager know to fall back to plain Connect(). Since this notification is done through an error return, the VPN service plugin code sees the failure and moves the plugin state back to STOPPED. NetworkManager sees that state change, and terminates the connection attempt while waiting for a reply to the Connect() method. (VPN service plugins that don't support interactive mode at all don't have this problem because that error is returned before the plugin's state is moved to STARTING.) To fix this, do two things: 1) if the connect_interactive() hook fails and returns the error NM_VPN_PLUGIN_ERROR_INTERACTIVE_NOT_SUPPORTED, postpone the STOPPED state change for a few seconds to allow NM time to fall back to plain Connect(). We still want to move the plugin state back to STOPPED eventually, because otherwise it could stay in STARTING forever. 2) change state to STARTING only if the connect/connect_interactive plugin hooks were successful. Otherwise the plugin would still be in STARTING state, and it's not valid to call Connect()/ConnectInteractive() during the STARTING state. https://mail.gnome.org/archives/networkmanager-list/2016-February/msg00091.html https://bugzilla.redhat.com/show_bug.cgi?id=1298732
* libnm,core: fix syntax of 'transfer' annotationBeniamino Galvani2016-02-241-2/+2
|
* device: add new NMDeviceType NM_DEVICE_TYPE_VETHThomas Haller2016-02-231-0/+3
| | | | Based-on-patch-by: Jiří Klimeš <jklimes@redhat.com>
* libnm: add missing device types to get_type_name()Thomas Haller2016-02-231-2/+14
|
* all: cleanup includes and let "nm-default.h" include "config.h"Thomas Haller2016-02-1942-124/+100
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | - 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
* libnm,core,cli: move dhcp-timeout property to generic NMSettingIPConfigBeniamino Galvani2016-02-161-1/+1
| | | | | The property applies to both IPv4 and IPv6 and so it should not be in NMSettingIP4Config but in the base class.
* device: fix signature for @flags argument of impl_device_reapply()Thomas Haller2016-02-162-4/+4
| | | | | Thereby, also adjust the type for libnm's wrapper function -- as we already broke ABI.
* libnm: add nm_device_get_applied_connection() functionThomas Haller2016-02-163-0/+194
|
* all: add version-id argument to device's Reapply methodThomas Haller2016-02-162-2/+12
| | | | | | | | | | This breaks API and ABI for the functions related to Reapply, which got introduced in the current 1.1 development phase. The version-id is here to allow users to error out if the connection on the device was changed by a concurrent action. https://bugzilla.gnome.org/show_bug.cgi?id=761714
* wifi: don't touch by default current powersave settingBeniamino Galvani2016-02-161-0/+1
| | | | | | | | | | | | | | | | | | | | | Some drivers (or things outside NM like 'powertop') may turn powersave on, so don't touch it unless explicitly configured by user. To achieve this, add new 'default' and 'ignore' options; the former can be used to fall back to a globally configured setting, while the latter tells NM not to touch the current setting. When 'default' is specified, a missing global default configuration is equivalent to 'ignore'. It is possible to enable Wi-Fi power saving for all connections by dropping a file in /etc/NetworkManager/conf.d with the following content: [connection] wifi.powersave=3 https://bugzilla.gnome.org/show_bug.cgi?id=760125