1. 02 Jan, 2019 5 commits
    • Thomas Haller's avatar
      libnm: use "libnm-systemd-shared.a" in "libnm-core.la" (and "libnm.so") · c4512f83
      Thomas Haller authored
      It's not yet used, but it will be. We will need nm_sd_utils_unbase64mem()
      to strictly validate WireGuard settings, which contain keys in base64 encoding.
      Note that we also need a stub implementation for logging. This will do
      nothing for all logging from "libnm-systemd-shared.a". This makes
      sense because "libnm.so" as a library should not log directly. Also,
      "libnm.so" will only use a small portion of "libnm-systemd-shared.a" which
      doesn't log anything. Thus this code is unused and dropped by the linker
      with "--gc-sections".
    • Thomas Haller's avatar
      systemd: move basic systemd library to shared/nm-utils · 2c537b9d
      Thomas Haller authored
      For better or worse, we already pull in large parts of systemd sources.
      I need a base64 decode implementation (because glib's g_base64_decode()
      cannot reject invalid encodings). Instead of coming up with my own or
      copy-paste if from somewhere, reuse systemd's unbase64mem().
      But for that, make systemd's basic bits an independent static library
      first because I will need it in libnm-core.
      This doesn't really change anything except making "libnm-systemd-core.la"
      an indpendent static library that could be used from "libnm-core". We
      shall still be mindful about which internal code of systemd we use, and only
      access functionality that is exposed via "systemd/nm-sd-utils-shared.h".
    • Thomas Haller's avatar
      systemd: drop workaround for missing C11 header <uchar.h> · 5f945adf
      Thomas Haller authored
      Now as we build as C11, we can us it.
    • Thomas Haller's avatar
      build: bump C standard to (gcc's) C11 · 066357aa
      Thomas Haller authored
      We already import systemd code which is C11. To get this even
      to build, we need workaround like patching import of <uchar.h>.
      Also, the libraries from c-util and nettools are C11. We cannot even
      compile them in C99 mode (and didn't do that either).
      It's time to bump the version. We need C11 from now on (or better: gcc's
      dialect of it).
      Also, note that since nettools/nacd is not optional, we could not even
      build NetworkManager without a C11 compiler. So, just use it everywhere.
    • Thomas Haller's avatar
      shared,core: move logging enums to header "shared/nm-utils/nm-logging-fwd.h" · ef53b47e
      Thomas Haller authored
      In core ("src/"), we use "nm-logging.h" for all logging. This dispatches
      for logging to syslog, glog or systemd-journald.
      If we want to log from a shared component under "shared/", we need to
      use a common logging function. Add "nm-utils/nm-logging-fwd.h" for
      forward declaring the used logging mechaism.
      The shared library will still need to link with "src/nm-logging.c"
      or an alternative implementation, depending on whether it is used
      inside core or not.
  2. 27 Dec, 2018 1 commit
    • Thomas Haller's avatar
      shared,core: add "nm-errno.h" · 943dcba5
      Thomas Haller authored
      This will be our extension on top of <errno.h>.
      We want to use (integer) error numbers, that can both
      contain native errors from <errno.h> and our own defines,
      both merge in one domain. That is, we will reserve a small
      range of integers for our own defines (that hopefully won't
      clash with errors from <errno.h>).
      We can use this at places where GError is too cumbersome to use.
      The advantage is, that our error numbers extend <errno.h> and can
      be mixed.
      This is what "src/platform/nm-netlink.h" already does with nl_errno(). Next,
      the netlink errors from there will be merged into "nm-errno.h".
      Also, platform has NMPlatformError, which are a distinct set of error
      numbers. But these work differently in the sense that negative values
      represent codes from <errno.h> and positive numbers are our own platform
      specific defines. NMPlatformError will also be merged into "nm-errno.h".
      "nm-errno.h" will unify the error handling of platform and netlink,
      making it more similar to what we are used to from systemd, and give
      room to extend it for our own purpose.
  3. 12 Dec, 2018 1 commit
  4. 01 Dec, 2018 2 commits
  5. 17 Nov, 2018 1 commit
    • Benjamin Berg's avatar
      core: Introduce helper class to track connection keep alive · 37e8c53e
      Benjamin Berg authored
      For P2P connections it makes sense to bind the connection to the status
      of the operation that is being done. One example is that a wifi display
      (miracast) P2P connection should be shut down when streaming fails for
      some reason.
      This new helper class allows binding a connection to the presence of a
      DBus path meaning that it will be torn down if the process disappears.
  6. 15 Nov, 2018 1 commit
  7. 12 Nov, 2018 2 commits
    • Thomas Haller's avatar
      build: create intermediate libraries of shared/nm-utils · 70c4e49c
      Thomas Haller authored
      Previously we would compile source files from shared/nm-utils
      multiple times. That not only slows down compilation, but it makes it
      confusing which project require exactly what.
      Most of the files in shared/nm-utils are a mixed bag of utility
      functions. Just build one libnm-utils-base library. Since the linker
      will throw away unused parts, there is no problem that not every user
      of libnm-utils-base needs everything.
      Also add libnm-utils-udev, which cannot be part of libnm-utils-base as
      it has an additional dependency on libudev.
    • Thomas Haller's avatar
      build: move code for shared libs in Makefile.am around · 06ccf3a6
      Thomas Haller authored
      Let's sort the code by the dependencies. The shared/ projects
      have the least dependencies. Move to the beginning.
  8. 25 Oct, 2018 2 commits
  9. 24 Oct, 2018 2 commits
  10. 23 Oct, 2018 1 commit
    • Thomas Haller's avatar
      core: add "nm-sd-utils.h" to access system internal helper · eece5aff
      Thomas Haller authored
      We have a fork of a lot of useful systemd helper code.
      However, until now we shyed away from using it aside from
      the bits that we really need.
      That means, although we have some really nice implementations
      in our source-tree, we didn't use them. Either we were missing
      them, or we had to re-implement them.
      Add "nm-sd-utils.h" header to very carefully make internal
      systemd API accessible to the rest of core.
      This is not intended as a vehicle to access all of internal
      API. Instead, this must be used with care, and only a hand picked
      selection of functions must be exposed. Use with caution, but where it
      makes sense.
  11. 18 Oct, 2018 2 commits
    • Thomas Haller's avatar
      shared/tests: add test for "shared/nm-utils" · dfdbd1b3
      Thomas Haller authored
      "shared/nm-utils" is a loose collection of utility functions.
      There is a certain aim that they can be used independently.
      However, they also rely on each other.
      Add a test that we can build a minimal shared library with
      these tools, independent of libnm-core.
    • Thomas Haller's avatar
      shared: move nm_utils_get_monotonic_timestamp*() to shared/nm-utils. · a6add817
      Thomas Haller authored
      This is independent functionality that only depends on linux API
      and glib.
      Note how "nm-logging" uses this for getting the timestamps. This
      makes "nm-logging.c" itself dependen on "src/nm-core-utils.c",
      for little reason.
  12. 12 Oct, 2018 1 commit
    • Michael Biebl's avatar
      systemd: don't make NetworkManager D-Bus activatable · 90f71c0f
      Michael Biebl authored
      If the NetworkManager daemon has been stopped manually we don't want it
      to be autostarted by a client request.
      [lkundrak@v3.sk: The auto-activation is probably more surprising than useful.
      Services that need NetworkManager API should depend on NetworkManager service
      I have no idea what purpose does the D-Bus service file serve nowadays,
      but it looks rather hacky (really, activating /bin/false) and the comment
      in it suggests that the autoactivating behavior was not intended anyway.
      Debian has been shipping this for quite some time and no complains have been
  13. 27 Sep, 2018 1 commit
    • Thomas Haller's avatar
      acd: make NMAcdManager no GObject · 7729555a
      Thomas Haller authored
      NMAcdManager is a rather simple instance.
      It does not need (thread-safe) ref-counting, in fact, having
      it ref-counted makes it slighly ugly that we connect a signal,
      but never bother to disconnect it (while the ref-counted instance
      could outlife the signal subscriber).
      We also don't need GObject signals. They have more overhead
      and are less type-safe than a regular function pointers. Signals
      would make sense, if there could be multiple independent listeners,
      but that just doesn't make sense.
      Implementing it as a plain struct is less lines of code, and less
      runtime over head.
      Also drop the possiblitiy to reset the NMAcdManager instance.
      It wasn't needed and I think it was buggy because it wouldn't
      reset the n-acd instance.
  14. 19 Sep, 2018 1 commit
  15. 18 Sep, 2018 6 commits
    • Lubomir Rintel's avatar
      initrd: add configuration generator · 9f960955
      Lubomir Rintel authored
      nm-initrd-generator scans the command line for options relevant to network
      configuration and creates configuration files for an early instance of
      NetworkManager run from the initial ramdisk during early boot.
    • Lubomir Rintel's avatar
      initrd: add command line parser · ecc074b2
      Lubomir Rintel authored
    • Lubomir Rintel's avatar
      initrd: add iBFT reader · b544f724
      Lubomir Rintel authored
      This is loosely based on nms-ibft-reader, but with some significant
      changes. Notably, it parses /sys/firmware/ibft directly instead of
      iscsiadm output.
      iscsiadm is not available on early boot (perhaps it's too large) and
      turns out that parsing sysfs directly is easier and more
      straightforwared anyways. A win-win situation.
      It is not useful alone, it's in a separate commit just for the sake of
      easier review.
    • Beniamino Galvani's avatar
      build: allow disabling eBPF support in n-acd · 691c71a7
      Beniamino Galvani authored
      Add a configure option to disable eBPF support in n-acd.
      Note that, even if eBPF is not supported, n-acd requires a kernel >
      3.19, which means that the setsockopt(..., SO_ATTACH_BPF) option must
      be defined. To allow building on older kernels without modifying the
      n-acd code, we inject the SO_ATTACH_BPF value as a preprocessor define
      in the compiler the command line.
    • Beniamino Galvani's avatar
      acd: adapt NM code and build options · d9a4b59c
      Beniamino Galvani authored
      Adapt the nm-acd-manager.c code to the new API and also tweak build
      options to the new project structure.
    • Beniamino Galvani's avatar
      build: compile the c-rbtree library · 88072c66
      Beniamino Galvani authored
  16. 13 Sep, 2018 6 commits
  17. 04 Sep, 2018 5 commits
    • Thomas Haller's avatar
      build: enable building both crypto backends for tests · e01f7f2c
      Thomas Haller authored
      If the library is available, let's at least compile both
      crypto backends.
      That is helpful when developing on crypto backends, so that
      one does not have to configure the build twice.
      With autotools, the build is only run during `make check`.
      Not for meson, but that is generally the case with our meson
      setup, that it also builds tests during the regular build step.
    • Thomas Haller's avatar
      libnm/crypto: add header "nm-crypto-impl.h" for crypto implementation · 64350408
      Thomas Haller authored
      There are two aspects: the public crypto API that is provided by
      "nm-crypto.h" header, and the internal header which crypto backends
      need to implement. Split them.
    • Thomas Haller's avatar
      libnm/crypto: rename libnm's crypto files · 4106f296
      Thomas Haller authored
      "crypto.h" did not follow our common NM style naming. Rename
      the files.
    • Thomas Haller's avatar
      shared: add "nm-io-utils.h" · 6ee7453b
      Thomas Haller authored
    • Thomas Haller's avatar
      shared: add nm-secret-utils.h helper · b2325087
      Thomas Haller authored
      We already had nm_free_secret() to clear the secret out
      of a NUL terminated string. That works well for secrets
      which are strings, it can be used with a cleanup attribute
      (nm_auto_free_secret) and as a cleanup function for a
      However, it does not work for secrets which are binary.
      For those, we must also track the length of the allocated
      data and clear it.
      Add two new structs NMSecretPtr and NMSecretBuf to help
      with that.