1. 31 May, 2018 6 commits
  2. 27 May, 2018 1 commit
    • Thomas Haller's avatar
      clients/tests: generate Makefile.am for expected files · ee85151a
      Thomas Haller authored
      The developer can re-generate .expected files with
      
       $ NM_TEST_REGENERATE=1 ./clients/tests/test-client.py
      
      Note that these files are also dist-ed, so that the tests also work
      from a source-tarball. For that, we need to add them to EXTRA_DIST.
      
      Previously, this was done manually in the base Makefile.am file. This
      was cumbersome, because when adding a new test, the developer would need
      to manually add the files.
      
      Now, let the test (with NM_TEST_REGENERATE=1) also generate a makefile
      part.
      ee85151a
  3. 25 May, 2018 1 commit
  4. 24 May, 2018 4 commits
  5. 21 May, 2018 1 commit
    • Lubomir Rintel's avatar
      tests: run the nmcli test with $PYTHON we autoconf'd · 347e3e36
      Lubomir Rintel authored
      Avoids an annoying warning in Fedora:
      
        |DEPRECATION WARNING: python2 invoked with /usr/bin/python.
            Use /usr/bin/python3 or /usr/bin/python2
            /usr/bin/python will be removed or switched to Python 3 in the future.
      
      Also allows the user to override the Python version that's actually
      used.
      347e3e36
  6. 14 May, 2018 4 commits
  7. 11 May, 2018 4 commits
    • 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
    • Thomas Haller's avatar
      build: let `make check` re-generate clients/common/settings-doc.h.in with NM_TEST_REGENERATE=1 · 5e6b0382
      Thomas Haller authored
      When building with --disable-introspection, we re-use the pre-generated
      clients/common/settings-doc.h.in file.
      
      When building with --enable-introspection, we generate
      clients/common/settings-doc.h, and let `make check` verify that the
      generated file is identical to what we would generate.
      
      The common case where the generated file differ, is when code changed,
      in this case, the developer is advised to update settings-doc.h.in.
      
      Interpret environment variable NM_TEST_REGENERATE=1 to do this
      automatically during `make check`.
      
      This will be useful, as there might be several tests that compare a
      generated file with a file from version control. NM_TEST_REGENERATE=1
      will be the general way to re-generate all these files.
      
        $ NM_TEST_REGENERATE=1 make check
      5e6b0382
    • Thomas Haller's avatar
      tests: use libnm via pygobject in tools/test-networkmanager-service.py · 9628aabc
      Thomas Haller authored
      tools/test-networkmanager-service.py is our NetworkManager stub server.
      
      NetworkManager uses libnm(-core) heavily, for example to decide whether
      a connection verifies (nm_connection_verify()) and for normalizing
      connections (nm_connection_normalize()).
      
      If the stub server wants to mimic NetworkManager, it also must use these
      function. Luckily, we already can do so, by loading libnm using python
      GObject introspection.
      
      We already correctly set GI_TYPELIB_PATH search path, so that the
      correct libnm is loaded -- provided that we build with introspection
      enabled.
      
      We still need to gracefully fail, if starting the stub server fails.
      That requries some extra effort. If the stub server notices that
      something is missing, it shall exit with status 77. That will cause
      the tests to g_test_skip().
      9628aabc
    • Lubomir Rintel's avatar
      Revert "build: qualify plugin dir name with a version string" · 62363ebc
      Lubomir Rintel authored
      This is broken -- looks for VPN plugins in a version-qualified path,
      which is wrong and break installed VPN plugins.
      
      This reverts commit 6384ad4e.
      62363ebc
  8. 10 May, 2018 1 commit
    • Lubomir Rintel's avatar
      cli: allow setting the colors with terminal-colors.d(5) · bcc9e58b
      Lubomir Rintel authored
      The present version of the specification is somewhat unclear at times,
      Unclear points were discussed with the maintainers [1] and probably
      some new version will address those.
      
      https://www.spinics.net/lists/util-linux-ng/msg15222.html
      
      Until then here's how the implementation copes with ambiguities
      (after the discussion with util-linux maintainers):
      
      1.) It is unclear whether multiple .schem files should override each
          other or be merged. We use the overriding behavior -- take the
          highest priority one and ignore the rest.
      
      2.) We assume "name.schem" is more specific than "@term.schem".
      
      3.) We assume the "Color name" are to be used as aliases for the color
          sequences and translate them to ANSI escape sequences.
      
      4.) The "Escape sequences" are of no use since the specification
          pretty much assumes an ANSI terminal and none of the sequences make
          any sense in ANSI color codes. We don't support them.
          accept that.
      
      5.) We don't implement TERMINAL_COLORS_DEBUG because it's unspecified
          what should it do.
      bcc9e58b
  9. 09 May, 2018 1 commit
    • Lubomir Rintel's avatar
      build: qualify plugin dir name with a version string · 6384ad4e
      Lubomir Rintel authored
      This makes package updates more robust, avoiding in-place replaces of
      the plugins.
      
      Previously, if an upgrade transaction was terminated, NetworkManager
      library could end up being of a different version than the plugins.
      If the user was unfortunate enough to connect using a connection that
      required a plugin (say, Wi-Fi), he would be left without a network
      connection making it somewhat inconvenient to recover from the botched
      upgrade.
      
      This makes the whole situation a little bit less sad.
      6384ad4e
  10. 05 May, 2018 1 commit
  11. 02 May, 2018 2 commits
    • Lubomir Rintel's avatar
      build: add a missing dependency · 43e3ebfa
      Lubomir Rintel authored
      Parallel make failed for me:
      
        /usr/bin/xsltproc --output man/nm-settings-keyfile.xml ...
          ... man/nm-settings-keyfile.xsl libnm/nm-settings-keyfile-docs.xml
        man/nm-settings-keyfile.xsl:4: warning: failed to load external entity "man/common.ent"
        %entities;
                  ^
        man/nm-settings-keyfile.xsl:26: parser error : Entity 'NM_VERSION' not defined
                <refmiscinfo class="version">&NM_VERSION;</refmiscinfo>
                                                         ^
        cannot parse man/nm-settings-keyfile.xsl
        make[2]: *** [Makefile:18130: man/nm-settings-keyfile.xml] Error 4
      43e3ebfa
    • Thomas Haller's avatar
      build: fix missing dependency when building clients/tui/newt/libnmt-newt.a · b3880b31
      Thomas Haller authored
      We need to declare explicit dependencies, otherwise, the required header
      files may not yet be created when building nmtui helper library.
      b3880b31
  12. 21 Apr, 2018 1 commit
  13. 19 Apr, 2018 3 commits
    • Christian Kellner's avatar
      all: add support for thunderbolt networking · 89af7fbf
      Christian Kellner authored
      Load the thunderbolt-net module if we see a host-to-host connection
      and configure the resulting ethernet connection automatically to be
      a link-local only one. The latter is done by setting a new udev
      property "NM_AUTO_DEFAULT_LINK_LOCAL_ONLY" which is picked up when
      we configure the connection for the device.
      
      https://github.com/NetworkManager/NetworkManager/pull/97
      89af7fbf
    • Thomas Haller's avatar
      libnm/keyfile: merge keyfile sources (pt2, merge nm-keyfile-writer.c) · 21f6058c
      Thomas Haller authored
      Splitting keyfile handling in two "reader.c" and "writer.c" files
      is not helpful. What is most interesting, is to see how property XYZ
      is serialized to keyfile, and to verify that the parser does the
      inverse. For that, it's easier if both the write_xzy() and parse_xyz()
      function are beside each other, and not split accross files.
      
      The more important reason is, that both reader and writer have their
      separate handler arrays, for special handling of certain properties:
      @key_parsers and @key_writers. These two should not be separate but will
      be merged. Since they reference static functions, these functions must
      all be in the same source file (unless, we put them into headers, which
      would be unnecessary complex).
      
      No code was changed, only moved.
      21f6058c
    • Thomas Haller's avatar
      libnm/keyfile: merge keyfile sources (pt1, rename nm-keyfile-reader.c) · f99dc6b9
      Thomas Haller authored
      I am going to merge the files for keyfile handling in libnm-core.
      There is a reason for that, I'll tell you next.
      f99dc6b9
  14. 18 Apr, 2018 3 commits
  15. 04 Apr, 2018 1 commit
    • Thomas Haller's avatar
      checkpoint: embed CList in NMCheckpoint instance · ffb49267
      Thomas Haller authored
      We don't need an external CheckpointItem, just to wrap the
      CList instance. Embed it directly in NMCheckpoint.
      
      Sure, that exposes the checkpoints_lst field in the (internal)
      header file, hiding the private member less.
      ffb49267
  16. 27 Mar, 2018 1 commit
    • Thomas Haller's avatar
      libnm: add nm-autoptr.h header · ff8e5633
      Thomas Haller authored
      "nm-autoptr.h" is done in a way that allows you to copy the header
      in your source tree to support older versions of libnm, that didn't
      contain the header yet. For example, we might want to use it in
      network-manager-applet, but we don't want to bump the libnm dependency
      to 1.11.2+ only to get this functionality.
      
      Note that G_DEFINE_AUTOPTR_CLEANUP_FUNC() was added in glib 2.43.4,
      and requires compiler support for the cleanup attribute. The compiler
      support is taken as given, because we rely on it already. However,
      NetworkManager and network-manager-applet still don't depend on a glib
      version recent enough to provide these macros. To actually use them
      (*inside*) NetworkManager/network-manager-applet, we either would have
      to bump the glib minimal dependency, or reimplement g_autoptr in
      /shared/nm-utils/nm-glib.h compat header.
      
      https://bugzilla.gnome.org/show_bug.cgi?id=794294
      ff8e5633
  17. 20 Mar, 2018 2 commits
  18. 19 Mar, 2018 1 commit
    • Thomas Haller's avatar
      connectivity: always build nm-connectivity.c source · c1054ec8
      Thomas Haller authored
      We already do conditional build with "#if WITH_CONCHECK".
      Get rid of the conditional in the makefile and instead do
      conditional compilating inside the source file "nm-connectivity.c".
      
      The advantage is, now if you want to know which parts are build,
      you only need to grep for the WITH_CONCHECK preprocessor define
      instead of also caring about the conditional in Makefile.am and
      meson.build.
      
      It doesn't change the fact of conditional compilation. But it
      consistently uses one mechanism to achieve it.
      c1054ec8
  19. 12 Mar, 2018 2 commits
    • Thomas Haller's avatar
      core/dbus: rework D-Bus implementation to use lower layer GDBusConnection API · 297d4985
      Thomas Haller authored
      Previously, we used the generated GDBusInterfaceSkeleton types and glued
      them via the NMExportedObject base class to our NM types. We also used
      GDBusObjectManagerServer.
      
      Don't do that anymore. The resulting code was more complicated despite (or
      because?) using generated classes. It was hard to understand, complex, had
      ordering-issues, and had a runtime and memory overhead.
      
      This patch refactors this entirely and uses the lower layer API GDBusConnection
      directly. It replaces the generated code, GDBusInterfaceSkeleton, and
      GDBusObjectManagerServer. All this is now done by NMDbusObject and NMDBusManager
      and static descriptor instances of type GDBusInterfaceInfo.
      
      This adds a net plus of more then 1300 lines of hand written code. I claim
      that this implementation is easier to understand. Note that previously we
      also required extensive and complex glue code to bind our objects to the
      generated skeleton objects. Instead, now glue our objects directly to
      GDBusConnection. The result is more immediate and gets rid of layers of
      code in between.
      Now that the D-Bus glue us more under our control, we can address issus and
      bottlenecks better, instead of adding code to bend the generated skeletons
      to our needs.
      
      Note that the current implementation now only supports one D-Bus connection.
      That was effectively the case already, although there were places (and still are)
      where the code pretends it could also support connections from a private socket.
      We dropped private socket support mainly because it was unused, untested and
      buggy, but also because GDBusObjectManagerServer could not export the same
      objects on multiple connections. Now, it would be rather straight forward to
      fix that and re-introduce ObjectManager on each private connection. But this
      commit doesn't do that yet, and the new code intentionally supports only one
      D-Bus connection.
      Also, the D-Bus startup was simplified. There is no retry, either nm_dbus_manager_start()
      succeeds, or it detects the initrd case. In the initrd case, bus manager never tries to
      connect to D-Bus. Since the initrd scenario is not yet used/tested, this is good enough
      for the moment. It could be easily extended later, for example with polling whether the
      system bus appears (like was done previously). Also, restart of D-Bus daemon isn't
      supported either -- just like before.
      
      Note how NMDBusManager now implements the ObjectManager D-Bus interface
      directly.
      
      Also, this fixes race issues in the server, by no longer delaying
      PropertiesChanged signals. NMExportedObject would collect changed
      properties and send the signal out in idle_emit_properties_changed()
      on idle. This messes up the ordering of change events w.r.t. other
      signals and events on the bus. Note that not only NMExportedObject
      messed up the ordering. Also the generated code would hook into
      notify() and process change events in and idle handle, exhibiting the
      same ordering issue too.
      No longer do that. PropertiesChanged signals will be sent right away
      by hooking into dispatch_properties_changed(). This means, changing
      a property in quick succession will no longer be combined and is
      guaranteed to emit signals for each individual state. Quite possibly
      we emit now more PropertiesChanged signals then before.
      However, we are now able to group a set of changes by using standard
      g_object_freeze_notify()/g_object_thaw_notify(). We probably should
      make more use of that.
      
      Also, now that our signals are all handled in the right order, we
      might find places where we still emit them in the wrong order. But that
      is then due to the order in which our GObjects emit signals, not due
      to an ill behavior of the D-Bus glue. Possibly we need to identify
      such ordering issues and fix them.
      
      Numbers (for contrib/rpm --without debug on x86_64):
      
      - the patch changes the code size of NetworkManager by
        - 2809360 bytes
        + 2537528 bytes (-9.7%)
      
      - Runtime measurements are harder because there is a large variance
        during testing. In other words, the numbers are not reproducible.
        Currently, the implementation performs no caching of GVariants at all,
        but it would be rather simple to add it, if that turns out to be
        useful.
        Anyway, without strong claim, it seems that the new form tends to
        perform slightly better. That would be no surprise.
      
        $ time (for i in {1..1000}; do nmcli >/dev/null || break; echo -n .;  done)
        - real    1m39.355s
        + real    1m37.432s
      
        $ time (for i in {1..2000}; do busctl call org.freedesktop.NetworkManager /org/freedesktop org.freedesktop.DBus.ObjectManager GetManagedObjects > /dev/null || break; echo -n .; done)
        - real    0m26.843s
        + real    0m25.281s
      
      - Regarding RSS size, just looking at the processes in similar
        conditions, doesn't give a large difference. On my system they
        consume about 19MB RSS. It seems that the new version has a
        slightly smaller RSS size.
        - 19356 RSS
        + 18660 RSS
      297d4985
    • Thomas Haller's avatar
      core: rename "nm-bus-manager.h" to "nm-dbus-manager.h" · a1f37964
      Thomas Haller authored
      The next commit will completely rework NMBusManager and replace
      NMExportedObject by a new type NMDBusObject.
      
      Originally, NMDBusObject was added along NMExportedObject to ease
      the rework and have compilable, intermediate stages of refactoring. Now,
      I think the new name is better, because NMDBusObject is very strongly related
      to the bus manager and the old name NMExportedObject didn't make that
      clear.
      
      I also slighly prefer the name NMDBusObject over NMBusObject, hence
      for consistancy, also rename NMBusManager to NMDBusManager.
      
      This commit only renames the file for a nicer diff in the next commit.
      It does not actually update the type name in sources. That will be done
      later.
      a1f37964