1. 28 May, 2019 1 commit
  2. 10 May, 2019 2 commits
    • Thomas Haller's avatar
      settings/d-bus: fix boolean return value of "LoadConnections" · 1337ebd9
      Thomas Haller authored
      The boolean value is intended to indicate success. It would indicated
      failure due to a bug.
      
      Fixes: 297d4985 ('core/dbus: rework D-Bus implementation to use lower layer GDBusConnection API'):
      (cherry picked from commit 22e830f0)
      (cherry picked from commit e73a5058)
      1337ebd9
    • Thomas Haller's avatar
      settings: avoid assertion for LoadConnections D-Bus method with relative paths · 8fe900d3
      Thomas Haller authored
        $ busctl call org.freedesktop.NetworkManager /org/freedesktop/NetworkManager/Settings org.freedesktop.NetworkManager.Settings LoadConnections as 1 relative/filename
      
      triggers a g_critical() assertion in nm_utils_file_is_in_path():
      
        ...
        #3  0x00007ffff7a19e7d in g_return_if_fail_warning
            (log_domain=log_domain@entry=0x55555586c333 "NetworkManager", pretty_function=pretty_function@entry=0x55555586c0a0 <__FUNCTION__.38585> "nm_utils_file_is_in_path", expression=expression@entry=0x55555586c010 "abs_filename && abs_filename[0] == '/'") at ../glib/gmessages.c:2767
        #4  0x00005555555f1128 in nm_utils_file_is_in_path (abs_filename=abs_filename@entry=0x555555b56670 "dfd", abs_path=<optimized out>) at src/NetworkManagerUtils.c:1077
        #5  0x00005555555a4779 in load_connection (config=<optimized out>, filename=0x555555b56670 "dfd") at src/settings/plugins/keyfile/nms-keyfile-plugin.c:522
        #6  0x00005555557ce291 in nm_settings_plugin_load_connection (self=0x5555559fd400 [NMSKeyfilePlugin], filename=0x555555b56670 "dfd") at src/settings/nm-settings-plugin.c:70
        #7  0x000055555559ccdf in impl_settings_load_connections
            (obj=<optimized out>, interface_info=<optimized out>, method_info=<optimized out>, connection=<optimized out>, sender=<optimized out>, invocation=0x7fffe0015ed0 [GDBusMethodInvocation], parameters=<optimized out>) at src/settings/nm-settings.c:1439
        #8  0x00005555555a9bf9 in dbus_vtable_method_call
            (connection=0x5555559b91b0 [GDBusConnection], sender=sender@entry=0x555555b5c360 ":1.32283", object_path=object_path@entry=0x7fffe0019070 "/org/freedesktop/NetworkManager/Settings", interface_name=<optimized out>, interface_name@entry=0x7fffe002aa70 "org.freedesktop.NetworkManager.Settings", method_name=<optimized out>,
            method_name@entry=0x7fffe00276b0 "LoadConnections", parameters=parameters@entry=0x555555c4a690, invocation=0x7fffe0015ed0 [GDBusMethodInvocation], user_data=0x5555559a1a00)
            at src/nm-dbus-manager.c:947
        #9  0x00007ffff7c506c4 in call_in_idle_cb (user_data=user_data@entry=0x7fffe0015ed0) at ../gio/gdbusconnection.c:4874
        #10 0x00007ffff7a0e8eb in g_idle_dispatch (source=source@entry=0x7fffe00208a0, callback=0x7ffff7c50590 <call_in_idle_cb>, user_data=0x7fffe0015ed0) at ../glib/gmain.c:5627
        #11 0x00007ffff7a11fd0 in g_main_dispatch (context=0x555555994d00) at ../glib/gmain.c:3189
        #12 0x00007ffff7a11fd0 in g_main_context_dispatch (context=context@entry=0x555555994d00) at ../glib/gmain.c:3854
        #13 0x00007ffff7a12368 in g_main_context_iterate (context=0x555555994d00, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at ../glib/gmain.c:3927
        #14 0x00007ffff7a126b3 in g_main_loop_run (loop=0x555555995e60) at ../glib/gmain.c:4123
        #15 0x000055555558a741 in main (argc=<optimized out>, argv=<optimized out>) at src/main.c:444
      
      Filter out relative filenames early.
      
      (cherry picked from commit a1b102ea)
      (cherry picked from commit c21171e0)
      8fe900d3
  3. 08 May, 2019 1 commit
    • Beniamino Galvani's avatar
      settings: fix failed assertion · b7cd8f28
      Beniamino Galvani authored
      Fix the following assertion failure:
      
        g_object_ref: assertion 'G_IS_OBJECT (object)' failed.
      
      nm_settings_add_connection() can return a NULL connection.
      
      Fixes: f034f17f ('settings: keep the added connection alive for a bit longer')
      (cherry picked from commit 48ce3628)
      (cherry picked from commit d80818e6)
      b7cd8f28
  4. 02 Apr, 2019 1 commit
  5. 28 Mar, 2019 1 commit
    • Lubomir Rintel's avatar
      settings: keep the added connection alive for a bit longer · ebdc37e3
      Lubomir Rintel authored
      Fixes a crash on failed AddAndActivate:
      
        $ ip link set eth0 down
        $ nmcli d conn eth0
        Error: Failed to add/activate new connection: Connection 'eth0' is not available on device eth0 because device has no carrier
        <NetworkManager crashes>
      
        #3  0x000055555558b6c5 in _nm_g_return_if_fail_warning
        #4  0x00005555557008c7 in nm_settings_has_connection
        #5  0x0000555555700e5f in pk_add_cb
        #6  0x0000555555726e30 in pk_call_cb
        #7  0x0000555555726e30 in pk_call_cb
        #8  0x0000555555726e30 in pk_call_cb
        #9  0x00005555555aaea8 in _call_id_invoke_callback
        #10 0x00005555555ab2e8 in _call_on_idle
      
      https://github.com/NetworkManager/NetworkManager/pull/325
      (cherry picked from commit f034f17f)
      ebdc37e3
  6. 11 Mar, 2019 1 commit
  7. 07 Mar, 2019 1 commit
  8. 23 Feb, 2019 1 commit
    • Thomas Haller's avatar
      build/meson: increase timeouts for some tests · b1f6d53b
      Thomas Haller authored
      The defaults for test timeouts in meson is 30 seconds. That is not long
      enough when running
      
        $ NMTST_USE_VALGRIND=1 ninja -C build test
      
      Note that meson supports --timeout-multiplier, and automatically
      increases the timeout when running under valgrind. However, meson
      does not understand that we are running tests under valgrind via
      NMTST_USE_VALGRIND=1 environment variable.
      
      Timeouts are really not expected to be reached and are a mean of last
      resort. Hence, increasing the timeout to a large value is likely to
      have no effect or to fix test failures where the timeout was too rigid.
      It's unlikely that the test indeed hangs and the increase of timeout
      causes a unnecessary increase of waittime before aborting.
      b1f6d53b
  9. 22 Feb, 2019 1 commit
    • Thomas Haller's avatar
      all: move nm_utils_hexstr2bin*() to shared · 53b747ff
      Thomas Haller authored
      libnm exposes simplified variants of hexstr2bin in its public API. I
      think that was a mistake, because libnm should provide NetworkManager
      specific utils. It should not provide such string functions.
      
      However, nmcli used to need this, so it was added to libnm.
      
      The better approach is to add it to our internally shared static
      library, so that all interested components can make use of it.
      53b747ff
  10. 21 Feb, 2019 3 commits
  11. 15 Feb, 2019 1 commit
  12. 12 Feb, 2019 4 commits
  13. 11 Feb, 2019 1 commit
  14. 06 Feb, 2019 1 commit
  15. 05 Feb, 2019 2 commits
  16. 04 Feb, 2019 6 commits
  17. 24 Jan, 2019 1 commit
  18. 07 Jan, 2019 1 commit
    • Thomas Haller's avatar
      libnm,core: add _nm_connection_aggregate() to replace nm_connection_for_each_setting_value() · 7771473f
      Thomas Haller authored
      We should no longer use nm_connection_for_each_setting_value() and
      nm_setting_for_each_value(). It's fundamentally broken as it does
      not work with properties that are not backed by a GObject property
      and it cannot be fixed because it is public API.
      
      Add an internal function _nm_connection_aggregate() to replace it.
      
      Compare the implementation of the aggregation functionality inside
      libnm with the previous two checks for secret-flags that it replaces:
      
      - previous approach broke abstraction and require detailed knowledge of
        secret flags. Meaning, they must special case NMSettingVpn and
        GObject-property based secrets.
        If we implement a new way for implementing secrets (like we will need
        for WireGuard), then this the new way should only affect libnm-core,
        not require changes elsewhere.
      
      - it's very inefficient to itereate over all settings. It involves
        cloning and sorting the list of settings, and retrieve and clone all
        GObject properties. Only to look at secret properties alone.
      
      _nm_connection_aggregate() is supposed to be more flexible then just
      the two new aggregate types that perform a "find-any" search. The
      @arg argument and boolean return value can suffice to implement
      different aggregation types in the future.
      
      Also fixes the check of NMAgentManager for secret flags for VPNs
      (NM_CONNECTION_AGGREGATE_ANY_SYSTEM_SECRET_FLAGS). A secret for VPNs
      is a property that either has a secret or a secret-flag. The previous
      implementation would only look at present secrets and
      check their flags. It wouldn't check secret-flags that are
      NM_SETTING_SECRET_FLAG_NONE, but have no secret.
      7771473f
  19. 30 Dec, 2018 1 commit
  20. 20 Dec, 2018 1 commit
  21. 19 Dec, 2018 2 commits
    • Thomas Haller's avatar
      all: don't use static buffer for nm_utils_inet*_ntop() · a51c09dc
      Thomas Haller authored
      While nm_utils_inet*_ntop() accepts a %NULL buffer to fallback
      to a static buffer, don't do that.
      
      I find the possibility of using a static buffer here error prone
      and something that should be avoided. There is of course the downside,
      that in some cases it requires an additional line of code to allocate
      the buffer on the stack as auto-variable.
      a51c09dc
    • Aleksander Morgado's avatar
      settings,gsm: deprecate and stop using 'number' property · 6ed21e83
      Aleksander Morgado authored
      The 'number' property in GSM settings is a legacy thing that comes
      from when ModemManager used user-provided numbers, if any, to connect
      3GPP modems.
      
      Since ModemManager 1.0, this property is completely unused for 3GPP
      modems, and so it doesn't make sense to use it in the NetworkManager
      settings. Ofono does not use it either.
      
      For AT+PPP-based 3GPP modems, the 'number' to call to establish the
      data connection is decided by ModemManager itself, e.g. for standard
      GSM/UMTS/LTE modems it will connect a given predefined PDP context,
      and for other modems like Iridium it will have the number to call
      hardcoded in the plugin itself.
      
      https://github.com/NetworkManager/NetworkManager/pull/261
      6ed21e83
  22. 13 Dec, 2018 2 commits
  23. 12 Dec, 2018 2 commits
    • Beniamino Galvani's avatar
      ifcfg-rh: fix persisting sriov setting · d48f389c
      Beniamino Galvani authored
      The writer should write all properties of the sriov setting when the
      setting exists without additional logic. Likewise, the reader should
      instantiate a sriov setting when any sriov key is present and blindly
      set properties from keys.
      
      The old code did not always preserve the presence of a sriov setting
      after a write/read cycle.
      
      Fixes: c02d1c48
      d48f389c
    • Beniamino Galvani's avatar
      cli: strictly validate SR-IOV attributes · 769e0726
      Beniamino Galvani authored
      Report an error when the user tries to add an unknown attribute
      instead of silently accepting (and ignoring) it.
      
      Note that this commit also changes the behavior of public API
      nm_utils_sriov_vf_from_str() to return an error when an unknown
      attribute is found. I think the previous behavior was buggy as wrong
      attributes were simply ignored without any way for the user to know.
      
      Fixes: a9b4532f
      769e0726
  24. 03 Dec, 2018 2 commits
    • Thomas Haller's avatar
      keyfile: add helper functions to record loaded UUID files · 3fc5765e
      Thomas Haller authored
      This code will be used later.
      
      We want to remember which keyfiles are currently loaded (or hidden).
      
      With the addition or multiple keyfile directories (soon), there are
      two cases where this matters:
      
       - if there are multiple keyfiles which reference the same UUID,
         we can only load one of them. That is already a problem today
         with only one keyfile directory, where multiple files can reference
         the same UUID.
         The implementation will pick the file based on priorities (like
         the file modification date). However, the user may call explicitly
         call `nmcli connection load`. In that case, we cannot reload
         all files to find out whether the to be loaded file is hidden
         according to the defined priorities. We cannot do that, because we
         must not make decisions based on files on disk, which we are not told
         to reload. So, during a `nmcli connection load` we must look at
         unrelated files, to determine how to load the file.
         Instead, we do allow the user to load any file, even if it would be
         shadowed by other files. When we do that, we may want to persist which
         file is currently loaded, so that a service restart and a `nmcli connection
         reload` does not undo the load again. This can be later later be solved by
         writing a symlink
      
             "/var/run/NetworkManager/system-connections/.loaded-$UUID.nmkeyfile"
      
         which targets the currently active file.
      
       - if a profile was loaded from read-only persistant storage, the user
         may still delete the profile. We also need to remember the deletion
         of the file. That will be achieved by symlinking "/dev/null" as
         "/etc/NetworkManager/system-connections/.loaded-$UUID.nmkeyfile".
      
      Add helper functions to read and write these symlinks.
      3fc5765e
    • Thomas Haller's avatar
      f7de10ac