summaryrefslogtreecommitdiff
path: root/libnm/nm-client.c
Commit message (Collapse)AuthorAgeFilesLines
* libnm/client: proxy *_enabled and metered properties to the right objectLubomir Rintel2017-11-021-4/+4
| | | | They're provided by the Manager, not by the RemoteSettings.
* libnm: add support for ovs-bridge devicesLubomir Rintel2017-10-301-0/+3
|
* libnm: add support for ovs-port devicesLubomir Rintel2017-10-301-0/+3
|
* libnm: add support for ovs-interface devicesLubomir Rintel2017-10-301-0/+3
|
* libnm: disconnect signal handlers from old object-managerBeniamino Galvani2017-09-051-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When NM is restarted and a new object-manager is created, ensure that signal handlers are disconnected from the old one. Fixes the following: assertion failed: (object_manager == priv->object_manager) #0 __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56 #1 __GI_abort () at abort.c:90 #2 g_assertion_message (domain=domain@entry=0x7fcac0b845ff "libnm", file=file@entry=0x7fcac0b84c95 "libnm/nm-client.c", line=line@entry=2506, func=func@entry=0x7fcac0b863a0 <__func__.34881> "name_owner_changed", message=message@entry=0x7fcac20b05f0 "assertion failed: (object_manager == priv->object_manager)") at gtestutils.c:2429 #3 g_assertion_message_expr (domain=domain@entry=0x7fcac0b845ff "libnm", file=file@entry=0x7fcac0b84c95 "libnm/nm-client.c", line=line@entry=2506, func=func@entry=0x7fcac0b863a0 <__func__.34881> "name_owner_changed", expr=expr@entry=0x7fcac0b856a0 "object_manager == priv->object_manager") at gtestutils.c:2444 #4 name_owner_changed (object=<optimized out>, pspec=<optimized out>, user_data=0x7fcac204e480) at libnm/nm-client.c:2506 #8 <emit signal notify:name-owner on instance 0x7fcac2053c60 [GDBusObjectManagerClient]> (instance=instance@entry=0x7fcac2053c60, signal_id=<optimized out>, detail=<optimized out>) at gsignal.c:3439 #5 g_closure_invoke (closure=0x7fcac20af390, return_value=return_value@entry=0x0, n_param_values=2, param_values=param_values@entry=0x7ffde58d9ec0, invocation_hint=invocation_hint@entry=0x7ffde58d9e60) at gclosure.c:801 #6 signal_emit_unlocked_R (node=node@entry=0x7fcac2052090, detail=detail@entry=185, instance=instance@entry=0x7fcac2053c60, emission_return=emission_return@entry=0x0, instance_and_params=instance_and_params@entry=0x7ffde58d9ec0) at gsignal.c:3627 #7 g_signal_emit_valist (instance=<optimized out>, signal_id=<optimized out>, detail=<optimized out>, var_args=var_args@entry=0x7ffde58da050) at gsignal.c:3383 #9 g_object_dispatch_properties_changed (object=0x7fcac2053c60 [GDBusObjectManagerClient], n_pspecs=<optimized out>, pspecs=<optimized out>) at gobject.c:1061 #10 g_object_notify (pspec=<optimized out>, object=0x7fcac2053c60 [GDBusObjectManagerClient]) at gobject.c:1155 #11 g_object_notify (object=object@entry=0x7fcac2053c60 [GDBusObjectManagerClient], property_name=property_name@entry=0x7fcabe9d2b29 "name-owner") at gobject.c:1202 #12 on_notify_g_name_owner (object=<optimized out>, pspec=<optimized out>, user_data=0x7fcac2053c60) at gdbusobjectmanagerclient.c:1262 #16 <emit signal notify:g-name-owner on instance 0x7fcaa8004440 [GDBusProxy]> (instance=instance@entry=0x7fcaa8004440, signal_id=<optimized out>, detail=<optimized out>) at gsignal.c:3439 #13 g_closure_invoke (closure=0x7fcaa80194f0, return_value=return_value@entry=0x0, n_param_values=2, param_values=param_values@entry=0x7ffde58da370, invocation_hint=invocation_hint@entry=0x7ffde58da310) at gclosure.c:801 #14 signal_emit_unlocked_R (node=node@entry=0x7fcac2052090, detail=detail@entry=299, instance=instance@entry=0x7fcaa8004440, emission_return=emission_return@entry=0x0, instance_and_params=instance_and_params@entry=0x7ffde58da370) at gsignal.c:3627 #15 g_signal_emit_valist (instance=<optimized out>, signal_id=<optimized out>, detail=<optimized out>, var_args=var_args@entry=0x7ffde58da500) at gsignal.c:3383 #17 g_object_dispatch_properties_changed (object=0x7fcaa8004440 [GDBusProxy], n_pspecs=<optimized out>, pspecs=<optimized out>) at gobject.c:1061 #18 g_object_notify (pspec=<optimized out>, object=0x7fcaa8004440 [GDBusProxy]) at gobject.c:1155 #19 g_object_notify (object=object@entry=0x7fcaa8004440 [GDBusProxy], property_name=property_name@entry=0x7fcabe9d2b27 "g-name-owner") at gobject.c:1202 #20 on_name_owner_changed (connection=<optimized out>, sender_name=<optimized out>, object_path=<optimized out>, interface_name=<optimized out>, signal_name=<optimized out>, parameters=<optimized out>, user_data=0x7fcaa8015b50) at gdbusproxy.c:1353 #21 emit_signal_instance_in_idle_cb (data=0x7fcaa40ff400) at gdbusconnection.c:3701 #22 g_main_context_dispatch (context=0x7fcac204eea0) at gmain.c:3152 #23 g_main_context_dispatch (context=context@entry=0x7fcac204eea0) at gmain.c:3767 #24 g_main_context_iterate (context=context@entry=0x7fcac204eea0, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at gmain.c:3838 #25 g_main_context_iteration (context=0x7fcac204eea0, context@entry=0x0, may_block=may_block@entry=1) at gmain.c:3899 #26 nmc_readline_helper (prompt=prompt@entry=0x7fcac2087f60 "The connection is not saved. Do you really want to quit? (yes/no) [no] ") at clients/cli/common.c:986 #27 nmc_readline (prompt_fmt=<optimized out>) at clients/cli/common.c:1055 #28 confirm_quit () at clients/cli/connections.c:6459 #29 do_connection_edit (connection_type=<optimized out>, connection=0x7fcac208eca0, nmc=0x7fcac12a3a60 <nm_cli>) at clients/cli/connections.c:7611 #30 do_connection_edit (nmc=0x7fcac12a3a60 <nm_cli>, argc=1, argv=0x7ffde58db0b0) at clients/cli/connections.c:7948 #31 call_cmd (nmc=0x7fcac12a3a60 <nm_cli>, simple=0x7fcac2052490 [GSimpleAsyncResult], cmd=0x7fcac1291ae0 <connection_cmds+128>, argc=2, argv=0x7ffde58db0a8) at clients/cli/common.c:1315 #32 got_client (source_object=<optimized out>, res=<optimized out>, user_data=0x7fcac2051830) at clients/cli/common.c:1297 #33 g_simple_async_result_complete (simple=0x7fcac2052500 [GSimpleAsyncResult]) at gsimpleasyncresult.c:801 #34 client_inited (source=0x7fcac204e480 [NMClient], result=0x7fcac20565f0, user_data=0x7fcac2052500) at libnm/nm-client.c:1839 #35 g_simple_async_result_complete (simple=0x7fcac20565f0 [GSimpleAsyncResult]) at gsimpleasyncresult.c:801 #36 init_async_complete (init_data=init_data@entry=0x7fcac2046820) at libnm/nm-client.c:2339 #37 async_inited_obj_nm (init_data=0x7fcac2046820) at libnm/nm-client.c:2337 #38 async_inited_obj_nm (object=0x7fcac2073080 [NMRemoteConnection], result=0x7fcac2089ed0, user_data=0x7fcac2046820) at libnm/nm-client.c:2357 #39 g_simple_async_result_complete (simple=0x7fcac2089ed0 [GSimpleAsyncResult]) at gsimpleasyncresult.c:801 #40 init_async_parent_inited (error=0x0, init_data=0x7fcaa408a0f0) at libnm/nm-remote-connection.c:677 #41 init_async_parent_inited (source=<optimized out>, result=<optimized out>, user_data=0x7fcaa408a0f0) at libnm/nm-remote-connection.c:689 #42 g_simple_async_result_complete (simple=0x7fcac2089c30 [GSimpleAsyncResult]) at gsimpleasyncresult.c:801 #43 complete_in_idle_cb (data=<optimized out>) at gsimpleasyncresult.c:813 #44 g_main_context_dispatch (context=0x7fcac204eea0) at gmain.c:3152 #45 g_main_context_dispatch (context=context@entry=0x7fcac204eea0) at gmain.c:3767 #46 g_main_context_iterate (context=0x7fcac204eea0, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at gmain.c:3838 #47 g_main_loop_run (loop=0x7fcac2045ab0) at gmain.c:4032 #48 main (argc=<optimized out>, argv=<optimized out>) at clients/cli/nmcli.c:642 https://bugzilla.redhat.com/show_bug.cgi?id=1471245
* libnm: add gtk-doc Since markers for new API and missing enum documentationThomas Haller2017-08-171-0/+10
|
* client: expose connectivity-check-{available,enabled} propertiesJames Henstridge2017-08-171-0/+93
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=785117
* device: add NMDevicePPPBeniamino Galvani2017-08-051-0/+3
| | | | | | The new device type represents a PPP interface, and will implement the activation of new-style PPPoE connections, i.e. the ones that don't claim the parent device.
* libnm: refactor name-owner check for object-managerThomas Haller2017-06-291-12/+14
|
* libnm: move check for pending_init to init_async_complete()Thomas Haller2017-06-291-4/+4
|
* libnm: fix leaking init_data in got_object_manager()Thomas Haller2017-06-291-1/+2
| | | | Only happens if there are no objects, which would be very unusual.
* libnm: assert in async_inited_obj_nm() for existing pending_init countThomas Haller2017-06-291-5/+5
|
* libnm/trivial: move codeThomas Haller2017-06-291-7/+7
|
* libnm: clear cancellable in new_object_manager() before emitting signalThomas Haller2017-06-291-1/+1
| | | | | Emitting signals may have side-effects. Just clear the cancellable first, it is handled for good.
* libnm: fix leaking cancellable in NMClient's name_owner_changed()Thomas Haller2017-06-291-2/+1
|
* libnm: fix getting self pointer in NMClient's new_object_manager()Thomas Haller2017-06-291-2/+3
|
* libnm: clear NMClientPrivate.object_manager in name_owner_changed()Thomas Haller2017-06-291-1/+3
| | | | Don't leave dangling pointers.
* Revert "libnm: don't use async constructor for GDBusObjectManager"Thomas Haller2017-06-291-24/+13
| | | | | | | | | | | | | | | Strangely, this breaks systemctl restart NetworkManager nmcli connection up "$NAME" It seems that with this change, libnm misses some events from D-Bus. It looks like there is something seriously broken. Before fixing it, revert the previous state. https://bugzilla.redhat.com/show_bug.cgi?id=1450075 This reverts commit 529d620a59f42e3f06bd4e7de5c817f175803c0d.
* Revert "libnm: refactor error handling in got_object_manager()"Thomas Haller2017-06-291-11/+15
| | | | This reverts commit c5370ea71a6c0686d5bffb7039d9053335384f20.
* libnm: refactor error handling in got_object_manager()Thomas Haller2017-06-191-15/+11
|
* libnm: don't use async constructor for GDBusObjectManagerThomas Haller2017-06-191-13/+24
| | | | | | | | | | | | | | | | | | | | | The current implementation of GDBusObjectManagerClient implements GAsyncInitableIface, however it simply runs GInitableIface's synchronous init on another thread. I suspect that there are races in the way that is implemented. For one, we see crashes and warnings (rh#1450075, rh#1457769, rh#1457223). Also, it seems very wrong to me, how GDBusObjectManagerClient mixes asynchronous signals (on_control_proxy_g_signal) with synchronously getting all objects (process_get_all_result, GetManagedObjects). I think we should ditch GDBusObjectManager altogether, including the gdbus-codegen skeletons. They add layers of code, for something that should be simple to do directly. For now, just don't do asynchronous initialization on another thread, so we at least avoid this kind of multithreadding issue. This may make the initialization of NMClient a bit slower.
* libnm: complete async result in got_object_manager() also when cancelledThomas Haller2017-06-191-4/+2
| | | | | Cancelling an operation shall not mean to not invoke the result callback. The result callback is *always* to be invoked.
* all/trivial: fix few comment typosFrancesco Giudici2017-05-151-1/+1
|
* libnm: fix showing UDEV properties for deviceThomas Haller2017-03-291-1/+1
| | | | | | | https://mail.gnome.org/archives/networkmanager-list/2017-March/msg00065.html Fixes: c7ccdf5fc893fd41f23349f298bf2c3ea383487a (cherry picked from commit c06308a10cb8e2192e5b8128776bc13f4450cb40)
* libnm/udev: cache and reuse udev instance for NMDeviceThomas Haller2017-03-221-3/+18
| | | | | | No need to create a separate NMUdevClient instance for all devices. Instead, have one "struct udev" instance in NMClient and pass it down during object construction.
* libnm/active-connection: track reason for state changesLubomir Rintel2017-03-171-0/+3
| | | | | | | | | Note that the reason tracking starts as soon as the object exists (which is immediately after GDBusObject is created), not when the asynchronous NMObject initialization finishes. That is so that we the reason changes in between are not lost. The vpn-connection should probably be doing the same.
* all: use nm_clear_g_cancellable()Thomas Haller2017-03-131-4/+1
|
* core: add support for dummy devicesBeniamino Galvani2017-02-221-0/+3
| | | | | | | Add support for creating dummy devices. This commit adds a D-Bus interface 'org.freedesktop.NetworkManager.Device.Dummy' which is used primarily for determining the device type but does not carry any properties.
* all: use NM_CACHED_QUARK_FCN() to define cached quarksThomas Haller2017-02-101-9/+1
|
* core,libnm: introduce NMDeviceMacsecBeniamino Galvani2017-01-161-0/+3
| | | | | At the moment the device only exposes the current link status, but cannot create new links.
* libnm: implement support for DNS manager propertiesBeniamino Galvani2016-12-121-0/+199
|
* all: rename the introspection data to use the interface paths in namesLubomir Rintel2016-11-231-6/+6
| | | | | | | | This makes it easier to install the files with proper names. Also, it makes the makefile rules slightly simpler. Lastly, the documentation is now generated into docs/api, which makes it possible to get rid of the awkward relative file names in docbook.
* libnm/client: do not autostart the serviceLubomir Rintel2016-11-161-2/+2
| | | | | | | | | Apparently, the client is used by the services we depend on (firewalld), and an attempt to start the service would deadlock them. This was an accidental change anyway. Related firewalld change: https://github.com/t-woerner/firewalld/pull/171
* libnm/client: unref all the objects on disposeLubomir Rintel2016-11-141-0/+8
| | | | We created them, we own them.
* libnm/client: drop some unneeded includesLubomir Rintel2016-11-101-24/+1
|
* libnm: use the o.fd.DBus.ObjectManager API for object managementlr/object-managerLubomir Rintel2016-11-101-51/+644
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This speeds up the initial object tree load significantly. Also, it reduces the object management complexity by shifting the duties to GDBusObjectManager. The lifetime of all NMObjects is now managed by the NMClient via the object manager. The NMClient creates the NMObjects for GDBus objects, triggers the initialization and serves as an object registry (replaces the nm-cache). The ObjectManager uses the o.fd.DBus.ObjectManager API to learn of the object creation, removal and property changes. It takes care of the property changes so that we don't have to and lets us always see a consistent object state. Thus at the time we learn of a new object we already know its properties. The NMObject unfortunately can't be made synchronously initializable as the NMRemoteConnection's settings are not managed with standard o.fd.DBus Properties and ObjectManager APIs and thus are not known to the ObjectManager. Thus most of the asynchronous object property changing code in nm-object.c is preserved. The objects notify the properties that reference them of their initialization in from their init_finish() methods, thus the asynchronously created objects are not allowed to fail creation (or the dependees would wait forever). Not a problem -- if a connection can't get its Settings, it's either invisible or being removed (presumably we'd learn of the removal from the object manager soon). The NMObjects can't be created by the object manager itself, since we can't determine the resulting object type in proxy_type() yet (we can't tell from the name and can't access the interface list). Therefore the GDBusObject is coupled with a NMObject later on. Lastly, now that all the objects are managed by the object manager, the NMRemoteSettings and NMManager go away when the daemon is stopped. The complexity of dealing with calls to NMClient that would require any of the resources that these objects manage (connection or device lists, etc.) had to be moved to NMClient. The bright side is that his allows for removal all of the daemon presence tracking from NMObject.
* libnm: move backported symbols from libnm-core to libnmThomas Haller2016-10-131-0/+47
| | | | | | | | | | Backported symbols only make sense for libnm itself, not for libnm-core which is statically linked with NetworkManager and nm-ifcace-helper. Declaring the symbols in libnm-core, means that NetworkManager binary also contains them, although there are not used. Move them to libnm.
* all: modify line separator comments to be 80 chars wideThomas Haller2016-10-031-9/+9
| | | | sed 's#^/\*\{5\}\*\+/$#/*****************************************************************************/#' $(git grep -l '\*\{5\}' | grep '\.[hc]$') -i
* libnm: fix introspection annotations for nm_client_load_connections()Beniamino Galvani2016-08-041-4/+4
| | | | | | | | | Add the "(array zero-terminated=1)" GLib introspection annotation when the parameter is a NULL-terminated string array. https://mail.gnome.org/archives/networkmanager-list/2016-August/msg00017.html Reported-by: Petr Horacek <phoracek@redhat.com>
* libnm/client: emit signals when active connection disappearsLubomir Rintel2016-07-071-0/+52
| | | | It allows us to reliably track failures to activate a connection.
* libnm: add code comments to hint that NMConnection might not validateThomas Haller2016-03-291-0/+12
|
* all: cleanup includes and let "nm-default.h" include "config.h"Thomas Haller2016-02-191-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | - 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/libnm-glib: add NMClient.get_all_devices() method and AllDevices propertyDan Williams2015-12-041-3/+107
| | | | | Mirror new NetworkManager API to return both real devices and device placeholders.
* libnm: fix the callback in g_simple_async_result_new()Jiří Klimeš2015-08-211-1/+1
|
* all: make use of new header file "nm-default.h"Thomas Haller2015-08-051-1/+1
|
* all: rename nm-glib-compat.h to nm-glib.h, use everywhereDan Winship2015-07-241-1/+1
| | | | | | | | | | | | | | | | Rather than randomly including one or more of <glib.h>, <glib-object.h>, and <gio/gio.h> everywhere (and forgetting to include "nm-glib-compat.h" most of the time), rename nm-glib-compat.h to nm-glib.h, include <gio/gio.h> from there, and then change all .c files in NM to include "nm-glib.h" rather than including the glib headers directly. (Public headers files still have to include the real glib headers, since nm-glib.h isn't installed...) Also, remove glib includes from header files that are already including a base object header file (which must itself already include the glib headers).
* nm-manager: add 'metered' propertyBeniamino Galvani2015-06-091-0/+16
| | | | | | This introduces a global metered property which makes easier for clients to obtain the metered status of the current primary connection.
* libnm,core: don't mix up enum typesLubomir Rintel2015-03-191-1/+1
| | | | Touches a weak spot on clang's soul.
* docs: misc small fixesDan Winship2014-12-181-3/+3
| | | | Cleans up all of the warnings that aren't overly annoying to clean up.
* libnm: remove nm_utils_init() from the public APIDan Winship2014-12-041-7/+0
| | | | | Remove nm_utils_init() from the public API, and just do it as a constructor instead.