1. 10 Jan, 2018 9 commits
  2. 09 Jan, 2018 21 commits
    • Thomas Haller's avatar
    • Thomas Haller's avatar
    • Thomas Haller's avatar
    • Thomas Haller's avatar
      core: implement setting MDNS setting for systemd · c03a5349
      Thomas Haller authored
      The connection.mdns setting is a per-connection setting,
      so one might expect that one activated device can only have
      one MDNS setting at a time.
      However, with certain VPN plugins (those that don't have their
      own IP interface, like libreswan), the VPN configuration is merged
      into the configuration of the device. So, in this case, there
      might be multiple settings for one device that must be merged.
      We already have a mechanism for that. It's NMIP4Config. Let NMIP4Config
      track this piece of information. Although, stricitly speaking this
      is not tied to IPv4, the alternative would be to introduce a new
      object to track such data, which would be a tremendous effort
      and more complicated then this.
      Luckily, NMDnsManager and NMDnsPlugin are already equipped to
      handle multiple NMIPConfig instances per device (IPv4 vs. IPv6,
      and Device vs. VPN).
      Also make "connection.mdns" configurable via global defaults in
    • Thomas Haller's avatar
      core: rework tracking config in dns-manager to use ifindex · b40729ca
      Thomas Haller authored
      Don't track the per-device configuration in NMDnsManager by
      the ifname, but by the ifindex. We should consistently treat
      the ifindex as the ID of a link, like kernel does.
      At the few places where we actually need the ifname, resolve
      it by looking into the platform cache. That is not necessarily
      the same as the ifname that is currently tracked by NMDevice,
      because netdev interfaces can be renamed, and NMDevice updates
      it's link properties delayed. However, the platform cache has
      the most recent notion of the correct interface name for an
      ifindex, so if we ever hit a race here, we do it now more
      This also temporarily drops support for mdns. Will be re-added next,
      but differently.
    • Thomas Haller's avatar
      core/trivial: rename local variable in merge_one_ip_config() · fc40d91b
      Thomas Haller authored
      Next commit will unify naming of variables, do a trivial rename
      first to make the diff smaller.
    • Thomas Haller's avatar
      dns: rework pending request-queue in NMDnsSystemdResolved · b0f1a54c
      Thomas Haller authored
      We had two separate queues, one for "SetLinkDNS" and one for
      "SetLinkDomains". Merge them into one, and track the operation
      as part of the new RequestItem structure.
      A visible change to before is that we now would make all requests
      per-interface first. Prevously, we would first make all SetLinkDNS
      requests (for all interfaces) and then all SetLinkDomains requests.
      It feels more correct to order the requests this way, not by
      The reason to merge is, that we will next get another operation
      and in the current scheme we would need 3 GQueue instances.
      While at it, refactor the code to use CList. We now anyway would
      need a new struct to track the operation, requiring to allocate
      and free it. Previously, we would only track the GVariant argument
      as data of the GQueue.
    • Thomas Haller's avatar
      dns: refactor update() in NMDnsSystemdResolved to use a hash table · 4be4a3c2
      Thomas Haller authored
      Use a GHashTable instead of a GArray to construct the list of
      @interfaces. Also, use NMCListElem instead of GList. With this,
      the runtime is O(n*log(n)) instead of O(n^2).
      I belive, we should take care that all our code has a reasonable
      runtime complexity, even in common use-cases the number of elements
      is small. This is not about performace, because likely we expect few
      entries anyway, and the direct GArray implementation is likely faster
      in those cases. It's about using the data structure that best suits the
      access pattern.
      The log(n) part comes from sorting the keys. I also believe we should
      always aim for a stable behavior. When sending the D-Bus request to
      resolved, the order of elements should be in ~some~ defined order.
    • Thomas Haller's avatar
      shared: add nm_cmp_int2ptr_p_with_data() helper · 901aa031
      Thomas Haller authored
      A cmp() implementation, for sorting an array with pointers, where each
      pointer is an inteter according to GPOINTER_TO_INT().
      That cames for example handy, if you have a GHashTable with keys
      GINT_TO_POINTER(). Then you get the list of keys via
      g_hash_table_get_keys_as_array() and want to sort them.
    • Thomas Haller's avatar
      shared: add NMCListElem · 2aad517b
      Thomas Haller authored
      Sometimes, we want to use CList to track a simple data item. But contrary
      to GList/GSList, we need to define a structure to hold the data pointer
      and the CList member.
      Add a generic NMCListElem type that can be used for such simple uses.
      Before you ask: why not use GList/GSList? Because even simple operations
      like g_list_append() is O(n), which kinda defeats the purpose of having
      a doubly linked list.
      This code is added to a new header file nm-c-list.h, the reason is that
      there is no other good place:
        - "nm-utils/c-list.h" is a clone of upstream, it should not deviate.
        - "nm-utils/c-list-util.h" contains our utils functions for c-list.h
          but should be plain C, independent of glib.
        - "nm-utils/nm-shared-utils.h" contains our glib related utilities,
          but it should not drag in "c-list.h".
      So, "nm-c-list.h" is a utility libray that extends "c-list.h" and
      requires glib.
    • Thomas Haller's avatar
    • Thomas Haller's avatar
    • Thomas Haller's avatar
    • Thomas Haller's avatar
      dns/trivial: move code · 03cba938
      Thomas Haller authored
    • Thomas Haller's avatar
      libnm: rename MDns flag UNKNOWN to DEFAULT · 9d92848a
      Thomas Haller authored
      "UNKNOWN" is not a good name. If you don't set the property
      in the connection explicitly, it should be "DEFAULT".
      Also, make "DEFAULT" -1. For one, that ensures that the enum's
      underlying integer type is signed. Otherwise, it's cumbersome
      to test "if (mdns >= DEFAULT)" because in case of unsigned types,
      the compiler will warn about the check always being true.
      Also, it allows for "NO" to be zero. These are no strong reasons,
      but I tend to think this is better.
      Also, don't make the property of NMSettingConnection a CONSTRUCT property.
      Initialize the default manually in the init function.
      Also, order the numeric values so that DEFAULT < NO < RESOLVE < YES with
      YES being largest because it enables *the most*.
    • Thomas Haller's avatar
      libnm: verify value for connection.mdns · eec907b3
      Thomas Haller authored
      Also, keep the internal variable of type int. The only way to set the
      field is via the GObject property setter. At that point, don't yet
      cast the integer type to enum.
    • Ismo Puustinen's avatar
      dns: add mechanism for propagating mDNS setting. · 25906eda
      Ismo Puustinen authored
      Update nm-policy.c and nm-dns-manager.c so that the connection-specific
      settings get propagated to DNS manger. Currently the only such value is
      the mDNS status.
      Add update_mdns() function to DNS plugin interface. If a DNS plugin
      supports mDNS, it can set an interface with a given index to support
      mDNS resolving or also register the current hostname.
      The mDNS support is currently added only to systemd-resolved DNS plugin.
    • Ismo Puustinen's avatar
      mdns: add new connection property. · 2e2ff6f2
      Ismo Puustinen authored
      Add support for mDNS as a connection-level property. Update ifcfg-rh and
      keyfile plugins to support it.
    • Thomas Haller's avatar
      build: first build dns-manager and dns-plugin before the plugins · 6dd69990
      Thomas Haller authored
      When doing changes that affect multiple source files, it's more
      convenient to build the parts that have less dependencies first.
      So, to fix the build failures from the core outward.
    • Thomas Haller's avatar
      core: reorder code in "src/dns/nm-dns-manager.c" · 3d86429c
      Thomas Haller authored
      Just moving code around, no other changes.
      Follow a certain prefered order of declarations
      in source files.
    • Inigo Martínez's avatar
      ifcfg: test for sysconfig network path also on meson · 08a91094
      Inigo Martínez authored
      In a recent commit 1402fa74 a new
      way for testing Red Hat compatible distributions had been added.
      However, this new approach does not use a set of files, it uses a
      directory, so this test can be done by using the `test` command
      and makes the `check_distro.py` script unnecessary.
  3. 08 Jan, 2018 10 commits
    • Lubomir Rintel's avatar
      platform-linux: reload qdiscs and tfilters after removing them · f3b4053a
      Lubomir Rintel authored
      Kernel (as of 4.14) merely ACKs our RTM_DELQDISC and RTM_DELTFILTER, not
      bothering to signal the full RTM_DEL* message unless the removal is
      external to NetworkManager.
    • Thomas Haller's avatar
    • Francesco Giudici's avatar
      platform/tests: relax checking for signals in test-address-linux · f9b9c597
      Francesco Giudici authored
        # Start of ipv6 tests
        ../tools/run-nm-test.sh: line 193: 32194 Trace/breakpoint trap   (core dumped) "${NMTST_DBUS_RUN_SESSION[@]}" "$TEST" "$@"
        # NetworkManager-FATAL-ERROR: NMPlatformSignalAssert: ../src/platform/tests/test-address.c:153, test_ip6_address_general(): failure to accept signal [0,1] times: 'ip6-address-changed-changed' ifindex 11 (2 times received)
    • Thomas Haller's avatar
      libnm: drop libnm-util/nm-setting-template.[hc] · 29e566cc
      Thomas Haller authored
      These files are a template how to add a new nm-setting-* implementation.
      We are not going to add new files to the deprecated libnm-util library,
      hence a template for libnm-util is pointless.
      libnm-core doesn't have a corresponding template file. Personally, I
      don't think such a template are a great idea either, because
        - People are not aware that it exists. Hence, it's unused, badly
          maintained and quite possibly does not follow current best practice.
        - Just copy an actual settings implementation and start from there.
          That seems better to me than having a template.
    • Inigo Martínez's avatar
      build/meson: don't include libnm when building src/systemd · 876de69e
      Inigo Martínez authored
      "src/" must not include "libnm/". This also causes a build failure,
      because it would include "libnm/nm-types.h", instead of "src/nm-types.h".
      [thaller@redhat.com: original patch modified and commit message changed]
    • Thomas Haller's avatar
    • Thomas Haller's avatar
      clients: drop redundant #include "NetworkManager.h" · 52baa8c5
      Thomas Haller authored
      This header is already included by "nm-default.h".
    • Thomas Haller's avatar
      tests: use NMTST_EXPECT*() macros · 25ade397
      Thomas Haller authored
      Tests are commonly created via copy&paste. Hence, it's
      better to express a certain concept explicitly via a function
      or macro. This way, the implementation of the concept can be
      adjusted at one place, without requiring to change all the callers.
      Also, the macro is shorter, and brevity is better for tests
      so it's easier to understand what the test does. Without being
      bothered by noise from the redundant information.
      Also, the macro knows better which message to expect. For example,
      messages inside "src" are prepended by nm-logging.c with a level
      and a timestamp. The expect macro is aware of that and tests for it
        #define NMTST_EXPECT_NM_ERROR(msg)      NMTST_EXPECT_NM (G_LOG_LEVEL_MESSAGE, "*<error> [*] "msg)
      This again allows the caller to ignore this prefix, but still assert
      more strictly.
    • Thomas Haller's avatar
      tests: add NMTST_EXPECT*() macros · 66b80bd6
      Thomas Haller authored
      Will be used next...
    • Thomas Haller's avatar
      build: refine the NETWORKMANAGER_COMPILATION define · 22ef6a50
      Thomas Haller authored
      Note that:
       - we compile some source files multiple times. Most notably those
         under "shared/".
       - we include a default header "shared/nm-default.h" in every source
         file. This header is supposed to setup a common environment by defining
         and including parts that are commonly used. As we always include the
         same header, the header must behave differently depending
         one whether the compilation is for libnm-core, NetworkManager or
         libnm-glib. E.g. it must include <glib/gi18n.h> or <glib/gi18n-lib.h>
         depending on whether we compile a library or an application.
      For that, the source files need the NETWORKMANAGER_COMPILATION #define
      to behave accordingly.
      Extend the define to be composed of flags. These flags are all named
      NM_NETWORKMANAGER_COMPILATION_WITH_*, they indicate which part of the
      build are available. E.g. when building libnm-core.la itself, then
      are available. When building NetworkManager, WITH_LIBNM_CORE_PRIVATE
      is not available but the internal parts are still accessible. When
      building nmcli, only WITH_LIBNM_CORE (the public part) is available.
      This granularily controls the build.