1. 12 Feb, 2019 1 commit
  2. 15 Jun, 2018 1 commit
    • Thomas Haller's avatar
      libnm: always return VPN connections's banner · 576cbb77
      Thomas Haller authored
      It's not libnm's responsibility to hide the banner
      depending on the VPN state. libnm should cache and expose
      NetworkManager's state, and if the VPN connection has
      a banner there, it should be returned.
      
      The previous behavior was since ever in libnm, and in libnm-glib since
      the banner was introduced in commit e5b834c1.
      I think it's wrong if libnm tries too hard putting additional logic
      on top of what is on D-Bus.
      576cbb77
  3. 30 Apr, 2018 1 commit
  4. 22 Sep, 2017 1 commit
    • Iain Lane's avatar
      {vpn,remote}-connection: disconnect signal handlers when disposed · b18896f7
      Iain Lane authored
      GNOME Settings 3.26 is crashing every time a VPN connection changed its
      state. After some digging, a debug message was put on dispose, and this
      issue was found:
      
      libnm-Message: Object 0x55555633c070 disposed
      libnm-Message: Object 0x55555633c730 disposed
      libnm-Message: Object 0x55555633eae0 disposed
      libnm-Message: Object 0x555556340a80 disposed
      
      Thread 1 "gnome-control-c" received signal SIGSEGV, Segmentation fault.
      g_type_check_instance_cast (type_instance=type_instance@entry=0x55555633c070, iface_type=93825006537856) at /.../glib/gobject/gtype.c:4057
      4057		  node = lookup_type_node_I (type_instance->g_class->g_type);
      (gdb) bt
      
      NetworkManager is calling callbacks on disposed objects, which leads to
      crashes in clients (e.g. GNOME Settings).
      
      Fix this issue by disconnecting signal handlers when the objects are
      disposed.
      
      Patch originally by Georges Basile Stavracas Neto <georges.stavracas@gmail.com>
      
      https://bugzilla.gnome.org/show_bug.cgi?id=787893
      b18896f7
  5. 17 Mar, 2017 2 commits
    • Thomas Haller's avatar
      libnm: revert coercing NMVpnConnectionStateReason to NMActiveConnectionStateReason · 5022e3b8
      Thomas Haller authored
      NMVpnConnectionStateReason is no longer used and replaced by
      NMActiveConnectionStateReason. However, the old enums should
      stay in place as they were:
      
      Otherwise:
        #define NMVpnConnectionStateReason NMActiveConnectionStateReason
      causes compiler warnings:
        NMVpnConnectionStateReason x;
        x = NM_VPN_CONNECTION_STATE_REASON_UNKNOWN;             // -Wenum-conversion
        if (x == NM_VPN_CONNECTION_STATE_REASON_NO_SECRETS) { } // -Wenum-compare
      
      Similarly, a user who didn't upgrade shall continue to get the
      old GType for NM_TYPE_VPN_CONNECTION_STATE_REASON.
      
      In practice, old users will have no issues using the old enum
      the places where it worked before.
      The only use of the deprecated enum is in vpn_state_changed()
      signal slot of NMVpnConnection. This makes the signal slot
      itself deprecated. However, NMVpnConnection is an NMObject and commonly
      created within libnm itself, not by the user. It is very unlikely that
      a user of libnm subclassed NMVpnConnection and makes use of the
      vpn_state_changed() signal slot. So, deprecate it without replacement.
      
      Fixes: a91369f8
      5022e3b8
    • Lubomir Rintel's avatar
      libnm-core: drop NMVpnConnectionStateReason · a91369f8
      Lubomir Rintel authored
      It's now the same as NMActiveConnectionStateReason. Keep a compatibility
      typedef and enum.
      a91369f8
  6. 23 Nov, 2016 1 commit
  7. 14 Nov, 2016 1 commit
  8. 10 Nov, 2016 1 commit
    • Lubomir Rintel's avatar
      libnm: use the o.fd.DBus.ObjectManager API for object management · 1f5b48a5
      Lubomir Rintel authored
      This speeds up the initial object tree load significantly. Also, it
      reduces the object management complexity by shifting the duties to
      GDBusObjectManager.
      
      The lifetime of all NMObjects is now managed by the NMClient via the
      object manager. The NMClient creates the NMObjects for GDBus objects,
      triggers the initialization and serves as an object registry (replaces
      the nm-cache).
      
      The ObjectManager uses the o.fd.DBus.ObjectManager API to learn of the
      object creation, removal and property changes. It takes care of the
      property changes so that we don't have to and lets us always see a
      consistent object state.  Thus at the time we learn of a new object we
      already know its properties.
      
      The NMObject unfortunately can't be made synchronously initializable as
      the NMRemoteConnection's settings are not managed with standard
      o.fd.DBus Properties and ObjectManager APIs and thus are not known to
      the ObjectManager.  Thus most of the asynchronous object property
      changing code in nm-object.c is preserved. The objects notify the
      properties that reference them of their initialization in from their
      init_finish() methods, thus the asynchronously created objects are not
      allowed to fail creation (or the dependees would wait forever). Not a
      problem -- if a connection can't get its Settings, it's either invisible
      or being removed (presumably we'd learn of the removal from the object
      manager soon).
      
      The NMObjects can't be created by the object manager itself, since we
      can't determine the resulting object type in proxy_type() yet (we can't
      tell from the name and can't access the interface list). Therefore the
      GDBusObject is coupled with a NMObject later on.
      
      Lastly, now that all the objects are managed by the object manager, the
      NMRemoteSettings and NMManager go away when the daemon is stopped. The
      complexity of dealing with calls to NMClient that would require any of
      the resources that these objects manage (connection or device lists,
      etc.) had to be moved to NMClient. The bright side is that his allows
      for removal all of the daemon presence tracking from NMObject.
      1f5b48a5
  9. 24 Oct, 2016 1 commit
    • Thomas Haller's avatar
      libnm: coerce empty strings to NULL for D-Bus properties · 95ab69b7
      Thomas Haller authored
      On D-Bus level, string (s) or object paths (o) cannot be NULL.
      Thus, whenver server exposes such an object, it gets automatically
      coerced to "" or "/", respectively.
      
      On client side, libnm should coerce certain properties back, for which
      "" is just not a sensible value.
      
      For example, an empty NM_DEVICE_ETHERNET_HW_ADDRESS should be instead
      exposed as NULL.
      
      Technically, this is an API change. However, all users were well advised
      to expect both NULL and "" as possible return values and handle them
      accordingly.
      95ab69b7
  10. 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
  11. 13 Nov, 2014 1 commit
    • Dan Winship's avatar
      all: consistently include config.h · 3bfb163a
      Dan Winship authored
      config.h should be included from every .c file, and it should be
      included before any other include. Fix that.
      
      (As a side effect of how I did this, this also changes us to
      consistently use "config.h" rather than <config.h>. To the extent that
      it matters [which is not much], quotes are more correct anyway, since
      we're talking about a file in our own build tree, not a system
      include.)
      3bfb163a
  12. 03 Oct, 2014 1 commit
    • Dan Winship's avatar
      libnm: make use of GParamSpecFlags and GParamSpecEnum · fcfb4b40
      Dan Winship authored
      Make enum- and flags-valued properties use GParamSpecEnum and
      GParamSpecFlags, for better introspectability/bindability.
      
      This requires no changes outside libnm-core/libnm since the expected
      data size is still the same with g_object_get()/g_object_set(), and
      GLib will internally convert between int/uint and enum/flags GValues
      when using g_object_get_property()/g_object_set_property().
      fcfb4b40
  13. 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).
      6793a32a
    • Dan Winship's avatar
      libnm: let NMObject create all D-Bus proxies · b728d1fb
      Dan Winship authored
      Add _nm_object_class_add_interface(), for declaring that a class
      implements a particular interface, and then have NMObject create the
      corresponding proxies itself. (The subclass can get a copy with
      _nm_object_get_proxy() if it needs it for something).
      
      (In GDBus, creating a proxy is a heavier operation than in dbus-glib,
      so we'll need to create the proxies asynchronously. Moving the
      creation to NMObject makes that easier since we can do it as part
      of the existing init/init_async.)
      b728d1fb
  14. 01 Aug, 2014 6 commits
    • Dan Winship's avatar
      libnm: rename NetworkManager.h and NetworkManagerVPN.h · 3ddce748
      Dan Winship authored
      "NetworkManager.h"'s name (and non-standard capitalization) suggest
      that it's some sort of high-level super-important header, but it's
      really just low-level D-Bus stuff. Rename it to "nm-dbus-interface.h"
      and likewise "NetworkManagerVPN.h" to "nm-vpn-dbus-interface.h"
      3ddce748
    • Dan Winship's avatar
      libnm: make the the use of GInitable mandatory · 258e74eb
      Dan Winship authored
      Remove _nm_object_ensure_inited(), etc; objects that implement
      GInitable are now mandatory-to-init().
      
      Remove constructor() implementations that sometimes return NULL; do
      all the relevant checking in init() instead.
      
      Make nm_client_new() and nm_remote_settings_new() take a GCancellable
      and a GError**.
      258e74eb
    • Dan Winship's avatar
      libnm: add init_dbus() virtual method to NMObject · 8ca2998d
      Dan Winship authored
      Rather than having each object type override constructed() to call
      _nm_object_register_properties(), have NMObject call a virtual method
      on the subclass to ask it to register them.
      
      Move some code around in nm-client.c and nm-object.c so that all
      D-Bus-related initialization happens in init_dbus(), and
      non-D-Bus-related stuff stays in construct().
      
      (This simplifies the next commit.)
      8ca2998d
    • Dan Winship's avatar
      libnm: remove _new functions from NMObject subclasses · a0e9a4bd
      Dan Winship authored
      Most NMObjects should not be manually created, they should only be
      received from NMClient or NMRemoteSettings.
      a0e9a4bd
    • Dan Winship's avatar
      libnm, core, cli, tui: fix the capitalization of various types · 3ac0f528
      Dan Winship authored
      GLib/Gtk have mostly settled on the convention that two-letter
      acronyms in type names remain all-caps (eg, "IO"), but longer acronyms
      become initial-caps-only (eg, "Tcp").
      
      NM was inconsistent, with most long acronyms using initial caps only
      (Adsl, Cdma, Dcb, Gsm, Olpc, Vlan), but others using all caps (DHCP,
      PPP, PPPOE, VPN). Fix libnm and src/ to use initial-caps only for all
      three-or-more-letter-long acronyms (and update nmcli and nmtui for the
      libnm changes).
      3ac0f528
    • Dan Winship's avatar
      libnm: add libnm/libnm-core (part 1) · d595f784
      Dan Winship authored
      This commit begins creating the new "libnm", which will replace
      libnm-util and libnm-glib.
      
      The main reason for the libnm-util/libnm-glib split is that the daemon
      needs to link to libnm-util (to get NMSettings, NMConnection, etc),
      but can't link to libnm-glib (because it uses many of the same type
      names as the NetworkManager daemon. eg, NMDevice). So the daemon links
      to only libnm-util, but basically all clients link to both.
      
      With libnm, there will be only a single client-visible library, and
      NetworkManager will internally link against a private "libnm-core"
      containing the parts that used to be in libnm-util.
      
      (The "libnm-core" parts still need to be in their own directory so
      that the daemon can see those header files without also seeing the
      ones in libnm/ that conflict with its own headers.)
      
      [This commit just copies the source code from libnm-util/ to
      libnm-core/, and libnm-glib/ to libnm/:
      
        mkdir -p libnm-core/tests/
        mkdir -p libnm/tests/
        cp libnm-util/*.[ch] libnm-util/nm-version.h.in libnm-core/
        rm -f libnm-core/nm-version.h libnm-core/nm-setting-template.[ch] libnm-core/nm-utils-enum-types.[ch]
        cp libnm-util/tests/*.[ch] libnm-core/tests/
        cp libnm-glib/*.[ch] libnm/
        rm -f libnm/libnm_glib.[ch] libnm/libnm-glib-test.c libnm/nm-glib-enum-types.[ch]
        cp libnm-glib/tests/*.[ch] libnm/tests/
      
      ]
      d595f784
  15. 15 Jul, 2014 2 commits
    • Dan Winship's avatar
      libnm-util, libnm-glib: whitespace fixes · 2570c5a1
      Dan Winship authored
      Fix indentation, kill trailing whitespace, split some long lines.
      2570c5a1
    • Dan Winship's avatar
      libnm-util, libnm-glib: standardize copyright/license headers · cb7e1893
      Dan Winship authored
      - Remove list of authors from files that had them; these serve no
        purpose except to quickly get out of date (and were only used in
        libnm-util and not libnm-glib anyway).
      
      - Just say "Copyright", not "(C) Copyright" or "Copyright (C)"
      
      - Put copyright statement after the license, not before
      
      - Remove "NetworkManager - Network link manager" from the few files
        that contained it, and "libnm_glib -- Access network status &
        information from glib applications" from the many files that
        contained it.
      
      - Remove vim modeline from nm-device-olpc-mesh.[ch], add emacs modeline
        to files that were missing it.
      cb7e1893
  16. 19 Jun, 2014 1 commit
  17. 23 Jan, 2014 1 commit
  18. 08 May, 2013 1 commit
  19. 08 Apr, 2013 2 commits
    • Dan Williams's avatar
      libnm-glib: ensure VpnStateChanged signals also notify VpnState property listeners · 55cb1b74
      Dan Williams authored
      Both the VpnState property and the VpnStateChanged dbus signals update the
      NMVPNConnection's 'vpn-state' GObject property, so we should ensure that
      when either updates it due to a D-Bus event, GObject signals are sent
      out for both too.
      55cb1b74
    • Dan Williams's avatar
      libnm-glib: use helpers to create dbus proxies · 661d0985
      Dan Williams authored
      When using a private connection, we need to use dbus_g_proxy_new_for_peer()
      because the bus isn't involved.  Since many parts of libnm-glib create a
      proxy for their corresponding remote object, consolidate the proxy creation
      logic.
      
      A later patch will add logic to use a private connection versus a bus-based
      one.
      661d0985
  20. 29 Jun, 2012 2 commits
  21. 28 Mar, 2012 1 commit
    • Dan Winship's avatar
      libnm-glib: more ensure_inited() fixing · a4f450aa
      Dan Winship authored
      We need to do _nm_object_ensure_inited() /
      _nm_remote_settings_ensure_inited() from the get_property()
      implementations; in most cases, get_property() just calls another
      accessor method (which will call _nm_object_ensure_inited()), but in a
      few places, it reads priv->whatever directly, so we need to make sure
      that it's valid.
      a4f450aa
  22. 15 Feb, 2012 1 commit
    • Dan Winship's avatar
      Use glib-mkenums to generate enum types · 839eab55
      Dan Winship authored
      Rather than generating enum classes by hand (and complaining in each
      file that "this should really be standard"), use glib-mkenums.
      
      Unfortunately, we need a very new version of glib-mkenums in order to
      deal with NM's naming conventions and to fix a few other bugs, so just
      import that into the source tree temporarily.
      
      Also, to simplify the use of glib-mkenums, import Makefile.glib from
      https://bugzilla.gnome.org/654395.
      
      To avoid having to run glib-mkenums for every subdirectory of src/,
      add a new "generated" directory, and put the generated enums files
      there.
      
      Finally, use Makefile.glib for marshallers too, and generate separate
      ones for libnm-glib and NetworkManager.
      839eab55
  23. 03 Feb, 2012 3 commits
    • Dan Winship's avatar
      libnm-glib: implement GInitable/GAsyncInitable in NMObject · 9fd98ef9
      Dan Winship authored
      Implement GInitable and GAsyncInitable in NMObject, with
      implementations that synchronously or asynchonously load all
      properties, and change _nm_object_ensure_inited() to run
      g_initable_init().
      
      Update the object/object-array property handling to initialize the
      objects after creating them (synchronously or asynchronously,
      according to the situation), so that they will have all of their
      properties preloaded before they are ever visible to the caller.
      
      Move the non-blocking/non-failable parts of various objects'
      constructor() methods to constructed(), and move the blocking/failable
      parts to init(), and implement init_async() methods with non-blocking
      versions of the blocking methods.
      
      Make nm_device_new() and nm_client_new() call
      _nm_object_ensure_inited(), to preserve the behaviour formerly
      enforced by their construct() methods, that properties are guaranteed
      to be initialized before any signals involving them are emitted.
      9fd98ef9
    • Dan Winship's avatar
      libnm-glib: simplify property getter methods · 5afcee46
      Dan Winship authored
      Rather than having every property getter method have code to fetch
      that specific property's value, just call the new
      _nm_object_ensure_inited() (which makes sure that we've read all the
      property values on the object at least once), and then return the
      cached value. (After we've read the initial property values, the
      PropertiesChanged signal handler will ensure that the values are kept
      up to date, so we can always just return cached property values after
      that point.)
      
      This then lets us get rid of _nm_object_get_property() and its
      wrappers.
      5afcee46
    • Dan Winship's avatar
      libnm-glib: simplify and genericize property declaration · 2e48cc09
      Dan Winship authored
      Rename _nm_object_handle_properties_changed(), etc, to be about
      properties in general, rather than just property changes.
      
      Interpret func==NULL in NMPropertiesInfo as meaning "use
      _nm_object_demarshal_generic", and then reorder the fields so that you
      can just leave that field out in the declarations when it's NULL.
      
      Add a way to register properties that exist in D-Bus but aren't
      tracked by the NMObjects, and use that for NMDevice's D-Bus Ip4Address
      property, replacing the existing hack.
      
      Also add a few other missing properties noticed along the way.
      2e48cc09
  24. 02 Feb, 2012 1 commit
  25. 05 Jan, 2012 2 commits
  26. 15 Mar, 2011 1 commit
  27. 10 Mar, 2011 1 commit