1. 01 Feb, 2019 2 commits
    • Thomas Haller's avatar
      wifi-p2p: rename Wi-Fi P2P · 09090f26
      Thomas Haller authored
      After renaming the files, also rename all the content
      to follow the "Wi-Fi P2P" naming scheme.
      09090f26
    • Thomas Haller's avatar
      wifi-p2p: rename files for consistent Wi-Fi P2P naming · 0420fa1f
      Thomas Haller authored
      We named the types inconsistently:
      
        - "p2p-wireless" ("libnm-core/nm-setting-p2p-wireless.h")
      
        - "p2p" ("libnm/nm-p2p-peer.h")
      
        - "p2p-wifi" ("src/devices/wifi/nm-device-p2p-wifi.h")
      
      It seems to me, "libnm/nm-p2p-peer.h" should be qualified with a "Wi-Fi"
      specific name. It's not just peer-to-peer, it's Wi-Fi P2P.
      Yes, there is an inconsistency now, because there is already
      "libnm/nm-access-point.h".
      
      It seems to me (from looking at the internet), that the name "Wi-Fi P2P"
      is more common than "P2P Wi-Fi" -- although both are used. There is also
      the name "Wi-Fi Direct". But it's not clear which name should be
      preferred here, so stick to "Wi-Fi P2P".
      
      In this first commit only rename the files. The following commit will
      rename the content.
      0420fa1f
  2. 27 Jan, 2019 2 commits
  3. 14 Jan, 2019 1 commit
    • Thomas Haller's avatar
      all: return output dictionary from "AddAndActivate2" · fbb038af
      Thomas Haller authored
      Add a "a{sv}" output argument to "AddAndActivate2" D-Bus API.
      "AddAndActivate2" replaces "AddAndActivate" with more options.
      It also has a dictionary argument to be forward compatible so that we
      hopefully won't need an "AddAndActivate3". However, it lacked a similar
      output dictionary. Add it for future extensibility. I think this is
      really to workaround a shortcoming of D-Bus, which does provide strong
      typing and type information about its API, but does not allow to extend
      an existing API in a backward compatible manner. So we either resort to
      Method(), Method2(), Method3() variants, or a catch-all variant with a
      generic "a{sv}" input/output argument.
      
      In libnm, rename "nm_client_add_and_activate_connection_options()" to
      "nm_client_add_and_activate_connection2()". I think libnm API should have
      an obvious correspondence with D-Bus API. Or stated differently, if
      "AddAndActivateOptions" would be a better name, then the D-Bus API should
      be renamed. We should prefer one name over the other, but regardless
      of which is preferred, the naming for D-Bus and libnm API should
      correspond.
      
      In this case, I do think that AddAndActivate2() is a better name than
      AddAndActivateOptions(). Hence I rename the libnm API.
      
      Also, unless necessary, let libnm still call "AddAndActivate" instead of
      "AddAndActivate2". Our backward compatibility works the way that libnm
      requires a server version at least as new as itself. As such, libnm
      theoretically could assume that server version is new enough to support
      "AddAndActivate2" and could always use the more powerful variant.
      However, we don't need to break compatibility intentionally and for
      little gain. Here, it's easy to let libnm also handle old server API, by
      continuing to use "AddAndActivate" for nm_client_add_and_activate_connection().
      Note that during package update, we don't restart the currently running
      NetworkManager instance. In such a scenario, it can easily happen that
      nmcli/libnm is newer than the server version. Let's try a bit harder
      to not break that.
      
      Changes as discussed in [1].
      
      [1] !37 (comment 79876)
      fbb038af
  4. 19 Nov, 2018 2 commits
    • Thomas Haller's avatar
      all: rename "bind" option for AddAndActivateConnection2 to "bind-activation" · 7420ae83
      Thomas Haller authored
      "bind" specifically binds the lifetime of the activation (NMActiveConnection).
      In combination with "persist=volatile", the lifetime of the NMSettingsConnection
      is indirectly bound to the NMActiveConnection. But still these concepts make sense
      independently.
      In the future, it may make sense to also bind the lifetime of the NMSettingsConnection
      to the D-Bus client. Hence, rename the option to allow for the distinction.
      
      Also, belatedly fix libnm comment about "bind" only working with
      "persist" "volatile".
      
      Fixes: eb883e34
      7420ae83
    • Thomas Haller's avatar
      libnm: drop "_async" suffix from nm_client_add_and_activate_connection_options() · 26eaca89
      Thomas Haller authored
      Synchronous D-Bus calls seems harmful to me, such API should not be
      added to libnm. As such, all API is by default and preferably "_async".
      
      Don't add an "_async" suffix. While we are not consistent in libnm about
      this, I think for new code we should.
      26eaca89
  5. 17 Nov, 2018 1 commit
  6. 19 Oct, 2018 1 commit
  7. 17 Sep, 2018 1 commit
  8. 06 Aug, 2018 1 commit
  9. 11 Jul, 2018 1 commit
    • Thomas Haller's avatar
      all: don't use gchar/gshort/gint/glong but C types · e1c7a2b5
      Thomas Haller authored
      We commonly don't use the glib typedefs for char/short/int/long,
      but their C types directly.
      
          $ git grep '\<g\(char\|short\|int\|long\|float\|double\)\>' | wc -l
          587
          $ git grep '\<\(char\|short\|int\|long\|float\|double\)\>' | wc -l
          21114
      
      One could argue that using the glib typedefs is preferable in
      public API (of our glib based libnm library) or where it clearly
      is related to glib, like during
      
        g_object_set (obj, PROPERTY, (gint) value, NULL);
      
      However, that argument does not seem strong, because in practice we don't
      follow that argument today, and seldomly use the glib typedefs.
      Also, the style guide for this would be hard to formalize, because
      "using them where clearly related to a glib" is a very loose suggestion.
      
      Also note that glib typedefs will always just be typedefs of the
      underlying C types. There is no danger of glib changing the meaning
      of these typedefs (because that would be a major API break of glib).
      
      A simple style guide is instead: don't use these typedefs.
      
      No manual actions, I only ran the bash script:
      
        FILES=($(git ls-files '*.[hc]'))
        sed -i \
            -e 's/\<g\(char\|short\|int\|long\|float\|double\)\>\( [^ ]\)/\1\2/g' \
            -e 's/\<g\(char\|short\|int\|long\|float\|double\)\>  /\1   /g' \
            -e 's/\<g\(char\|short\|int\|long\|float\|double\)\>/\1/g' \
            "${FILES[@]}"
      e1c7a2b5
  10. 26 Jun, 2018 2 commits
  11. 11 May, 2018 1 commit
    • Thomas Haller's avatar
      clients/tests: add python test script for nmcli tests · d4093a3a
      Thomas Haller authored
      Add a test which runs nmcli against our stub NetworkManager
      service and compares the output.
      
      The output formats of nmcli are complicated and not easily understood.
      For example how --mode tabular|multiline interacts with selecting
      output-fields (--fields) and output modes ([default]|--terse|--pretty).
      Also, there are things like `nmcli connection show --order $FIELD_SPEC`.
      
      We need unit tests to ensure that we don't change the output
      accidentally.
      d4093a3a
  12. 30 Apr, 2018 1 commit
  13. 04 Apr, 2018 2 commits
    • Thomas Haller's avatar
      libnm: rework checkpoint API · 735dc41b
      Thomas Haller authored
      The libnm API fir checkpoints was only introduced with 1.11. It
      is not yet stable, so there is still time to adjust it. Note that
      this changes API/ABI of the development branch.
      
      Changes:
      
      - we only add async variants of the checkpoint functions. I believe
        that synchronous D-Bus methods are fundamentally flawed, because
        they mess up the ordering of events.
        Rename the async functions by removing the "_async" suffix. This
        matches glib style, for which the async form is also not specially
        marked.
      
      - for function that refere to a particular checkpoint (rollback and
        destroy), accept the D-Bus path as string, instead of an NMCheckpoint
        instance. This form is more flexible, because it allows to use
        the function without having a NMCheckpoint instance at hand. On the
        other hand, if one has a NMCheckpoint instance, he can trivially
        obtain the path to make the call.
      735dc41b
    • Thomas Haller's avatar
      checkpoint: allow resetting the rollback timeout via D-Bus · f6730322
      Thomas Haller authored
      This allows to adjust the timeout of an existing checkpoint.
      
      The main usecase of checkpoints, is to have a fail-safe when
      configuring the network remotely. By allowing to reset the timeout,
      the user can perform a series of actions, and keep bumping the
      timeout. That way, the entire series is still guarded by the same
      checkpoint, but the user can start with short timeout, and
      re-adjust the timeout as he goes along.
      
      The libnm API only implements the async form (at least for now).
      Sync methods are fundamentally wrong with D-Bus, and it's probably
      not needed. Also, follow glib convenction, where the async form
      doesn't have the _async name suffix. Also, accept a D-Bus path
      as argument, not a NMCheckpoint instance. The libnm API should
      not be more restricted than the underlying D-Bus API. It would
      be cumbersome to require the user to lookup the NMCheckpoint
      instance first, especially since libnm doesn't provide an efficient
      or convenient lookup-by-path method. On the other hand, retrieving
      the path from a NMCheckpoint instance is always possible.
      f6730322
  14. 26 Mar, 2018 1 commit
  15. 08 Mar, 2018 1 commit
    • Benjamin Berg's avatar
      Add calls to g_simple_async_result_set_check_cancellable · 26c215e2
      Benjamin Berg authored
      If an operation is cancelled through the GCancellable, then the idiom is
      that the operation is always cancelled, even if it has finished
      successfully. To ensure this is the case, add calls to
      g_simple_async_result_set_check_cancellable everywhere.
      
      Without this, e.g. gnome-control-center will crash when switching away
      from the power panel quickly, as the NMClient creation finishes
      asynchronously and g-c-c assume that G_IO_ERROR_CANCELLED is returned to
      ensure it doesn't access the now invalid user_data parameter.
      
      https://bugzilla.gnome.org/show_bug.cgi?id=794088
      26c215e2
  16. 17 Jan, 2018 1 commit
  17. 09 Nov, 2017 1 commit
  18. 02 Nov, 2017 1 commit
  19. 30 Oct, 2017 3 commits
  20. 05 Sep, 2017 1 commit
    • Beniamino Galvani's avatar
      libnm: disconnect signal handlers from old object-manager · 7758071c
      Beniamino Galvani authored
      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
      7758071c
  21. 17 Aug, 2017 2 commits
  22. 05 Aug, 2017 1 commit
    • Beniamino Galvani's avatar
      device: add NMDevicePPP · df72cad1
      Beniamino Galvani authored
      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.
      df72cad1
  23. 29 Jun, 2017 10 commits