1. 10 Jan, 2018 5 commits
    • Inigo Martínez's avatar
      meson: Improve dependency system · 5e16bcf2
      Inigo Martínez authored
      Some targets are missing dependencies on some generated sources in
      the meson port. These makes the build to fail due to missing source
      files on a highly parallelized build.
      
      These dependencies have been resolved by taking advantage of meson's
      internal dependencies which can be used to pass source files,
      include directories, libraries and compiler flags.
      
      One of such internal dependencies called `core_dep` was already in
      use. However, in order to avoid any confusion with another new
      internal dependency called `nm_core_dep`, which is used to include
      directories and source files from the `libnm-core` directory, the
      `core_dep` dependency has been renamed to `nm_dep`.
      
      These changes have allowed minimizing the build details which are
      inherited by using those dependencies. The parallelized build has
      also been improved.
      5e16bcf2
    • Thomas Haller's avatar
      96658d2f
    • Pavel Šimerda's avatar
      device: split per-directory factory function · 681d2bcd
      Pavel Šimerda authored
      In some cases we might want to load device plugins from multiple
      directories. A special case that I have in mind is to load plugins from
      build directory subdirectories in order to run NetworkManager from the
      build directory.
      
      [thaller@redhat.com: modify original patch]
      681d2bcd
    • Pavel Šimerda's avatar
      build: print missing configured directories · a967a5be
      Pavel Šimerda authored
      Many of the configured directories default to being defined using existing
      directory configuration. As a result you usually don't see the actual
      directories that will be used. With the added directories you can at least
      assemble the information and thus see which directories will be used.
      a967a5be
    • Inigo Martínez's avatar
      build: Add meson build files to distributable files · 97f06c3a
      Inigo Martínez authored
      Although it is possible to generate distributable files on meson
      since version 0.41 by using the `ninja dist` command, autotools does
      different things that end up creating a different distributable
      file.
      
      meson build files have been added to autotools build files as
      distributable files, so the whole meson port would also be
      distributed.
      
      https://mail.gnome.org/archives/networkmanager-list/2018-January/msg00047.html
      97f06c3a
  2. 09 Jan, 2018 21 commits
    • Thomas Haller's avatar
      0e1fb1db
    • 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
      NetworkManager.conf.
      c03a5349
    • 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
      correctly.
      
      This also temporarily drops support for mdns. Will be re-added next,
      but differently.
      b40729ca
    • 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.
      fc40d91b
    • 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
      type.
      
      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.
      b0f1a54c
    • 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.
      4be4a3c2
    • 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.
      901aa031
    • 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.
      2aad517b
    • Thomas Haller's avatar
      4ccfa7a7
    • Thomas Haller's avatar
    • Thomas Haller's avatar
    • Thomas Haller's avatar
      dns/trivial: move code · 03cba938
      Thomas Haller authored
      03cba938
    • 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*.
      9d92848a
    • 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.
      eec907b3
    • 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.
      25906eda
    • 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.
      2e2ff6f2
    • 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.
      6dd69990
    • 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.
      3d86429c
    • 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.
      
      https://mail.gnome.org/archives/networkmanager-list/2018-January/msg00031.html
      08a91094
  3. 08 Jan, 2018 12 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.
      
      https://bugzilla.redhat.com/show_bug.cgi?id=1527197
      f3b4053a
    • 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)
      f9b9c597
    • 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.
      29e566cc
    • 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".
      
      https://mail.gnome.org/archives/networkmanager-list/2018-January/msg00032.html
      
      [thaller@redhat.com: original patch modified and commit message changed]
      876de69e
    • 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".
      52baa8c5
    • 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.
      25ade397
    • Thomas Haller's avatar
      tests: add NMTST_EXPECT*() macros · 66b80bd6
      Thomas Haller authored
      Will be used next...
      66b80bd6
    • 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
      WITH_LIBNM_CORE, WITH_LIBNM_CORE_INTERNAL, and WITH_LIBNM_CORE_PRIVATE
      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.
      22ef6a50
    • Thomas Haller's avatar
      config: adjust logging message for duplicate config prefix · 31b6abd4
      Thomas Haller authored
      The logging macros already prepend a "config: " prefix. Don't
      repeat that in the message, otherwise we get
      
          config: config: signal SIGHUP (no changes from disk)
      
      Now:
      
          config: signal: SIGHUP (no changes from disk)
      31b6abd4
    • Lubomir Rintel's avatar
      core: load jansson on demand · cd476e4d
      Lubomir Rintel authored
      Avoid using it if the symbols clash is detected.
      cd476e4d
  4. 05 Jan, 2018 1 commit
    • Beniamino Galvani's avatar
      ip-tunnel: add support for tunnel flags · da4c9e51
      Beniamino Galvani authored
      Implement support for IP tunnel flags. Currently only some IPv6 tunnel
      flags are supported. Example:
      
       # nmcli connection add type ip-tunnel mode ip6ip6 \
         ip-tunnel.flags ip6-ign-encap-limit,ip6-use-orig-tclass \
         ifname abc ip-tunnel.parent ens8 ipv4.method disabled \
         ipv6.method manual ipv6.address ::8888 remote ::42
      
       # ip -d l
        61: abc@ens8: <NOARP,UP,LOWER_UP> mtu 1460 qdisc noqueue ...
          link/tunnel6 :: brd ::42 promiscuity 0
          ip6tnl ip6ip6 remote ::42 local :: dev ens8 encaplimit none
          hoplimit 0 tclass inherit ...
      
      https://bugzilla.gnome.org/show_bug.cgi?id=791846
      da4c9e51
  5. 04 Jan, 2018 1 commit
    • Thomas Haller's avatar
      dhcp: cleanup handling of ipv4.dhcp-client-id and avoid assertion failure · 686afe53
      Thomas Haller authored
      The internal client asserts that the length of the client ID is not more
      than MAX_CLIENT_ID_LEN. Avoid that assert by truncating the string.
      
      Also add new nm_dhcp_client_set_client_id_*() setters, that either
      set the ID based on a string (in our common dhclient specific
      format), or based on the binary data (as obtained from systemd client).
      
      Also, add checks and assertions that the client ID which is
      set via nm_dhcp_client_set_client_id() is always of length
      of at least 2 (as required by rfc2132, section-9.14).
      686afe53