Commit graph

13045 commits

Author SHA1 Message Date
Jiří Klimeš 9f1e9913b9 man: document that vpn.timeout property supports a default value 2015-09-21 16:59:04 +02:00
Jiří Klimeš bbc7725218 vpn: use vpn.timeout property as timeout value for IP config (bgo #754754)
Some VPN services may take their time when establishing a connection. Let's
make our timeout configurable to be able to give such services a chance.

https://mail.gnome.org/archives/networkmanager-list/2015-April/msg00007.html

https://bugzilla.gnome.org/show_bug.cgi?id=754754
2015-09-21 16:59:04 +02:00
Jiří Klimeš 431cc8a517 cli: support vpn.timeout property in nmcli 2015-09-21 16:59:04 +02:00
Jiří Klimeš ffe16c958f libnm-core: add vpn.timeout property for establishing connections
[1] https://mail.gnome.org/archives/networkmanager-list/2015-April/msg00007.html
2015-09-21 16:59:04 +02:00
Thomas Haller 5d36910d16 device: log the flags that are set/cleared in _set_unmanaged_flags()
Don't show only the flags that are set/cleared *in addition*.
2015-09-21 16:24:41 +02:00
Jiří Klimeš e9f9f4ecb9 merge: fix ADSL in nmcli and libnm-core/libnm-utils (rh #1264089)
- implements 'nmcli connection add type adsl'
- initializes adsl.protocol for 'nmcli con edit type adsl'
- fixes errors in adsl properties in libnm-core/libnm-util
2015-09-21 15:32:25 +02:00
Jiří Klimeš 290c1626b9 cli: allow creating ADSL connections with 'nmcli connection add' (rh #1264089)
https://bugzilla.redhat.com/show_bug.cgi?id=1264089
2015-09-21 15:21:51 +02:00
Jiří Klimeš 5502d8691a cli: initialize adsl.protocol in editor when creating a new connection
The protocol is required and it is nice to have a valid initial value for
the property.
2015-09-21 15:21:51 +02:00
Jiří Klimeš 3d64d45d16 libnm-core/libnm-util: fix an assertion in adsl setting
(process:7799): GLib-CRITICAL **: g_ascii_strdown: assertion 'str != NULL' failed
2015-09-21 15:21:50 +02:00
Beniamino Galvani 5221180a20 core: fix crash in NMManager message filter
g_dbus_message_get_interface() can return NULL in the message filter,
for example when the client does:

  #!/usr/bin/env python
  import dbus
  bus = dbus.SystemBus()
  proxy = bus.get_object("org.freedesktop.NetworkManager",
                         "/org/freedesktop/NetworkManager")
  proxy.foobar()

Use g_strcmp0() to compare the interface and member names.

Fixes: 34ba4e14b8
2015-09-21 14:49:03 +02:00
Jiří Klimeš 73d2bd53c5 device: remove unused ip_iface 2015-09-21 09:09:36 +02:00
Jiří Klimeš 3b11b85753 wifi: remove unused variables 2015-09-21 09:04:35 +02:00
Thomas Haller 45f682e222 exported-object: explicitly disconnect bindings and signal handlers to GDBusInterfaceSkeleton interfaces
While an NMExportedObject is exported (i.e. registered at NMBusManager),
it has a list of GDBusInterfaceSkeleton interfaces. The properties of
the nm-object are bound to the interfaces and the signals connected.

Previously, when unexporting the NMExportedObject, we would only unref
the interfaces, but not explicitly disconnect. As there is no guarantee
that the lifetime of the interfaces is shorter then the lifetime of the
nm-object, hence, explicitly disconnect.
2015-09-18 18:01:55 +02:00
Thomas Haller 24dc78957f core: merge branch 'lr/applied-connection-bgo724041'
https://bugzilla.gnome.org/show_bug.cgi?id=724041
2015-09-18 17:39:33 +02:00
Lubomir Rintel 06da353242 core: separate active and applied connection
Clone the connection upon activation. This makes it safe for the user
to modify the original connection while it is activated.

This involves several changes:

- NMActiveConnection gets @settings_connection and @applied_connection.
  To support add-and-activate, we constructing a NMActiveConnection with
  no connection set. Previously, we would set the "connection" field to
  a temporary NMConnection. Now NMManager piggybacks this temporary
  connection as object-data (TAG_ACTIVE_CONNETION_ADD_AND_ACTIVATE).

- get rid of the functions nm_active_connection_get_connection_type()
  and nm_active_connection_get_connection_uuid(). From their names
  it is unclear whether this returns the settings or applied connection.
  The (few) callers should figure that out themselves.

- rename nm_active_connection_get_id() to
  nm_active_connection_get_settings_connection_id(). This function
  is only used internally for logging.

- dispatcher calls now get two connections as well. The
  applied-connection is used for the connection data, while
  the settings-connection is used for the connection path.

- needs special handling for properties that apply immediately
  when changed (nm_device_reapply_settings_immediately()).

Co-Authored-By: Thomas Haller <thaller@redhat.com>

https://bugzilla.gnome.org/show_bug.cgi?id=724041
2015-09-18 17:32:11 +02:00
Thomas Haller c9b3617c35 libnm: mark properties that take effect immediately on active connection (REAPPLY_IMMEDIATELY)
The flag is still unused.
2015-09-18 17:31:51 +02:00
Thomas Haller b1ebbf4c80 libnm: use NM_FLAGS_HAS() in nm_setting_compare() 2015-09-18 16:37:48 +02:00
Thomas Haller d5716eed59 secrets: make agent-manager independent from NMSettingsConnection
NMSecretAgent (and in turn NMAgentManager) used the @connection argument both
for the connection data, but also for the connection path. Detangle these, and
accept the path separate from the connection.

This makes NMSecretAgent and NMAgentManager truly operate on a plain
NMConnection, without the non-obvious requirement, that the path of the
connection must be set.
2015-09-18 16:12:36 +02:00
Thomas Haller 80a7b41613 vpn-connection: refactor cancellation of secrets 2015-09-18 16:12:36 +02:00
Thomas Haller 674f778c41 settings: use nm_settings_connection_get_id/uuid() utils 2015-09-18 16:12:36 +02:00
Thomas Haller 1036cab5b4 settings: add nm_settings_connection_get_id/uuid() utils 2015-09-18 16:12:36 +02:00
Thomas Haller af180da625 libnm: don't assert in nm_connection_get_*() for verified connection
Those getters are convenience methods to retrieve the id/type from
the NMSettingConnection. If the NMSettingConnection was missing
(and thus the connection invalid) we would raise an assertion.

Don't be so strict and just silently return NULL.
Otherwise, the caller cannot use the functions on unverified
connections.
2015-09-18 16:12:36 +02:00
Lubomir Rintel f589c66b12 audit-manager: don't log connection whose addition fails
In AddAndActivate the uuid and id make no sense until authorization succeeds
and the connection is saved.
2015-09-18 16:12:36 +02:00
Thomas Haller b5a6883c10 vpn-connection: use logging macros _LOG*()
This now gives every logging line of a NMVpnConnection
a fully descriptive prefix.

Especially for non-debug logging, this looks a bit verbose
and repetitive, so we could suppress the prefix in that case.
I still add it because I think the verbose information does help
during debugging.
2015-09-18 16:12:36 +02:00
Thomas Haller 72c85c29a7 vpn-connection: add logging macros _LOG*() 2015-09-18 16:12:36 +02:00
Thomas Haller d48ed98eb3 vpn-connection/trivial: consistently rename @connection argument to @self 2015-09-18 16:12:36 +02:00
Thomas Haller 6006a0b134 core/manager: use active_connection_get_by_path() in impl_manager_deactivate_connection() 2015-09-18 16:12:36 +02:00
Thomas Haller 31deca0157 libnm: fix missing case in "nm-remote-connection.c"
Fixes: d20bed069c
2015-09-18 16:11:47 +02:00
Jiří Klimeš d20bed069c libnm: fix initializing of new connections
connection_added() can be called before init_get_settings_cb(), and we can't
complete the connection until it is visible, else it would be uninitialized.

Test case:
* have 'em1' interface
$ nmcli con add type ethernet con-name myeth ifname em1 autoconnect no
(process:9039): libnm-CRITICAL **: nm_connection_get_id: assertion 's_con != NULL' failed
Connection '(null)' ((null)) successfully added.

$ nmcli con add type ethernet con-name myeth ifname em1X autoconnect no
Connection 'myeth' (71159504-c2af-4773-8ca9-a3626aa0da33) successfully added.

https://bugzilla.gnome.org/show_bug.cgi?id=754767
https://bugzilla.gnome.org/show_bug.cgi?id=754794

[lkundrak@v3.sk: This is not quite the correct fix, we shouldn't emit
NMObject:connection-added for an unfinished object. Nevertheless, let's go with
it until we have a better one. Will revert this afterwards. See linked bugs.]
2015-09-18 15:54:39 +02:00
Thomas Haller 6c989bb68f core: merge branch 'th/secret-requests-bgo754508'
https://bugzilla.gnome.org/show_bug.cgi?id=754508
2015-09-18 14:31:31 +02:00
Thomas Haller 1b5664fed4 agent-manager: always invoke complete function for asynchronous nm_agent_manager_get_secrets()
Refactor agent-manager to always invoke the complete function for
nm_agent_manager_get_secrets().

In general, the complete function is always invoked asnychronously
when starting the operation. On the other hand, when cancelling the
operation or disposing the manager with pending operations, we now
(always) synchronously invoke the callback.

This makes it simpler for the user to reliably cancel the request
and perform potential cleanup.

This behavior bubbles up through NMSettingsConnection and NMActRequest,
and other callers that make directly or indicrectly make use of
nm_agent_manager_get_secrets().
2015-09-18 14:31:31 +02:00
Thomas Haller afb37d706f secret-agent/trivial: add code comment 2015-09-18 14:31:31 +02:00
Thomas Haller 21fd5fa0ab settings: refactor call_id type of async functions for NMAgentManager, NMSettingsConnection and NMActRequest
Instead of having the call_id of type guint32, make it an (opaque)
pointer type.

This has the advantage of strong typing and avoids the possiblity
of reusing an invalid integer (or overflow of the call-id counter).

OTOH, it has the disadvantage, that after a call_id is disposed,
it might be reused for future invocations (because malloc might
reuse the memory).

In fact, it is always an error to use a call_id that is already
completed. This commit also adds assertions to the cancel() calls
that the provided call_id is a pending call. Hence, such a bug
will be uncovered by assertions (that only might not tigger in
certain unlikely cases where a call-id got reused).

Note that for NMAgentManager, save_secrets() and delete_secrets()
both returned a call_id. But they didn't also provide a callback when
the operation completes. So the user trying to cancel such a call,
cannot know whether the operation is still in process and he cannot
avoid triggering an assertion.
Fix that by not returning a call-id for these operations. No caller
cared about it anyway.

For NMSettingsConnection, also track the internally scheduled requests
for so that we can cancel them on dispose.
2015-09-18 14:31:31 +02:00
Thomas Haller 40eda71dc6 agent-manager: fix type of idle_id in Request structure 2015-09-18 14:31:31 +02:00
Thomas Haller 7a8eee99ff agent-manager/refact: return early from _con_get_try_complete_early() instead of if-else-if 2015-09-18 14:31:31 +02:00
Thomas Haller 0205dc9f5a agent-manager/trivial: rename functions 2015-09-18 14:31:31 +02:00
Thomas Haller 4ccae95802 agent-manager/refact: replace get_start() by request_start()
Let all implementations call request_start(), instead of
getting-secrets doing something special and call get_start().
2015-09-18 14:31:31 +02:00
Thomas Haller ea57ecc8ee agent-manager/refact: replace function callbacks by direct calls or inline
Drop the function pointers. Instead either inline them or
call them explicitly (possibly after switching on the request_type).
2015-09-18 14:31:31 +02:00
Thomas Haller 745d501859 agent-manager/refact: merge the subclasses into Request
Merge ConnectionRequest structure into Request.
2015-09-18 14:31:31 +02:00
Thomas Haller 55d672347f core/trivial: add code comment to nm_utils_get_shared_wifi_permission() 2015-09-18 14:31:31 +02:00
Thomas Haller 9e3d3083d2 auth-utils: some refactoring in nm-auth-utils.c
- move nm_auth_chain_check_done() and nm_auth_chain_remove_call()
  into the only caller auth_call_complete().

- take a ref of the "context" argument.

- in nm_auth_chain_add_call(), assert that we didn't yet invoke the
  done-callback. The auth-chain should not be reusued.

- use slice allocator for ChainData, AuthCall and NMAuthChain
2015-09-18 14:31:31 +02:00
Lubomir Rintel d7614d0bda gitignore: ignore GDBus generated glue 2015-09-18 13:53:30 +02:00
Thomas Haller b6459ace2f platform: merge branch 'th/platform-permanent-hwaddr-rh1264024'
https://bugzilla.redhat.com/show_bug.cgi?id=1264024
Related: https://bugzilla.redhat.com/show_bug.cgi?id=1256430
2015-09-18 13:32:31 +02:00
Thomas Haller 2733aacd64 platform: don't accept 00:00:00:00:00:00 as valid permanent address
In nmp_utils_ethtool_get_permanent_address(), don' accept a permanent
address of all zeros.

https://bugzilla.redhat.com/show_bug.cgi?id=1264024
2015-09-18 13:29:34 +02:00
Thomas Haller 2e66aea123 platform: stack-allocate request data for nmp_utils_ethtool_get_permanent_address() 2015-09-18 13:29:34 +02:00
Thomas Haller 3a68039232 all: merge branch 'lr/default-unmanaged-bgo746566'
Make the "managed" property of devices mutable via D-Bus.
Also, add a `nmcli device set` command.

https://bugzilla.gnome.org/show_bug.cgi?id=746566
2015-09-18 13:19:53 +02:00
Thomas Haller aeaf31b7a8 device/trivial: rename nm_device_get_unmanaged_flag() to nm_device_get_unmanaged()
This way, the function matches the other names like nm_device_set_unmanaged().
Arguably, the name currently makes some sense. But future commits will make
nm_device_get_unmanaged() more to be a counterpart of nm_device_set_unmanaged().
2015-09-18 13:18:05 +02:00
Thomas Haller ef4aa6c555 device/trivial: rename nm_device_set_initial_unmanaged_flag() to nm_device_set_unmanaged_initial()
That way, the name matches better with related functions named
nm_device_set_unmanaged*()
2015-09-18 13:14:44 +02:00
Thomas Haller 7405d5c7b7 nmcli: extend nmcli device set command to accept explicit ifname specifier
Without it, you cannot set the properties of a device named "help".
Now you can with:

  $ nmcli device set ifname help autoconnect no
2015-09-18 13:14:44 +02:00
Lubomir Rintel 4dffbf8f6a cli: add nmcli device set command
Co-Authored-By: Thomas Haller <thaller@redhat.com>
2015-09-18 13:14:35 +02:00