Commit graph

438 commits

Author SHA1 Message Date
Beniamino Galvani f97ffea82e libnm: export nm_setting_ip6_config_get_token() symbol
Fixes: 954d937b2f
2016-05-30 18:27:21 +02:00
Beniamino Galvani 3c649e6429 team: expose current device configuration through D-Bus and nmcli
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
2016-05-26 09:16:46 +02:00
Beniamino Galvani bdd0e7fec0 libnm-core: add dns-priority to NMSettingIPConfig 2016-05-12 17:13:50 +02:00
Beniamino Galvani f1d23c32c3 docs: libnm: add doc comment to types
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.
2016-05-05 17:01:57 +02:00
Thomas Haller 4271c9650c libnm/vpn: add nm_vpn_plugin_info_new_search_file() 2016-04-22 14:17:02 +02:00
Thomas Haller 67415f0c5e libnm/vpn: add nm_vpn_plugin_info_supports_hints() 2016-04-22 14:17:02 +02:00
Thomas Haller a3f94f451b libnm/vpn: add nm_vpn_plugin_info_get_auth_dialog() 2016-04-22 14:17:02 +02:00
Thomas Haller 0d95ed3bb8 libnm/vpn: add nm_vpn_plugin_info_get_service()
Re-add nm_vpn_plugin_info_get_service(). This function *is* useful
and could be used by nm-applet.

This reverts commit 3517084b92.
2016-04-22 14:17:02 +02:00
Lubomir Rintel 843a05f7cc libnm/vpn-service-plugin: don't register a bus name before creating the VPN 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
2016-04-20 10:50:08 +02:00
Thomas Haller e00eac2981 libnm/vpn: add nm_vpn_editor_plugin_load() function
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.
2016-04-19 13:47:42 +02:00
Thomas Haller d0ed5f83ce libnm: use <> to include in public header
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.
2016-04-13 19:20:52 +02:00
Thomas Haller 9152dec99f build: disable deprecation checks for internal compilation
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.
2016-04-05 22:22:58 +02:00
Lubomir Rintel 2c3c83370b dbus: move NMWimaxNspNetworkType to nm-dbus-interface.h
It's an enum used on D-Bus.
2016-04-05 14:37:51 +02:00
Beniamino Galvani 5f7d7ee497 libnm,libnm-core: add coverage support 2016-03-29 18:10:04 +02:00
Lubomir Rintel 0684632936 libnm: don't check if the agent is still registered when unregistering
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.
2016-03-29 15:08:19 +02:00
Thomas Haller 52bd08de05 libnm: add code comments to hint that NMConnection might not validate 2016-03-29 11:56:27 +02:00
Thomas Haller 4aa7e09d1f libnm: be more accepting for invalid connections from NetworkManager
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.
2016-03-26 12:10:54 +01:00
Thomas Haller 559ab7bd7c libnm: accept invalid connections in NMVpnServicePlugin
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.
2016-03-26 12:10:54 +01:00
Thomas Haller 9a31bbcbc3 libnm: accept invalid connections in NMSecretAgentOld
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.
2016-03-26 12:10:54 +01:00
Thomas Haller a37c1d1e17 libnm: don't normalize connection for nm_device_get_applied_connection()
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.
2016-03-26 12:10:54 +01:00
Thomas Haller c5786f3839 libnm/tests: extend tests for handling invalid connections in NMClient 2016-03-26 12:10:53 +01:00
Lubomir Rintel 84c42aac1b test-nm-client: fix the remaining counter
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.
2016-03-17 17:37:06 +01:00
Thomas Haller 2778d257cc libnm: declare internal function as static 2016-03-17 11:32:53 +01:00
Beniamino Galvani 64b76ba906 libnm-core: add domain-suffix-match properties to NMSetting8021x
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.
2016-03-16 17:32:17 +01:00
Lubomir Rintel ad8251e3a4 nm-object: delay object property completion until the objects are initialized
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.
2016-03-14 16:32:44 +01:00
Lubomir Rintel bb35883235 nm-object: don't leak the properties on changed signals
https://bugzilla.redhat.com/show_bug.cgi?id=1314976
2016-03-08 16:02:27 +01:00
Thomas Haller e4af0f6767 libnm: fix clearing real-devices in NMManager's free_devices()
Found by coverity.
2016-03-04 08:56:38 +01:00
Thomas Haller cd4f84b738 all: don't include error->code in log messages
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>
2016-03-03 18:54:20 +01:00
Thomas Haller 01b9b4104c all: clean-up usage of GError
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>
2016-03-03 18:54:20 +01:00
Dan Williams abc700c5c7 libnm-glib/libnm/vpn: fix handling of ConnectInteractive() failure (rh #1298732)
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
2016-03-02 11:27:17 +01:00
Beniamino Galvani 22b3494de6 libnm,core: fix syntax of 'transfer' annotation 2016-02-24 17:23:01 +01:00
Thomas Haller 1b00009169 device: add new NMDeviceType NM_DEVICE_TYPE_VETH
Based-on-patch-by: Jiří Klimeš <jklimes@redhat.com>
2016-02-23 23:15:37 +01:00
Thomas Haller 26718e989e libnm: add missing device types to get_type_name() 2016-02-23 23:15:37 +01:00
Thomas Haller 8bace23beb all: cleanup includes and let "nm-default.h" include "config.h"
- 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
2016-02-19 17:53:25 +01:00
Beniamino Galvani 206e074863 libnm,core,cli: move dhcp-timeout property to generic NMSettingIPConfig
The property applies to both IPv4 and IPv6 and so it should not be in
NMSettingIP4Config but in the base class.
2016-02-16 11:37:26 +01:00
Thomas Haller 54dc789314 device: fix signature for @flags argument of impl_device_reapply()
Thereby, also adjust the type for libnm's wrapper function -- as
we already broke ABI.
2016-02-16 11:24:49 +01:00
Thomas Haller 4bd45b9458 libnm: add nm_device_get_applied_connection() function 2016-02-16 11:24:49 +01:00
Thomas Haller 6898e2169e all: add version-id argument to device's Reapply method
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
2016-02-16 11:24:49 +01:00
Beniamino Galvani 10b222288e wifi: don't touch by default current powersave setting
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
2016-02-16 00:18:06 +01:00
Thomas Haller 2c2d9d2e4c build: cleanup default includes
- "gsystem-local-alloc.h" and <gio/gio.h> are already included via
  "nm-default.h". No need to include them separately.

- include "nm-macros-internal.h" via "nm-default.h" and drop all
  explict includes.

- in the modified files, ensure that we always include "config.h"
  and "nm-default.h" first. As second, include the header file
  for the current source file (if applicable). Then follow external
  includes and finally internal nm includes.

- include nm headers inside source code files with quotes

- internal header files don't need to include default headers.
  They can savely assume that "nm-default.h" is already included
  and with it glib, nm-glib.h, nm-macros-internal.h, etc.
2016-02-12 15:36:01 +01:00
Lubomir Rintel 061edeaea6 vpn-service-plugin: allow VPNs with no IP configuration
Perfectly fine for ethernet-bridged networks (openvpn with tap devices).
2016-01-28 11:50:15 +01:00
Thomas Haller fc7c333d84 libnm: include "nm-vpn-service-plugin.h" in "NetworkManager.h"
"nm-vpn-service-plugin.h" includes "nm-connection.h", so there is already no
way to use "nm-vpn-service-plugin.h" without also pulling in all "NetworkManager.h".

On the other hand, we might not include "nm-vpn-service-plugin.h" in
"NetworkManager.h" to keep the overall headers small (by default).
But let's just include it too. We already opted for convenience
over small-include by having one top-level header file.
2016-01-27 17:20:09 +01:00
Thomas Haller 5170d3a760 tests: move common dbus test-runners to tools/ directory 2016-01-22 16:52:41 +01:00
Michael Biebl a9bd5dce1c tests: use dbus-run-session instead of dbus-launch
The dbus-run-session utility was designed to run a process within a
D-Bus session, specifically for running regressions tests and is much
better suited then dbus-launch. As an additional benefit, this avoids
any X dependencies.

https://mail.gnome.org/archives/networkmanager-list/2016-January/msg00023.html
2016-01-22 16:52:41 +01:00
Dan Williams 3254965067 libnm,tests: fix error leak 2016-01-21 11:31:31 -06:00
Dan Williams ec1185d6dd libnm: remove erroneous nm_manager_get_all_devices()
None of the libnm NMManager functions are exported, as they are only
used internally.

Fixes: 4db851f852
2016-01-20 12:27:05 -06:00
Dan Williams 3b3f108dfd docs, trivial: fix some documentation issues 2016-01-20 11:27:22 -06:00
Dan Williams d59c1d4c8a libnm,vpn: restore export of deprecated NMVpnPluginOld symbols
Deprecated of course, but shouldn't have been removed from the ABI.

Fixes: 867227dd4a
2016-01-20 11:26:49 -06:00
Jiří Klimeš 31ea5a99cb libnm: add NMSettingIPConfig 'dad-timeout' property
The property is used to control duplicate address detection:
 * -1 means default value
 * 0 means no DAD is performed
 * > 0 means timeout (in milliseconds) for arping responses

[bgalvani: moved setting from NMSettingIP4Config]
2016-01-20 11:53:47 +01:00
Beniamino Galvani 9b94d33232 libnm: add versioning comments and macros to nm_device_reapply*()
Fixes: 278fd4fb0f
2016-01-12 09:51:44 +01:00
Beniamino Galvani 59dc2eb29a libnm: keep symbols sorted in libnm.ver 2016-01-12 09:51:41 +01:00
Lubomir Rintel 278fd4fb0f libnm: add nm_device_reapply()
Client support for O.FD.NM.Device.Reapply().
2016-01-10 23:13:34 +01:00
Beniamino Galvani fbd3286955 core,libnm: use nm_clear_g_source() where possible
Replacement was done with commands:

spatch --sp-file nm_clear_g_source.cocci --in-place --smpl-spacing --dir src
spatch --sp-file nm_clear_g_source.cocci --in-place --smpl-spacing --dir libnm

where nm_clear_g_source.cocci contains:

@@
expression e;
@@
- if (e) {
-    g_source_remove (e);
-    e = 0;
- }
+ nm_clear_g_source (&e);
2016-01-06 21:25:55 +01:00
Thomas Haller 92f122525d libnm/tests: add tests for libnm handling invalid connections
Add test showing how libnm/libnm-glib handles invalid connections,
i.e. connections that fail nm_connection_verify(). libnm implements
settings a static types (via different NMSetting types). This makes
it unavoidable that eventually a newer server version will
expose connections that fail verification in the client.

For example, master added a new base type NMSettingTun. This setting type
was not backported to legacy libnm-glib, thus such connection will not verify.
Also, we want that newer server versions are backward compatible with older
library versions. Thus also a pre-NMSettingTun libnm version has the same
problem.

The test shows that libnm is agnostic to whether the connection verifies.
That is consistent behavior, but possibly problematic because most
accessors to connections assert against a valid connection. Thus using
the common nm_connection*() functions on an invalid connection can lead
to problems.
Also, due to the static nature of our NMSetting types, some properties
can be silently dropped and thus mangling the connection without the
library user noticing.

libnm-glib prints a g_warning() whenever parsing an invalid connection.
When an invalid connection is added initially, it is exposed to the library
user. When a connection gets later invalidated due to an update, the
connection disappears and it stays missing even if a subsequent update
makes the connection valid again.

libnm-glib's behavior indicates that we might wanted to hide invalid
connections from the user. But it's very broken there.
2015-12-26 19:09:11 +01:00
Thomas Haller db80ec05ab build: rename directory "include" to "shared"
Up to now, the "include" directory contained (only) header files that were
used project-wide by libs, core, clients, et al.

Since the directory now also contains a non-header file, the "include"
name is misleading. Instead of adding yet another directory that is
project-wide, with non-header-only content, rename the "include"
directory to "shared".
2015-12-24 11:42:37 +01:00
Thomas Haller bc06dd9332 libnm/tests: rename test functions to follow common pattern
Like the test utility functions in nm-test-utils.h and
platform's common.h, rename the helper functions to have
a nmtst(c) prefix.
2015-12-24 11:42:37 +01:00
Thomas Haller fa3093e167 libnm/tests: move common testing code to nm-test-libnm-utils
The unit tests for libnm and libnm-glib use a NetworkManager stub
service written in Python (test-networkmanager-service.py). As they
share the same server, it makes sense to also share the same utility
code to drive the stub.

Move the common code to include/.

Note that contrary to "nm-test-utils.h", "nm-test-libnm-utils.h" is not
a header-only file. Instead its implementation is in "nm-test-utils-impl.c".
The reason for that this split is, if we later have yet another non-header-only
test-utility, then all the implementations are in "nm-test-utils-impl.c", requiring
the tests to link only one object file.
2015-12-24 11:42:37 +01:00
Thomas Haller 70713ee197 libnm/tests: unify common test code for libnm and libnm-glib
Unify the common test code to drive the D-Bus stub service
test-networkmanager-service.py. They will be merged in the next
commit.
2015-12-24 11:42:36 +01:00
Beniamino Galvani 1ff712d5d0 ip-tunnel: add a MTU property
Add a new ip-tunnel.mtu property which can be used to change the MTU
of the tunnel interface.
2015-12-19 12:06:33 +01:00
Beniamino Galvani d6a0b2c28f libnm: add NMDeviceVxlan 2015-12-09 16:36:46 +01:00
Beniamino Galvani 95dfd99afc libnm-core: add NMSettingVxlan
Add a new NMSettingVxlan which describes properties of VXLAN
connections.
2015-12-09 16:36:46 +01:00
Beniamino Galvani f841f17882 libnm: add NMDeviceMacvlan 2015-12-09 14:30:08 +01:00
Beniamino Galvani 4d0192e661 libnm-core: add NMSettingMacvlan
The setting contains properties that are specific to macvlans and
macvtaps.
2015-12-09 14:30:08 +01:00
Jiří Klimeš 20e750a3c3 libnm: fix description of NMDeviceIPTunnel:input-key property
Fixes: e2da055f90
2015-12-09 13:33:17 +01:00
Jiří Klimeš 1a48e5d918 libnm: fix indenting in libnm/nm-device-ip-tunnel.c
Fixes: e2da055f90
2015-12-09 13:29:02 +01:00
Lubomir Rintel 08fe8392c7 libnm,device: don't notify of property change when getting vendor & product from udev
I have no idea what was the purpose, however this causes an infinite loop if
udev has not product & vendor and the notify handler gets the property.
2015-12-05 12:05:17 +01:00
Lubomir Rintel 45c5e7626a libnm,nm-object: only send "notify" signal when the object property actually changed 2015-12-05 12:05:17 +01:00
Dan Williams 4db851f852 libnm/libnm-glib: add NMClient.get_all_devices() method and AllDevices property
Mirror new NetworkManager API to return both real devices and
device placeholders.
2015-12-04 12:16:41 +01:00
Dan Williams deb6c5f714 libnm-glib/libnm: add support for "real" NMDevice property 2015-12-04 12:15:12 +01:00
Beniamino Galvani e2da055f90 libnm: add NMDeviceIPTunnel 2015-12-01 17:39:41 +01:00
Beniamino Galvani ae8c7a8967 libnm-core: add NMSettingIPTunnel
Add a generic NMSettingTunnel which describes properties of tunnels
over IPv4 and IPv6 (GRE, SIT, IPIP, IPIP6, IP6GRE, etc.). Since those
tunnel types all have similar properties it makes sense to have a
single setting type for them.
2015-12-01 17:39:40 +01:00
Beniamino Galvani 13a981fc38 libnm-core: add nm_utils_enum_get_values()
Add function nm_utils_enum_get_values() which returns a string array
containing the enum values. It can be used, for example, to build a
list of allowed values for user.
2015-12-01 17:39:40 +01:00
Lubomir Rintel 604711488d libnm: avoid loosing signals
D-Bus has an upper limit on number of Match rules and it's rather easy
to hit as the proxy likes to add one for each object. Let's remove the Match
rule the proxy added and ensure a less granular rule is present instead.

Ideally, we should be able to tell glib not to hook its rules.
Related: https://bugzilla.gnome.org/show_bug.cgi?id=758749

https://bugzilla.gnome.org/show_bug.cgi?id=758751
2015-12-01 14:51:13 +01:00
Beniamino Galvani 337304f19d libnm: add NMDeviceTun 2015-11-25 11:39:57 +01:00
Beniamino Galvani 1f30147a7a libnm-core: add NMSettingTun
Add a new NMSettingTun which contains configuration properties for TUN/TAP
interfaces.
2015-11-25 11:39:57 +01:00
Beniamino Galvani cb40194532 libnm-core: add a 'dhcp-fqdn' property to NMSettingIP4Config
The property contains the fully qualified domain name to be sent to
DHCP server using the FQDN option. The property is mutually exclusive
with 'dhcp-hostname'.
2015-11-23 16:31:52 +01:00
Jiří Klimeš b41b32cb7b libnm: add nm_setting_verify_secrets() and nm_connection_verify_secrets()
for verifying the secrets, because it is not done in plain nm_setting_verify().

For simple verification of free-form string secrets,
_nm_setting_verify_secret_string() helper is used.
2015-11-20 10:35:10 +01:00
Dan Williams 4b412218e6 libnm/wwan: add GSM setting device-id, sim-id, and sim-operator-id properties
These properties limit whether the connection applies to a certain WWAN modem
based on the modem's device ID or SIM ID (as reported by the WWAN management
service), or through the MCC/MNC ID of the operator that issued the SIM card.
2015-11-18 15:50:52 +01:00
Dan Williams 0222822134 libnm: add Wi-Fi MAC address randomization property 2015-11-18 15:37:42 +01:00
Lubomir Rintel 2146c60996 libnm: stop using the private socket 2015-11-18 15:15:04 +01:00
Lubomir Rintel 42ee2e6792 vpn-service-plugin: correctly emit ip6-config signal on dbus skeleton 2015-11-13 16:13:40 +01:00
Thomas Haller 8d1233e67e python: use gi.require_version() in generate-setting-docs.py and examples
gi now emits a warning when not loading a specific library
version [1]:

  ./generate-setting-docs.py:21: PyGIWarning: NM was imported without specifying a version first. Use gi.require_version(NM, 1.0) before import to ensure that the right version gets loaded.
    from gi.repository import NM, GObject

Seems require_version() is reasonably old to just always use it without
breaking on older versions [2].

[1] Related: https://bugzilla.gnome.org/show_bug.cgi?id=727379
[2] https://git.gnome.org/browse/pygobject/commit/?id=76758efb6579752237a0dc4d56cf9518de6c6e55
2015-11-11 10:56:05 +01:00
Lubomir Rintel 60811b4809 setting-ip6-config: add addr-gen-mode property 2015-11-02 20:27:00 +01:00
Lubomir Rintel 3517084b92 vpn-plugin-info: drop nm_vpn_plugin_info_get_service()
It is not used externally and its use might be confusing and undesired when we
add plugin aliases. The external users should only use the name when idenfiying
the plugin and nm_vpn_plugin_info_list_find_by_service() when matchin the plugin.
2015-11-02 16:01:21 +01:00
Thomas Haller 204fcd33d8 macros: add nm_clear_g_cancellable() utility 2015-11-01 17:28:07 +01:00
Lubomir Rintel a5feb44a44 libnm,vpn-service-plugin: remove old connect timer when adding new one
If the plugin didn't succeed connecting once, don't let the old timer fire
during a subsequent connection.

https://bugzilla.redhat.com/show_bug.cgi?id=1271973
2015-10-23 18:24:45 +02:00
Beniamino Galvani 2f780dc1b5 libnm: define NMLldpNeighbor as boxed type
GLib introspection requires all types returned by public functions to
be GObjects, basic types or boxed types in order to correctly manage
resources. NMLldpNeighbor was a plain struct and GI complained with:

Warning: NM: nm_lldp_neighbor_new: return value: Invalid non-constant return of bare structure or union; register as boxed type or (skip)

To fix this define NMLldpNeighbor as a boxed type.

Fixes: d3d2b49400
2015-10-16 17:33:12 +02:00
Beniamino Galvani 1136de4221 libnm,libnm-core: fix GTK-Doc warnings 2015-10-16 17:33:12 +02:00
Lubomir Rintel 700061f270 libnm/vpn-service-plugin: leave the state property in place
It's part of the DBus API; the skeleton has it and we can't remove it.

This partially reverts commit fd61b21706.
2015-10-14 18:44:57 +02:00
Lubomir Rintel fd61b21706 libnm/vpn-service-plugin: remove nm_vpn_service_plugin_{get,set}_state()
The plugins set state only on failures and often forget to do that. Do the
correct status transition to STOPPED in nm_vpn_service_plugin_failure() instead.

The get_state() is only used to find out whether to fail or orderly disconnect
depending on whether we're STARTING or already STARTED. Handle that in
nm_vpn_service_plugin_disconnect() in a generic manner instead.
2015-10-13 18:20:55 +02:00
Lubomir Rintel 78f263a5fd libnm/vpn-service-plugin: quit when the peer we watch disconnects
We're of no use anymore as another user would start an instance with
a different bus name.
2015-10-13 18:20:55 +02:00
Lubomir Rintel 9f15abbda7 libnm/vpn-service-plugin: add watch-peer property
Make it possible to construct the plugin instance in a way that disconnects the
connection if the DBus client that activated it drops off the bus. This makes the
plugins conveniently clean up when NetworkManager crashes.

We need this, as with multiple VPN support we can loose track of the client bus
names when the daemon crashes leaving to nice way to clean up on respawn.

However, this behavior is not desired for debugging or hypotetical VPN plugin
users other than NetworkManager (say; "gdbus call -m o.fd.NM.VPN.Plugin.Connect").
Let the plugin decide when to use it.
2015-10-13 18:20:55 +02:00
Lubomir Rintel 1bb553798c libnm/vpn-service-plugin: add a missing return 2015-10-13 18:20:55 +02:00
Beniamino Galvani 83ac84cd7a libnm: document that some return values are immutable
Document that the GPtrArray returned by

  - nm_device_get_lldp_neighbors()
  - nm_ip_config_get_addresses()
  - nm_ip_config_get_routes()

is immutable and can be used by callers without the need of a copy.
2015-10-12 14:44:31 +02:00
Beniamino Galvani d3d2b49400 libnm: add LLDP support
Add functions to libnm for retrieving a list of LLDP neighbors and
accessor functions to get their attributes.
2015-10-12 14:44:31 +02:00
Beniamino Galvani c364ef0b97 libnm: add 'lldp' property to NMSettingConnection
Add the 'lldp' property to NMSettingConnection, which specifies
whether the reception and parsing of LLDP frames to discover neighbor
devices should be enabled.
2015-10-12 14:44:19 +02:00
Lubomir Rintel 3f0d595cc8 libnm,ip4-config: add ipv4.dhcp-timeout property
This is intentionally IPv4 specific since this is used for a quick fallback to
method=link-local -- something that's not needed for IPv6 since the link local
address is always there.

https://bugzilla.redhat.com/show_bug.cgi?id=1262922
2015-10-06 14:16:55 +02:00
Lubomir Rintel 8c9b791768 libnm: avoid notifying for objects until they're async-inited
Otherwise the uninitializeded objects could be prematurely signalled if their
paths are seen twice in quick succession. This happens when you have ethernet
hardware and add an ethernet connection -- it's immediatelly added to
AvialableConnections and the property reload signals the object addition
before the NMRemoteSettings's GetSettings() finishes:

  # nmcli c add type ethernet autoconnect no ifname '*'
  (process:4610): libnm-CRITICAL **: nm_connection_get_id: assertion 's_con != NULL' failed
  Connection '(null)' ((null)) successfully added.
  #

https://bugzilla.gnome.org/show_bug.cgi?id=754794
2015-10-06 14:10:55 +02:00
Lubomir Rintel 4691101517 Revert "libnm: fix initializing of new connections"
This reverts commit d20bed069c.
2015-10-06 14:10:32 +02:00
Thomas Haller 6b40108418 libnm: use nm_clear_g_source() in nm-object.c 2015-10-03 18:12:11 +02:00