1. 18 Jan, 2018 1 commit
  2. 23 Nov, 2017 1 commit
  3. 16 Nov, 2017 1 commit
    • Thomas Haller's avatar
      all: use nm_str_hash() instead of g_str_hash() · a6be2f4a
      Thomas Haller authored
      We also do this for libnm and libnm-core, where it causes visible changes
      in behavior. But if somebody would rely on the hashing implementation
      for hash tables, it would be seriously flawed.
      a6be2f4a
  4. 30 Oct, 2017 4 commits
  5. 26 Oct, 2017 2 commits
    • Thomas Haller's avatar
      libnm: fix the return value of nm_setting_diff() if a results hash was given · 975eeda6
      Thomas Haller authored
      Previously, nm_setting_diff() would return !(*results), that means,
      if the caller passed in a hash table (empty or not), the return value
      would always be FALSE, indicating a difference.
      
      That is not documented, and makes no sense.
      
      The return value, should solely indicate whether some difference was
      found. The only convenience is, if nm_setting_diff() created a hash
      table internally and no difference was found, it would destroy
      it again, without returning it to the caller.
      975eeda6
    • Thomas Haller's avatar
      libnm: fix nm_connection_diff() for settings without properties · 6f94b165
      Thomas Haller authored
      NMSettingGeneric has no properties at all. Hence, nm_connection_diff() would report that
      a connection A with a generic setting and a connection B without a generic setting are
      equal.
      
      They are not. For empty settings, let nm_setting_diff() return also empty difference
      hash.
      6f94b165
  6. 07 Jun, 2017 4 commits
    • Thomas Haller's avatar
      libnm: streamline functions in nm-connection.c · 4c094adf
      Thomas Haller authored
      Functions call each other, like
      
        nm_connection_get_id()
          nm_connection_get_setting_connection()
            nm_connection_get_setting()
      
      Along the way, each function asserts that the input argument
      is of type NMConnection via
      
          g_return_val_if_fail (NM_IS_CONNECTION (connection), NULL);
      
      Avoid such duplicate assertions when we already verifyied the
      input argument.
      
      For example, in case of nm_connection_get_id(), don't check just call
      nm_connection_get_setting_connection() right away. It already
      asserts.
      
      The downside is, that the assertion no longer fails in the function
      that immediately called it. But these are assertions after all.
      4c094adf
    • Thomas Haller's avatar
      libnm: downgrade assertions in _nm_register_setting_impl() to nm_assert() · 1d6b7174
      Thomas Haller authored
      This is entirely internal API. We have unit tests that execute these
      code paths. No need to have these assertions in production code.
      1d6b7174
    • Thomas Haller's avatar
      libnm: add enum for setting priorities · a973eacb
      Thomas Haller authored
      Using plain numbers make it cumbersome to grep for
      setting types by priority.
      
      The only downside is, that with the enum values it
      is no longer obvious which value has higher or lower
      priority.
      
      Also, introduce NM_SETTING_PRIORITY_INVALID. This is what
      _nm_setting_type_get_base_type_priority() returns. For the moment
      it still has the same numerical value 0 as before. Later, that
      shall be distinct from NM_SETTING_PRIORITY_CONNECTION.
      a973eacb
    • Thomas Haller's avatar
      libnm/trivial: rename _nm_register_setting function to _nm_register_setting_impl · c7e9f978
      Thomas Haller authored
      Avoid having the function _nm_register_setting() shadowed by a macro
      of the same name, but different behavior/arguments.
      c7e9f978
  7. 31 May, 2017 2 commits
    • Lubomir Rintel's avatar
      core: negotiate the best base setting · 2c1a178f
      Lubomir Rintel authored
      When the two base settings are present, use one of higher priority.
      
      This will pick the "bridge" setting when both "bridge" and "bluetooth" are
      present for a Bluetooth NAP connection.
      2c1a178f
    • Lubomir Rintel's avatar
      core: allow two priorities of base settings · 7b5712ac
      Lubomir Rintel authored
      We'll need two "base" settings for Bluetooth NAP connections: bridge to set up
      the actual link and bluetooth to identify the HCI to register the network
      server with.
      
      Let's use two priorities for base setting, with "1" marking one of higher
      priority and "2" of lower priority when both are present.
      7b5712ac
  8. 28 Mar, 2017 1 commit
  9. 10 Feb, 2017 1 commit
  10. 03 Oct, 2016 1 commit
  11. 12 May, 2016 1 commit
  12. 26 Mar, 2016 1 commit
    • Thomas Haller's avatar
      libnm-core: allow strict and relaxed error behavior for _nm_setting_new_from_dbus() · 737c8cc5
      Thomas Haller authored
      In some situations, we want strict checking of errors, for example when
      NetworkManager receives a new connection from a client, the connection
      must make sense as a whole (and since NetworkManager service is backward
      compatible to the clients and not the other way around, there is no
      excuse for sending invalid data to the server).
      
      In other situations, we want a best-effort behavior. Like when
      NetworkManager sends a connection to its clients, those clients
      want to extract as many properties as they understand, but in order
      to be forward compatible against newer server versions, invalid
      or unknown properties must be accepted.
      
      Previously, a mixture of both was done. Some issues caused a failure
      to create a new NMSetting, other invalid parts were just silently
      ignored or triggered a g_warning() in glib.
      
      Now allow for both. When doing strict-validation, be more strict and
      reject all unknown properties and catch when the user sets an invalid
      argument. On the other hand, allow for a best-effort mode that
      effectively cannot fail and will return a new NMSetting instance.
      
      For now, add NMSettingParseFlags so that the caller can choose the
      old behavior, strict parsing, or best effort.
      
      This patch doesn't have any externally visible change except that
      no more g_warnings will be emitted.
      737c8cc5
  13. 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
  14. 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
  15. 20 Nov, 2015 1 commit
  16. 18 Sep, 2015 2 commits
  17. 05 Aug, 2015 2 commits
  18. 24 Jul, 2015 1 commit
    • 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
  19. 12 Jul, 2015 1 commit
  20. 05 Jun, 2015 1 commit
    • Thomas Haller's avatar
      libnm: fix compare_property() to handle default values · 7478c4b5
      Thomas Haller authored
      Before, get_property_for_dbus() would @ignore_defaults.
      That is for example wrong for properties of type G_TYPE_STRV.
      
      In this case, if one operand has the property at its default
      (NULL) and the other has it to an empty string list, both would
      compare equal.
      
      This has the effect that different settings might compare equal.
      7478c4b5
  21. 02 Jun, 2015 1 commit
  22. 20 Mar, 2015 2 commits
  23. 28 Jan, 2015 1 commit
  24. 16 Jan, 2015 1 commit
  25. 15 Jan, 2015 3 commits
  26. 19 Nov, 2014 2 commits
    • Dan Winship's avatar
      libnm: fix nm-setting-docs.xml property types · 780d8bf2
      Dan Winship authored
      Add nm_setting_get_dbus_property_type(), and use this to get the
      correct type for properties in nm-seting-docs.xml, in situations where
      the D-Bus and GObject property types don't match.
      
      In the case of enum/flags-valued properties, give both the enum name
      and the underlying D-Bus type.
      780d8bf2
    • Dan Winship's avatar
      libnm-core: make GBytes D-Bus marshalling be built-in to NMSetting · 2f81a8bc
      Dan Winship authored
      Each GBytes-valued property was using
      _nm_setting_class_transform_property() to register a GBytes<->'ay'
      transform. So just build that rule into the generic machinery in
      nm-setting.c.
      2f81a8bc