1. 07 May, 2019 1 commit
    • Thomas Haller's avatar
      libnm: use macro and designated initializers for NMVariantAttributeSpec · 86dc50d4
      Thomas Haller authored
      I think initializing structs should (almost) be always done with designated
      initializers, because otherwise it's easy to get the order wrong. The
      problem is that otherwise the order of fields gets additional meaning
      not only for the memory layout, but also for the code that initialize
      the structs.
      Add a macro NM_VARIANT_ATTRIBUTE_SPEC_DEFINE() that replaces the other
      (duplicate) macros. This macro also gets it right to mark the struct as
  2. 01 May, 2019 1 commit
    • Thomas Haller's avatar
      libnm: unify property-to-dbus handling of NMSetting · 0d1b8ee9
      Thomas Haller authored
      Merge the function pointer get_func() into to_dbus_fcn().
      Previously, get_func() as handled separately from to_dbus_fnc()
      (formerly synth_func()). The notion was that synth-func would syntetize
      properties that are D-Bus only. But that distinction does not seem
      very helpful to me.
      Instaed, we want to convert a property to D-Bus. Period. The
      implementation should be handled uniformly. Hence, now that is
      all done by property_to_dbus().
      Note that property_to_dbus() is also called as default implementation
      for compare-property. At least, for properties that are backed by a
      GObject property.
  3. 26 Mar, 2019 1 commit
  4. 24 Mar, 2019 3 commits
  5. 14 Feb, 2019 1 commit
  6. 01 Feb, 2019 1 commit
  7. 07 Jan, 2019 1 commit
    • Thomas Haller's avatar
      libnm: pass serialization flags to settings synth_func() · e8bf89a9
      Thomas Haller authored
      We will need access to the serialization flags from within the synth_func().
      That will be for WireGuard's peers. Peers are a list of complex, structured
      elements, and some fields (the peer's preshared-key) are secret and
      others are not. So when serializing the peers, we need to know whether
      to include secrets or not.
      Instead of letting _nm_setting_to_dbus() check the flags, pass them
      While at it, don't pass the property_name argument. Instead, pass the
      entire meta-data information we have. Most synth functions don't care
      about the property or the name either way. But we should not pre-filter
      information that we have at hand. Just pass it to the synth function.
      If the synth function would be public API, that would be a reason to be
      careful about what we pass. But it isn't and it only has one caller.
      So passing it along is fine. Also, do it now when adding the flags
      argument, as we touch all synth implementations anyway.
  8. 22 Aug, 2018 1 commit
  9. 11 Jul, 2018 2 commits
  10. 08 Jan, 2018 1 commit
    • 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
      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.
  11. 11 Dec, 2017 1 commit
    • Lubomir Rintel's avatar
      libnm-core/utils: add some special properties for the attributes · 47b1dc38
      Lubomir Rintel authored
      "no_value" indicates that the the attribute is a single word, not a
      key=value pair. If the type is BOOLEAN then the attribute is considered
      true, if it's a STRING then the key is used instead of a value.
      "consumes_rest" indicates that the particular key takes the unparseable
      tail of the string for a value.
      This allows parsing tc-style strings. Consider this filter:
                    ,------ regular key/value pair
        root handle 1234: matchall action simple foo bar baz
          |                  |     `-----------.-----------'
          |                  |                 `- "", STRING, consumes_rest
          |                  `------------------- "kind", STRING, no_value
          `-------------------------------------- "root', BOOLEAN, no_value
  12. 07 Dec, 2017 2 commits
  13. 09 Nov, 2017 2 commits
  14. 06 Mar, 2017 2 commits
    • Beniamino Galvani's avatar
      libnm-core: define known route attribute names and validation function · 54e58eb9
      Beniamino Galvani authored
      This adds definition of a set of known route option attributes to
      libnm-core and helper functions.
      nm_ip_route_attribute_validate() performs the validation of the
      attribute type and, in case of a formatted string attribute, of its
      nm_ip_route_get_variant_attribute_spec() returns the attribute format
      specifier to be passed to nm_utils_parse_variant_attributes(). Since
      at the moment NMIPRoute is the only user of NMVariantAttributeSpec and
      the type is opaque to users of the library, the struct is extended to
      carry some other data useful for validation.
    • Beniamino Galvani's avatar
      libnm-core: add attribute parsing/format helpers · 93b3a478
      Beniamino Galvani authored
      Various libnm objects (addresses, routes) carry an hash table of
      attributes represented as GVariants indexed by name. Add common
      routines to convert to and from a string representation.
      To parse a string, a knowledge of the supported attributes (and their
      types) is needed: we represent it as an opaque type
      NMVariantAttributeSpec that callers must query to the library for the
      specific object type and pass to the parse function.
  15. 30 Aug, 2016 1 commit
    • Beniamino Galvani's avatar
      team: normalize invalid configuration during load · d6ec009a
      Beniamino Galvani authored
      Now that we validate the JSON syntax of a team/team-port
      configuration, any existing connection with invalid JSON configuration
      would fail to load and disappear upon upgrade. Instead, modify the
      setting plugins to emit a warning but still load the connection with
      empty configuration.
  16. 30 Jun, 2016 1 commit
    • Thomas Haller's avatar
      device: extend MAC address handling including randomization for ethernet and wifi · 8eed6712
      Thomas Haller authored
      Extend the "ethernet.cloned-mac-address" and "wifi.cloned-mac-address"
      settings. Instead of specifying an explicit MAC address, the additional
      special values "permanent", "preserve", "random", "random-bia", "stable" and
      "stable-bia" are supported.
      "permanent" means to use the permanent hardware address. Previously that
      was the default if no explict cloned-mac-address was set. The default is
      thus still "permanent", but it can be overwritten by global
      "preserve" means not to configure the MAC address when activating the
      device. That was actually the default behavior before introducing MAC
      address handling with commit 1b49f941.
      "random" and "random-bia" use a randomized MAC address for each
      connection. "stable" and "stable-bia" use a generated, stable
      address based on some token. The "bia" suffix says to generate a
      burned-in address. The stable method by default uses as token the
      connection UUID, but the token can be explicitly choosen via
      "stable:<TOKEN>" and "stable-bia:<TOKEN>".
      On a D-Bus level, the "cloned-mac-address" is a bytestring and thus
      cannot express the new forms. It is replaced by the new
      "assigned-mac-address" field. For the GObject property, libnm's API,
      nmcli, keyfile, etc. the old name "cloned-mac-address" is still used.
      Deprecating the old field seems more complicated then just extending
      the use of the existing "cloned-mac-address" field, although the name
      doesn't match well with the extended meaning.
      There is some overlap with the "wifi.mac-address-randomization" setting.
  17. 18 Apr, 2016 1 commit
  18. 02 Jul, 2015 1 commit
  19. 20 May, 2015 2 commits
  20. 13 May, 2015 1 commit
  21. 03 Dec, 2014 1 commit
  22. 07 Nov, 2014 1 commit
  23. 28 Oct, 2014 1 commit
  24. 27 Oct, 2014 1 commit
  25. 18 Sep, 2014 2 commits
    • Dan Winship's avatar
      libnm: port to GDBus · 6793a32a
      Dan Winship authored
      Port libnm-core/libnm to GDBus.
      The NetworkManager daemon continues to use dbus-glib; the
      previously-added connection hash/variant conversion methods are now
      moved to NetworkManagerUtils (along with a few other utilities that
      are now only needed by the daemon code).
    • Dan Winship's avatar
      libnm-core: change connection hash tables to variants in API · acf86f68
      Dan Winship authored
      In preparation for porting to GDBus, make nm_connection_to_dbus(),
      etc, represent connections as GVariants of type 'a{sa{sv}}' rather
      than as GHashTables-of-GHashTables-of-GValues.
      This means we're constantly converting back and forth internally, but
      this is just a stepping stone on the way to the full GDBus port, and
      all of that code will go away again later.
  26. 10 Sep, 2014 1 commit
  27. 04 Sep, 2014 5 commits
    • Dan Winship's avatar
      libnm-core: change DBUS_TYPE_G_UCHAR_ARRAY properties to G_TYPE_BYTES · c43f8890
      Dan Winship authored
      Change all DBUS_TYPE_G_UCHAR_ARRAY properties to G_TYPE_BYTES, and
      update corresponding APIs. Notably, this means they are now refcounted
      rather than being copied.
      Update the rest of NM for the changes. The daemon still converts SSIDs
      to GByteArrays internally, because changing it to use GBytes has lots
      of trickle-down effects. It can possibly be changed later.
    • Dan Winship's avatar
      libnm-core: improve NMSettingIP4Config / NMSettingIP6Config property types · 98375657
      Dan Winship authored
      Make the :addresses and :routes properties be GPtrArrays of
      NMIP4Address, etc, rather than just reflecting the D-Bus data.
      Make the :dns properties be arrays of strings rather than arrays of
      binary IP addresses (and update the corresponding APIs as well).
    • Dan Winship's avatar
      libnm-core: change map-of-string properties to G_TYPE_HASH_TABLE · 9ed6bd2b
      Dan Winship authored
      Change all DBUS_TYPE_G_MAP_OF_STRING properties to G_TYPE_HASH_TABLE,
      with annotations indicating they are string->string. Not much outside
      libnm-core needs to changed for this, since DBUS_TYPE_G_MAP_OF_STRING
      was already represented as a hash table.
      (One change needed within libnm-core is that we now need to copy the
      hash tables in get_property(), or else the caller will receive a
      reffed copy of the object's own hash table, which we don't want.)
    • Dan Winship's avatar
      libnm-core: change list-of-string and array-of-string properties to G_TYPE_STRV · 6a4127cf
      Dan Winship authored
      properties to G_TYPE_STRV, and update everything accordingly.
      (This doesn't actually require using
      _nm_setting_class_transform_property(); dbus-glib is happy to transform
      between 'as' and G_TYPE_STRV.)
    • Dan Winship's avatar
      libnm-core: change all mac-address properties to G_TYPE_STRING · 3a54d050
      Dan Winship authored
      Make all mac-address properties (including NMSettingBluetooth:bdaddr,
      NMSettingOlpcMesh:dhcp-anycast-addr, and NMSettingWireless:bssid) be
      strings, using _nm_setting_class_transform_property() to handle
      translating to/from binary form when dealing with D-Bus.
      Update everything accordingly for the change, and also add a test for
      transformed setting properties to test-general.
  28. 22 Aug, 2014 1 commit
    • Thomas Haller's avatar
      all: add nm-core-internal.h header · ef32da01
      Thomas Haller authored
      Add a header file to expose private utility functions from libnm-core
      that can be used by NetworkManager (core) and libnm.so. The header
      is also used to give privileged access to libnm-core. Since NM links
      statically, these functions are not exported and not part of public ABI.
      This also removes the NM_UTILS_PRIVATE_CALL() macro and libnm.so no
      longer exports nm_utils_get_private().
      Before, this functionality was partly declared in nm-utils-private.h.
      This was wrong because nm-utils-private.h is for functionality
      entirely private to libnm-core.
      Signed-off-by: Thomas Haller's avatarThomas Haller <thaller@redhat.com>