1. 18 Apr, 2019 1 commit
    • Thomas Haller's avatar
      shared: move most of "shared/nm-utils" to "shared/nm-glib-aux" · d984b2ce
      Thomas Haller authored
      From the files under "shared/nm-utils" we build an internal library
      that provides glib-based helper utilities.
      
      Move the files of that basic library to a new subdirectory
      "shared/nm-glib-aux" and rename the helper library "libnm-core-base.la"
      to "libnm-glib-aux.la".
      
      Reasons:
      
       - the name "utils" is overused in our code-base. Everything's an
         "utils". Give this thing a more distinct name.
      
       - there were additional files under "shared/nm-utils", which are not
         part of this internal library "libnm-utils-base.la". All the files
         that are part of this library should be together in the same
         directory, but files that are not, should not be there.
      
       - the new name should better convey what this library is and what is isn't:
         it's a set of utilities and helper functions that extend glib with
         funcitonality that we commonly need.
      
      There are still some files left under "shared/nm-utils". They have less
      a unifying propose to be in their own directory, so I leave them there
      for now. But at least they are separate from "shared/nm-glib-aux",
      which has a very clear purpose.
      
      (cherry picked from commit 80db06f7)
      d984b2ce
  2. 05 Feb, 2019 3 commits
    • Thomas Haller's avatar
      logging: make nm-logging thread-safe · fcfd4f4f
      Thomas Haller authored
      NetworkManager is single-threaded and uses a mainloop.
      
      However, sometimes we may need multiple threads. For example, we will
      need to write sysctl values asynchronously, using the glib thread-pool.
      For that to work, we also need to switch the network-namespace of the
      thread-pool thread. We want to use NMPNetns for that. Hence it's better
      to have NMPNetns thread-safe, instead of coming up with a duplicate
      implementation. But NMPNetns may want to log, so we also need nm-logging
      thread-safe.
      
      In general, code under "shared/nm-utils" and nm-logging should be usable
      from multiple threads. It's simpler to make this code thread-safe than
      re-implementing it. Also, it's a bad limitation to be unable to log
      from other threads. If there is an error, the best we can often do is to
      log about it.
      
      Make nm-logging thread-safe. Actually, we only need to be able to log
      from multiple threads. We don't need to setup or configure logging from
      multiple threads. This restriction allows us to access logging from the
      main-thread without any thread-synchronization (because all changes in
      the logging setup are also done from the main-thread).
      
      So, while logging from other threads requires a mutex, logging from the
      main-thread is lock-free.
      fcfd4f4f
    • Thomas Haller's avatar
      logging: refactor and merge early logging initialization · 729feb0a
      Thomas Haller authored
      Instead of having two functions nm_logging_set_syslog_identifier()
      and nm_logging_set_prefix(), merge them.
      
      They must both be called at earliest point and together. No point
      in giving them the appearance that they could be called any time.
      729feb0a
    • Thomas Haller's avatar
      logging: make _nm_logging_clear_platform_logging_cache() a regular function · ba1bf039
      Thomas Haller authored
      Previously, _nm_logging_clear_platform_logging_cache was an extern variable,
      and NMLinuxPlatform would set it to a function pointer at certain points.
      
      That's unnecessary complex, also when trying to make nm-logging thread-safe,
      it's just more global variables that need to be considered. Don't do it
      that way, but just link in a regular function.
      ba1bf039
  3. 02 Jan, 2019 1 commit
    • 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.
      ef53b47e
  4. 29 Nov, 2018 1 commit
    • Lubomir Rintel's avatar
      all: say Wi-Fi instead of "wifi" or "WiFi" · b385ad01
      Lubomir Rintel authored
      Correct the spelling across the *entire* tree, including translations,
      comments, etc. It's easier that way.
      
      Even the places where it's not exposed to the user, such as tests, so
      that we learn how is it spelled correctly.
      b385ad01
  5. 18 Oct, 2018 1 commit
  6. 27 Aug, 2018 1 commit
    • Thomas Haller's avatar
      build: always define NM_MORE_LOGGING define and don't check with #ifdef · 3b5f8c91
      Thomas Haller authored
      Using '#ifdef' is generally error prone. It's better to always define
      a define and check for it explicitly. This way, the compiler can issue
      a warning if the define does not exist.
      
      Also, note how meson would always define NM_MORE_LOGGING, possibly to
      "0". That means, for meson, we unintentionally always enabled more
      logging because the define was always present.
      
      Fix that.
      3b5f8c91
  7. 27 Jun, 2018 2 commits
    • Thomas Haller's avatar
      logging: warn about invalid logging backends and drop "debug" backend · dbd48f26
      Thomas Haller authored
      "debug" was documentation in `man NetworkManager.conf` as a valid
      logging backend. However, it was completely ignored by
      nm_logging_syslog_openlog().
      In fact, it makes not sense. Passing debug = TRUE to
      nm_logging_syslog_openlog(), means that all messages will be
      printed to stderr in addition to syslog/journal. However, when
      NetworkManager is daemonizing, stderr is closed.
      Whether NetworkManager is daemonizing depends entirely on command
      line options --no-daemon and --debug. Hence, the logging backend "debug"
      from the configuration file either conflicts or is redundant.
      
      Also, adjust logging backend description in `man NetworkManager.conf`.
      
      Also, log a warning about invalid/unsupported logging backend.
      
      (cherry picked from commit 2ccf6168)
      dbd48f26
    • Thomas Haller's avatar
      logging: warn about invalid logging backends and drop "debug" backend · 2ccf6168
      Thomas Haller authored
      "debug" was documentation in `man NetworkManager.conf` as a valid
      logging backend. However, it was completely ignored by
      nm_logging_syslog_openlog().
      In fact, it makes not sense. Passing debug = TRUE to
      nm_logging_syslog_openlog(), means that all messages will be
      printed to stderr in addition to syslog/journal. However, when
      NetworkManager is daemonizing, stderr is closed.
      Whether NetworkManager is daemonizing depends entirely on command
      line options --no-daemon and --debug. Hence, the logging backend "debug"
      from the configuration file either conflicts or is redundant.
      
      Also, adjust logging backend description in `man NetworkManager.conf`.
      
      Also, log a warning about invalid/unsupported logging backend.
      2ccf6168
  8. 30 Apr, 2018 1 commit
  9. 18 Apr, 2018 1 commit
  10. 20 Mar, 2018 1 commit
  11. 30 Oct, 2017 1 commit
  12. 08 Jun, 2017 1 commit
  13. 15 May, 2017 1 commit
  14. 24 Mar, 2017 2 commits
  15. 14 Oct, 2016 1 commit
  16. 11 Oct, 2016 1 commit
  17. 06 Oct, 2016 1 commit
    • Thomas Haller's avatar
      logging: allow setting the syslog-identifier not to use G_LOG_DOMAIN · fd12aa1b
      Thomas Haller authored
      For nm-iface-helper we want to use a different syslog-identifier then
      "NetworkManager".
      
      Since we build "nm-logging.c" as part of libNetworkManagerBase.la,
      it would be cumbersome to compile the logging part multiple times
      with different -DG_LOG_DOMAIN settings.
      
      Instead, allow configuring at runtime.
      fd12aa1b
  18. 05 Oct, 2016 1 commit
  19. 04 Oct, 2016 1 commit
    • Atul Anand's avatar
      src:(pacrunner-manager): Object for interaction with PacRunner · fd0b9ab5
      Atul Anand authored
      A new object NMPacRunnerManager has been added to manage and interact
      PacRunner. It invokes both DBus methods on PacRunner DBus interface.
      It stores the returned object path from CreateProxyConfiguration()
      to feed as parameter to DestroyProxyCofiguration() when network goes down.
      fd0b9ab5
  20. 05 Jul, 2016 1 commit
    • Thomas Haller's avatar
      logging: don't log the function name · 8583791e
      Thomas Haller authored
      The function name is no longer visible in the default
      logging output. It is anyway only used together with
      journal logging to set "CODE_FUNC".
      
      Drop it. It allows to remove the strings from the binary,
      which decreases the object size of a default build of NetworkManager
      from 2437400 to 2412824 bytes (-24k, -1%).
      8583791e
  21. 17 Jun, 2016 1 commit
    • Thomas Haller's avatar
      logging: enable logging domain VPN_PLUGIN up to level <info> · 4143fbde
      Thomas Haller authored
      The logging domain VPN_PLUGIN controlls logging of the VPN plugins.
      Especially at verbose levels <debug> and <trace>, the plugins might
      reveal sensitive information in the logging.
      
      Thus, this level should not be enabled by a
      
        $ nmcli logging general level DEBUG domains ALL
      
      It should only be enabled when requested explicitly.
      
        $ nmcli logging general level DEBUG domains ALL,VPN_PLUGIN:DEBUG
      
      Previously, the special level VPN_PLUGIN was entirely excluded from
      ALL and DEFAULT domains and it was entirely disabled by default. That
      is however to strict, as it completely silences the VPN plugins by
      defult. Now, enable them by default up to level INFO.
      
      VPN plugins should take care that they don't reveal sensitive
      information at levels <info> (LOG_NOTICE) and higher (less verbose).
      For more verbose levels they may print passwords, but that should
      still be avoided as far as possible.
      4143fbde
  22. 05 Jun, 2016 1 commit
  23. 24 May, 2016 3 commits
  24. 22 May, 2016 1 commit
    • Thomas Haller's avatar
      logging: add check for logging level in nm_logging_enabled() · f8cc7315
      Thomas Haller authored
      With this check, the function is safe to use even with invalid
      logging levels. But it can still be inlined as for most cases
      @level is a (enum) constant and the check can be evaluated at
      compile time.
      
      Oddly enough, on a default build with
        ./autogen.sh && make && strip ./src/NetworkManager
      this patch decreases the size of the binary by 8k.
      f8cc7315
  25. 20 May, 2016 1 commit
    • Thomas Haller's avatar
      logging: make nm_logging_enabled() inline function · 4ed1784c
      Thomas Haller authored
      Basically every logging statement is wrapped by a nm_logging_enabled()
      to evaluate the function call of the logging lazy.
      
      Make the function a candidate for inlining, it safes some space. On
      a default build it goes for me from 2580584 to 2560104 bytes (20k).
      
         $ ./autogen.sh && make && strip ./src/NetworkManager
      4ed1784c
  26. 17 Mar, 2016 1 commit
  27. 04 Mar, 2016 1 commit
  28. 01 Mar, 2016 1 commit
    • Thomas Haller's avatar
      logging: make logging independent of platform · e4a7502a
      Thomas Haller authored
      "nm-logging.h" is a basic core module that should have few other
      dependencies. Instead of letting nm-logging.c directly call a function
      from "nm-linux-platform.c", let platform register a handler as needed.
      
      This way, you can build a core library containing nm-logging but no
      nm-platform.
      e4a7502a
  29. 12 Feb, 2016 1 commit
    • Thomas Haller's avatar
      build: cleanup default includes · 2c2d9d2e
      Thomas Haller authored
      - "gsystem-local-alloc.h" and <gio/gio.h> are already included via
        "nm-default.h". No need to include them separately.
      
      - include "nm-macros-internal.h" via "nm-default.h" and drop all
        explict includes.
      
      - in the modified files, ensure that we always include "config.h"
        and "nm-default.h" first. As second, include the header file
        for the current source file (if applicable). Then follow external
        includes and finally internal nm includes.
      
      - include nm headers inside source code files with quotes
      
      - internal header files don't need to include default headers.
        They can savely assume that "nm-default.h" is already included
        and with it glib, nm-glib.h, nm-macros-internal.h, etc.
      2c2d9d2e
  30. 05 Feb, 2016 2 commits
  31. 06 Nov, 2015 1 commit
    • Thomas Haller's avatar
      logging: swap names of logging macros _LOGT() and _LOGt() · 95878673
      Thomas Haller authored
      Previsously, _LOGT() could be disabled at compile time. Thus it
      was different then the other macros _LOGD(), _LOGI(), etc.
      
      OTOH, _LOGt() was the macro that always was compiled in.
      
      Swap the name of the macros. Now the upper-case macros are always
      enabled, while the lower-case macro _LOGt() is enabled depending
      on compile configuration.
      95878673
  32. 09 Oct, 2015 1 commit
    • Thomas Haller's avatar
      logging: add special logging level "KEEP" · fd87ce50
      Thomas Haller authored
      Without this, the user cannot configure only certain logging domains
      without touching them all.
      
      E.g.
      
        # nmcli general logging level DEBUG domains PLATFORM
      
      will disable all non-PLATFORM domains.
      Well, the user can do:
      
        # nmcli general logging level INFO domains PLATFORM:DEBUG
        # nmcli general logging level DEBUG domains ALL:INFO,PLATFORM
      
      but in this case all non-PLATFORM domains are reset explicitly.
      
      Now the user can:
      
        # nmcli general logging level KEEP domains PLATFORM:DEBUG
        # nmcli general logging level DEBUG domains ALL:KEEP,PLATFORM
      
      which will only change the platform domain.
      fd87ce50
  33. 04 Sep, 2015 1 commit
    • Thomas Haller's avatar
      logging: introduce an alternative set of logging macros · ed5ebf7e
      Thomas Haller authored
      We already have the macros _LOGD(), _LOGI(), etc. to provide context sensitive
      logging (such as printing the object pointer as prefix).
      
      In some implementations, we would like to have a second set of logging
      macros, that shall be used differently. For example, use the default
      _LOGD() for messages that are explicitly issued by one objects, and use
      _LOG2D() in a static context when no object is around.
      
      The "_LOG2" prefix is not great from a naming point of view. However, it is
      meant to be a second (alternative) set of logging macros with the same
      usage pattern as the _LOGD() macros.
      ed5ebf7e