1. 17 Feb, 2017 1 commit
    • Thomas Haller's avatar
      core: use define for atomic-section-prefix setting for NMConfig · 9e5319db
      Thomas Haller authored
      main() should pass the same atomic-section-prefix setting to it's
      NMConfig instances. Currently both are NULL, but make it a define
      to make this explicit.
      
      Also, make static array @default_values const and sanitize value
      when setting PROP_ATOMIC_SECTION_PREFIXES property.
      9e5319db
  2. 10 Feb, 2017 1 commit
    • Thomas Haller's avatar
      dns: fix shutdown to restore non-cached DNS config · ecd3263e
      Thomas Haller authored
      The DNS manager and other singletons have the problem that
      they are not properly destroyed on exit, that is, we leak
      most of the instances. That should be eventually fixed and
      all resources/memory should be released.
      
      Anyway, fix the shutdown procedure by adding an explict command
      nm_dns_manager_shutdown(). We should not rely on cleanup actions
      to take place when the last reference is dropped, because then
      we get complex interactions where we must ensure that everybody
      drops the references at the right pointer.
      
      Since the previous shutdown action was effectively never performed,
      it is not quite clear what we actually want to do on shutdown.
      For now, move the code to nm_dns_manager_stop(). We will see if
      that is the desired behavior.
      ecd3263e
  3. 25 Nov, 2016 3 commits
  4. 21 Nov, 2016 2 commits
    • Thomas Haller's avatar
      build: don't add subdirectories to include search path but require qualified include · 44ecb415
      Thomas Haller authored
      Keep the include paths clean and separate. We use directories to group source
      files together. That makes sense (I guess), but then we should use this
      grouping also when including files. Thus require to #include files with their
      path relative to "src/".
      
      Also, we build various artifacts from the "src/" tree. Instead of having
      individual CFLAGS for each artifact in Makefile.am, the CFLAGS should be
      unified. Previously, the CFLAGS for each artifact differ and are inconsistent
      in which paths they add to the search path. Fix the inconsistency by just
      don't add the paths at all.
      44ecb415
    • Thomas Haller's avatar
      build: rename "src/dhcp-manager" to "src/dhcp" · e0539968
      Thomas Haller authored
      The dhcp directory does not only contain the manager
      instance, but various files related to DHCP.
      
      Rename.
      e0539968
  5. 27 Sep, 2016 1 commit
    • Thomas Haller's avatar
      build: don't add systemd path the include search path · e3a072f3
      Thomas Haller authored
      Our internal copy of systemd should not be in the search path.
      Instead, let users only
        #include "systemd/nm-sd.h"
      which then includes everything from systemd that we need.
      
      We want to avoid to accidentally include anything from our
      systemd-copy. Any user of that should only include "nm-sd.h",
      which then includes everything that is needed further.
      
      For example, "src/devices/wwan/nm-modem-manager.c" has
        #include <systemd/nm-daemon.h>
      which in turn includes
        #include "_sd-common.h"
      This works all correctly before, because #include "" will first
      look in the directory where sd-daemon.h is. However, our mixing of
      external systemd library and internal copy is rather dangerous.
      Try to avoid it further by keeping the include paths clean.
      e3a072f3
  6. 26 Sep, 2016 1 commit
    • Thomas Haller's avatar
      config: store and load device runtime state to file · 93396b8d
      Thomas Haller authored
      The data is still unused, the actual fields might change.
      
      Note that the actual state we store is subject to change,
      according to which data we need. The file format is non stable,
      as the files don't survive reboot. So there is no backward
      compatibility to maintain and the format can be changed later.
      93396b8d
  7. 01 Jun, 2016 1 commit
    • Thomas Haller's avatar
      config: refactor change-flags to be a cause/reason which triggered the change · eb6140a7
      Thomas Haller authored
      For the most part, this patch just renames some change-flags, but
      doesn't change much about them. The new name should better express
      what they are.
      
      A config-change signal can be emitted for different reasons:
      when we receive a signal (SIGHUP, SIGUSR1, SIGUSR2) or for internal
      reasons like resetting of no-auto-default or setting internal
      values.
      
      Depending on the reason, we want to perform different actions.
      For example:
       - we reload the configuration from disk on SIGHUP, but not for
         SIGUSR1.
       - For SIGUSR1 and SIGHUP, we want to update-dns, but not for SIGUSR2.
      
      Another part of the change-flags encodes which part of the configuration
      actually changed. Often, these parts can only change when re-reading
      from disk (e.g. a SIGUSR1 will not change any configuration inside
      NMConfig).
      
      Later, we will have more causes, and accordingly more fine-grained
      effects of what should be done on reload.
      eb6140a7
  8. 30 Apr, 2016 1 commit
    • Thomas Haller's avatar
      build: cleanup includes of <gmodule.h> · c5ac6917
      Thomas Haller authored
      <gmodule.h> is implicitly included by <gio/gio.h> which is available
      everywhere. For that reason, we would not have to include this header
      at all. However, it is recommended to explicitly include <gmodule.h>
      where needed.
      
      So, include it where needed -- if <gio/gio.h> wouldn't be there --
      and drop it from where it is not needed.
      c5ac6917
  9. 07 Apr, 2016 2 commits
  10. 21 Mar, 2016 2 commits
  11. 11 Mar, 2016 2 commits
    • Thomas Haller's avatar
      systemd: split "nm-sd.h" out of "nm-sd-adapt.h" · aed3c810
      Thomas Haller authored
      Now we have:
      
      "nm-sd.h" is a header file of NetworkManager with utilities
      related to systemd. It can be used anywhere freely.
      
      Also, systemd headers that are considered public API (like
      "sd-event.h") can be used without restrictions.
      
      When compiling the systemd sources, we always must include
      "nm-sd-adapt.h" as first. Similarly, systemd headers must
      not include "nm-sd-adapt.h", because they are either public
      (in which case the adapter is not needed) or they are internal
      (in which case they are themself included via a systemd source).
      
      Sometimes, we must internal API (like "dhcp-lease-internal.h").
      In this case, we also must include "nm-sd-adapt.h".
      aed3c810
    • Thomas Haller's avatar
      systemd: integrate sd-event into glib main loop · a8bc65b1
      Thomas Haller authored
      We should not try to reimplement sd-event based on glib,
      instead we should hook sd-event into the glib mainloop.
      a8bc65b1
  12. 03 Mar, 2016 2 commits
    • Thomas Haller's avatar
      all: don't include error->code in log messages · cd4f84b7
      Thomas Haller authored
      
      
      GError codes are only unique per domain, so logging the code without
      also indicating the domain is not helpful. And anyway, if the error
      messages are not distinctive enough to tell the whole story then we
      should fix the error messages.
      Based-on-patch-by: Dan Winship's avatarDan Winship <danw@gnome.org>
      cd4f84b7
    • Thomas Haller's avatar
      all: clean-up usage of GError · 01b9b410
      Thomas Haller authored
      
      
      Functions that take a GError** MUST fill it in on error. There is no
      need to check whether error is NULL if the function it was passed to
      had a failing return value.
      
      Likewise, a proper GError must have a non-NULL message, so there's no
      need to double-check that either.
      Based-on-patch-by: Dan Winship's avatarDan Winship <danw@gnome.org>
      01b9b410
  13. 21 Feb, 2016 1 commit
  14. 19 Feb, 2016 1 commit
    • Thomas Haller's avatar
      all: cleanup includes and let "nm-default.h" include "config.h" · 8bace23b
      Thomas Haller authored
      - All internal source files (except "examples", which are not internal)
        should include "config.h" first. As also all internal source
        files should include "nm-default.h", let "config.h" be included
        by "nm-default.h" and include "nm-default.h" as first in every
        source file.
        We already wanted to include "nm-default.h" before other headers
        because it might contains some fixes (like "nm-glib.h" compatibility)
        that is required first.
      
      - After including "nm-default.h", we optinally allow for including the
        corresponding header file for the source file at hand. The idea
        is to ensure that each header file is self contained.
      
      - Don't include "config.h" or "nm-default.h" in any header file
        (except "nm-sd-adapt.h"). Public headers anyway must not include
        these headers, and internal headers are never included after
        "nm-default.h", as of the first previous point.
      
      - Include all internal headers with quotes instead of angle brackets.
        In practice it doesn't matter, because in our public headers we must
        include other headers with angle brackets. As we use our public
        headers also to compile our interal source files, effectively the
        result must be the same. Still do it for consistency.
      
      - Except for <config.h> itself. Include it with angle brackets as suggested by
        https://www.gnu.org/software/autoconf/manual/autoconf.html#Configuration-Headers
      8bace23b
  15. 22 Nov, 2015 1 commit
  16. 13 Nov, 2015 1 commit
    • Beniamino Galvani's avatar
      core: fix failed assertion when D-Bus service is already taken · f1b4eb95
      Beniamino Galvani authored
      When exiting after an error we must set the quitting flag in
      nm-exported-object.c because during program destruction there can be
      still exported objects which get disposed.
      
      Fixes the following assertion:
      
       NetworkManager[14241]: (nm-exported-object.c:826):nm_exported_object_dispose: code should not be reached
      
       Process terminating with default action of signal 5 (SIGTRAP)
          at 0x7ACFD3B: _g_log_abort (gmessages.c:315)
          by 0x7ACFD3B: g_logv (gmessages.c:1041)
          by 0x7ACFEAE: g_log (gmessages.c:1079)
          by 0x7AD0196: g_warn_message (gmessages.c:1112)
          by 0x20F5B0:  nm_exported_object_dispose (nm-exported-object.c:826)
          by 0x316FC4:  dispose (nm-settings.c:2222)
          by 0x7841A5B: g_object_unref (gobject.c:3137)
          by 0x2330F3:  dispose (nm-manager.c:5249)
          by 0x7841A5B: g_object_unref (gobject.c:3137)
          by 0x23C511:  _nm_singleton_instance_destroy (NetworkManagerUtils.c:174)
          by 0x400FBE6: _dl_fini (in /usr/lib64/ld-2.21.so)
          by 0x8009647: __run_exit_handlers (in /usr/lib64/libc-2.21.so)
          by 0x8009694: exit (in /usr/lib64/libc-2.21.so)
      f1b4eb95
  17. 10 Nov, 2015 1 commit
    • Dan Williams's avatar
      core: explicitly unexport objects when we're done with them · f9ee20a7
      Dan Williams authored
      Previously most objects were implicitly unexported when they were
      destroyed, but since refcounts may make the object live longer than
      intended, we should explicitly unexport them when they should no
      longer be present on the bus.
      
      This means we can assume that objects will always be un-exported
      already when they are destroyed, *except* when quitting where most
      objects will live until exit because NM leaves interfaces up and
      running on quit.
      f9ee20a7
  18. 15 Sep, 2015 2 commits
  19. 13 Aug, 2015 3 commits
  20. 10 Aug, 2015 4 commits
    • Dan Winship's avatar
      core: final gdbus porting · 1cf35cb2
      Dan Winship authored
      Port remaining bits to gdbus and remove stray dbus-glib references
      
      Drop the dbus-glib version check from configure, since nothing depends
      on new dbus-glib any more.
      
      Move nm-dbus-glib-types.h and nm-gvaluearray-compat.h from include/ to
      libnm-util/ since they are now only used by libnm-util and libnm-glib.
      1cf35cb2
    • Dan Winship's avatar
      core: make NMManager singleton more like others · 284e15a8
      Dan Winship authored
      Rename nm_manager_new() to nm_manager_setup(), and change the local
      @singleton variable to @singleton_instance. (Also, add a local @self
      variable inside nm_manager_setup().)
      
      Also, make NMManager own NMSettings rather than having them both owned
      by main().
      284e15a8
    • Dan Winship's avatar
      core: better order the code at startup · b7911bae
      Dan Winship authored
      NM was calling nm_bus_manager_start_service() to claim its bus name
      before it exported any of its objects, but this didn't matter under
      dbus-glib, because no client connections would be accepted until the
      main loop was started later on, by which point we would have exported
      everything.
      
      But with gdbus, method calls are initially received in the gdbus
      worker thread, which means that clients would be able to connect right
      away and then be told that the expected interfaces don't exist.
      
      So move the nm_bus_manager_start_service() call to occur after
      creating NMSettings and NMManager (and, indirectly, NMAgentManager).
      This requires splitting out the slow parts of nm_settings_new() into a
      new nm_settings_start(), so that we can create and export it first,
      and then read the connections, etc afterward. (Likewise, there were
      still a few potentially-slow bits in nm_manager_new() which are now
      moved into nm_manager_start().)
      b7911bae
    • Dan Winship's avatar
      core: fix NMManager in private-bus-only case · 1c11c5cf
      Dan Winship authored
      NMManager was failing to initialize if there was only a private bus,
      despite the fact that this is exactly the use case that the private
      bus was added for.
      
      The only other potentially-failing code in nm_manager_new() was adding
      prop_filter to the D-Bus connection, but this can't really fail, so
      just assert that it doesn't. And now, nm_manager_new() always
      succeeds, so update the caller for that.
      1c11c5cf
  21. 05 Aug, 2015 3 commits
    • Dan Winship's avatar
      all: drop includes to <glib/gi18n.h> for "nm-default.h" · 22e1a97e
      Dan Winship authored
      The localization headers are now included via "nm-default.h".
      
      Also fixes several places, where we wrongly included <glib/gi18n-lib.h>
      instead of <glib/gi18n.h>. For example under "clients/" directory.
      22e1a97e
    • Thomas Haller's avatar
      19c3ea94
    • Thomas Haller's avatar
      core: order destruction of singleton instances · 2cf274c0
      Thomas Haller authored
      Previously, the order of destructing singleton instances
      was undefined. Now, have singleton instances register their
      destruction via nm_singleton_instance_register().
      
      Objects that are registered later, will be destructed earlier. IOW,
      they will be destroyed in reverse order of construction.
      
      This is only a crude method to get the lifetime of singleton instances
      right by default. Having singletons ref other singletons to keep them
      alive gives more control over the lifetimes of singletons. This change
      of having a defined order of destruction does not conflict with taking
      references to singletons (and thus extending their lifetime).
      
      Note that previously, NMPlatform was not registered for destruction.
      We don't change that yet and intenionally leak a reference.
      2cf274c0
  22. 24 Jul, 2015 2 commits
    • Dan Winship's avatar
      core: rename NMDBusManager to NMBusManager · 02370be7
      Dan Winship authored
      Our gdbus generated types use the same names as their corresponding
      "real" types, but with "NM" changed to "NMDBus".
      
      Unfortunately, that means that introspection/nmdbus-manager.c (the
      generated type for src/nm-manager.c) uses the same type name as the
      entirely unrelated src/nm-dbus-manager.c.
      
      Fix this by removing the "d" from src/nm-dbus-manager.c. (We could
      rename the generated type instead, but then it becomes inconsistent
      with all the other generated types, and we're already using it as
      "NMDBusManager" in libnm/nm-manager.c.)
      02370be7
    • Dan Winship's avatar
      all: rename nm-glib-compat.h to nm-glib.h, use everywhere · 3452ee2a
      Dan Winship authored
      Rather than randomly including one or more of <glib.h>,
      <glib-object.h>, and <gio/gio.h> everywhere (and forgetting to include
      "nm-glib-compat.h" most of the time), rename nm-glib-compat.h to
      nm-glib.h, include <gio/gio.h> from there, and then change all .c
      files in NM to include "nm-glib.h" rather than including the glib
      headers directly.
      
      (Public headers files still have to include the real glib headers,
      since nm-glib.h isn't installed...)
      
      Also, remove glib includes from header files that are already
      including a base object header file (which must itself already include
      the glib headers).
      3452ee2a
  23. 14 Jul, 2015 2 commits
    • Thomas Haller's avatar
      logging: make use of journal configurable · 96a7f3a3
      Thomas Haller authored
      96a7f3a3
    • Thomas Haller's avatar
      logging: remove nm_logging_syslog_closelog() · 9020cd1a
      Thomas Haller authored
      Remove nm_logging_syslog_closelog(). The reasons are:
      
        - closelog() is optional according to the manual.
      
        - we called nm_logging_syslog_closelog() at the end of the
          main() function. But we have destructors running afterwards,
          so we were closing the log before logging the last line.
          Apparently that had no bad consequences either, so why was
          closelog() even useful?
          Also, it's hard to determine when we log the last line and
          only closelog() afterwards.
      
        - closelog() does not revert what openlog() did, this is ugly.
      9020cd1a