1. 06 Feb, 2019 1 commit
    • Thomas Haller's avatar
      all: don't use "static inline" in source files · d25ed082
      Thomas Haller authored
      For static functions inside a module, the compiler determines on its own
      whether to inline the function.
      
      Also, "inline" was used at some places that don't immediatly look like
      candidates for inlining. It was most likely a copy&paste error.
      d25ed082
  2. 17 Sep, 2018 1 commit
  3. 22 Aug, 2018 1 commit
  4. 11 Jul, 2018 1 commit
    • Thomas Haller's avatar
      all: don't use gchar/gshort/gint/glong but C types · e1c7a2b5
      Thomas Haller authored
      We commonly don't use the glib typedefs for char/short/int/long,
      but their C types directly.
      
          $ git grep '\<g\(char\|short\|int\|long\|float\|double\)\>' | wc -l
          587
          $ git grep '\<\(char\|short\|int\|long\|float\|double\)\>' | wc -l
          21114
      
      One could argue that using the glib typedefs is preferable in
      public API (of our glib based libnm library) or where it clearly
      is related to glib, like during
      
        g_object_set (obj, PROPERTY, (gint) value, NULL);
      
      However, that argument does not seem strong, because in practice we don't
      follow that argument today, and seldomly use the glib typedefs.
      Also, the style guide for this would be hard to formalize, because
      "using them where clearly related to a glib" is a very loose suggestion.
      
      Also note that glib typedefs will always just be typedefs of the
      underlying C types. There is no danger of glib changing the meaning
      of these typedefs (because that would be a major API break of glib).
      
      A simple style guide is instead: don't use these typedefs.
      
      No manual actions, I only ran the bash script:
      
        FILES=($(git ls-files '*.[hc]'))
        sed -i \
            -e 's/\<g\(char\|short\|int\|long\|float\|double\)\>\( [^ ]\)/\1\2/g' \
            -e 's/\<g\(char\|short\|int\|long\|float\|double\)\>  /\1   /g' \
            -e 's/\<g\(char\|short\|int\|long\|float\|double\)\>/\1/g' \
            "${FILES[@]}"
      e1c7a2b5
  5. 30 Apr, 2018 1 commit
  6. 18 Jan, 2018 1 commit
  7. 30 Oct, 2017 1 commit
    • Thomas Haller's avatar
      all: avoid coverity warnings about "Wrong Check of Return Value" · 4a8a5495
      Thomas Haller authored
      30. NetworkManager-1.9.2/src/settings/plugins/keyfile/nms-keyfile-writer.c:218:
      check_return: Calling "g_mkdir_with_parents" without checking return
      value (as is done elsewhere 4 out of 5
       times).
      
      25. NetworkManager-1.9.2/src/platform/nm-linux-platform.c:3969:
      check_return: Calling "_nl_send_nlmsg" without checking return value (as
      is done elsewhere 4 out of 5 times).
      
      34. NetworkManager-1.9.2/src/nm-core-utils.c:2843:
      negative_returns: "fd2" is passed to a parameter that cannot be negative.
      
      26. NetworkManager-1.9.2/src/devices/wwan/nm-modem-broadband.c:897:
      check_return: Calling "nm_utils_parse_inaddr_bin" without checking
      return value (as is done elsewhere 4 out of 5 times).
      
      3. NetworkManager-1.9.2/src/devices/bluetooth/nm-bluez5-manager.c:386:
      check_return: Calling "g_variant_lookup" without checking return value
      (as is done elsewhere 79 out of 83 times).
      
      16. NetworkManager-1.9.2/libnm-util/nm-setting.c:405:
      check_return: Calling "nm_g_object_set_property" without checking return
      value (as is done elsewhere 4 out of 5 times).
      4a8a5495
  8. 03 Oct, 2016 1 commit
  9. 30 May, 2016 1 commit
  10. 29 Mar, 2016 1 commit
  11. 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
  12. 05 Aug, 2015 1 commit
  13. 12 Jul, 2015 1 commit
  14. 02 Jun, 2015 1 commit
  15. 25 Nov, 2014 1 commit
  16. 13 Nov, 2014 2 commits
    • Dan Winship's avatar
      libnm*: fix library gettext usage · 53f5e9af
      Dan Winship authored
      Libraries need to include <gi18n-lib.h>, not <gi18n.h>, so that _()
      will get defined to "dgettext (GETTEXT_DOMAIN, string)" rather than
      "gettext (string)" (which will use the program's default domain, which
      works fine for programs in the NetworkManager tree, but not for
      external users). Likewise, we need to call bindtextdomain() so that
      gettext can find the translations if the library is installed in a
      different prefix from the program using it (and
      bind_textdomain_codeset(), so it will know the translations are in
      UTF-8 even if the locale isn't).
      
      (The fact that no one noticed this was broken before is because the
      libraries didn't really start returning useful translated strings much
      until 0.9.10, and none of the out-of-tree clients have been updated to
      actually show those strings to users yet.)
      53f5e9af
    • 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
  17. 12 Oct, 2014 4 commits
    • Thomas Haller's avatar
      1cc7b8d0
    • Thomas Haller's avatar
    • Thomas Haller's avatar
      libnm-util: let nm_setting_diff() be symetric not to return properties that are set to default · 68bc95c1
      Thomas Haller authored
      Previously, nm_setting_diff() (and thus nm_connection_diff()), returned
      only properties that are different AND not set to the default value.
      However, if the opposite setting 'B' was missing, it would always
      include all properties from 'A', even the default ones.
      
      This behaviour was asymetric. Add two new compare flags
      @NM_SETTING_COMPARE_FLAG_DIFF_RESULT_WITH_DEFAULT and
      @NM_SETTING_COMPARE_FLAG_DIFF_RESULT_NO_DEFAULT to control the
      behaviour of whether to include default properties.
      Signed-off-by: Thomas Haller's avatarThomas Haller <thaller@redhat.com>
      68bc95c1
    • Thomas Haller's avatar
      libnm-util: don't assert in nm_setting_get_secret_flags() and avoid assertion... · 978724da
      Thomas Haller authored
      libnm-util: don't assert in nm_setting_get_secret_flags() and avoid assertion in agent_secrets_done_cb()
      
      When secret providers return the connection hash in GetSecrets(),
      this hash should only contain secrets. However, some providers also
      return non-secret properties.
      
      for_each_secret() iterated over all entries of the @secrets hash
      and triggered the assertion in nm_setting_get_secret_flags() (see
      below).
      
      NM should not assert against user provided input. Change
      nm_setting_get_secret_flags() to silently return FALSE, if the property
      is not a secret.
      
      Indeed, handling of secrets is very different for NMSettingVpn and
      others. Hence nm_setting_get_secret_flags() has only an inconsistent
      behavior and we have to fix all call sites to do the right thing
      (depending on whether we have a VPN setting or not).
      
      Now for_each_secret() checks whether the property is a secret
      without hitting the assertion. Adjust all other calls of
      nm_setting_get_secret_flags(), to anticipate non-secret flags and
      assert/warn where appropriate.
      
      Also, agent_secrets_done_cb() clears now all non-secrets properties
      from the hash, using the new argument @remove_non_secrets when calling
      for_each_secret().
      
        #0  0x0000003370c504e9 in g_logv () from /lib64/libglib-2.0.so.0
        #1  0x0000003370c5063f in g_log () from /lib64/libglib-2.0.so.0
        #2  0x00007fa4b0c1c156 in get_secret_flags (setting=0x1e3ac60, secret_name=0x1ea9180 "security", verify_secret=1, out_flags=0x7fff7507857c, error=0x0) at nm-setting.c:1091
        #3  0x00007fa4b0c1c2b2 in nm_setting_get_secret_flags (setting=0x1e3ac60, secret_name=0x1ea9180 "security", out_flags=0x7fff7507857c, error=0x0) at nm-setting.c:1124
        #4  0x0000000000463d03 in for_each_secret (connection=0x1deb2f0, secrets=0x1e9f860, callback=0x464f1b <has_system_owned_secrets>, callback_data=0x7fff7507865c) at settings/nm-settings-connection.c:203
        #5  0x000000000046525f in agent_secrets_done_cb (manager=0x1dddf50, call_id=1, agent_dbus_owner=0x1ddb9e0 ":1.39", agent_username=0x1e51710 "thom", agent_has_modify=1, setting_name=0x1e91f90 "802-11-wireless-security",
            flags=NM_SETTINGS_GET_SECRETS_FLAG_ALLOW_INTERACTION, secrets=0x1e9f860, error=0x0, user_data=0x1deb2f0, other_data2=0x477d61 <get_secrets_cb>, other_data3=0x1ea92a0) at settings/nm-settings-connection.c:757
        #6  0x00000000004dc4fd in get_complete_cb (parent=0x1ea6300, secrets=0x1e9f860, agent_dbus_owner=0x1ddb9e0 ":1.39", agent_username=0x1e51710 "thom", error=0x0, user_data=0x1dddf50) at settings/nm-agent-manager.c:1139
        #7  0x00000000004dab54 in req_complete_success (req=0x1ea6300, secrets=0x1e9f860, agent_dbus_owner=0x1ddb9e0 ":1.39", agent_uname=0x1e51710 "thom") at settings/nm-agent-manager.c:502
        #8  0x00000000004db86e in get_done_cb (agent=0x1e89530, call_id=0x1, secrets=0x1e9f860, error=0x0, user_data=0x1ea6300) at settings/nm-agent-manager.c:856
        #9  0x00000000004de9d0 in get_callback (proxy=0x1e47530, call=0x1, user_data=0x1ea10f0) at settings/nm-secret-agent.c:267
        #10 0x000000337380cad2 in complete_pending_call_and_unlock () from /lib64/libdbus-1.so.3
        #11 0x000000337380fdc1 in dbus_connection_dispatch () from /lib64/libdbus-1.so.3
        #12 0x000000342800ad65 in message_queue_dispatch () from /lib64/libdbus-glib-1.so.2
        #13 0x0000003370c492a6 in g_main_context_dispatch () from /lib64/libglib-2.0.so.0
        #14 0x0000003370c49628 in g_main_context_iterate.isra.24 () from /lib64/libglib-2.0.so.0
        #15 0x0000003370c49a3a in g_main_loop_run () from /lib64/libglib-2.0.so.0
        #16 0x000000000042e5c6 in main (argc=1, argv=0x7fff75078e88) at main.c:644
      Signed-off-by: Thomas Haller's avatarThomas Haller <thaller@redhat.com>
      978724da
  18. 04 Sep, 2014 1 commit
    • Dan Winship's avatar
      libnm-core, libnm-util: remove some useless code in nm-settings.c · 98e4a2be
      Dan Winship authored
      g_object_class_list_properties() can't return NULL if called
      correctly.
      
      Also remove two failed attempts to use g_value_transform():
      nm_setting_new_from_hash() was transforming src_value to its own type
      (rather than to param_spec->value_type, which was presumably
      intended), so it was a no-op (in addition to being unnecessary anyway,
      since GObject will attempt to transform the value internally if
      needed). And update_one_secret() was calling g_value_transform() on an
      uninitialized GValue, so it would have always hit a
      g_return_val_if_fail() in g_value_transform() if that code was ever
      reached (which apparently it wasn't).
      98e4a2be
  19. 22 Aug, 2014 1 commit
  20. 08 Aug, 2014 1 commit
    • Dan Winship's avatar
      libnm-util: don't warn about unrecognized properties · b64c82a3
      Dan Winship authored
      libnm-util is expected to end up behind the curve in terms of knowing
      about new NMSetting properties, so if it sees an unknown property, it
      should just assume that there will also be a backward-compatibility
      equivalent rather than printing a warning.
      
      (In particular, it should not warn when it sees the
      "ipv4.address-labels" property now that it now longer knows about it.)
      b64c82a3
  21. 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
  22. 30 Jun, 2014 2 commits
    • Thomas Haller's avatar
      libnm-util: normalize virtual_iface_name in NMSettings · 2deaa539
      Thomas Haller authored
      Some type-specific NMSetting implementations (bond, bridge, team, vlan)
      have their own 'interface-name' property. This property will be
      deprecated in favour of 'interface-name' in NMSettingConnection.
      
      Change verify() and normalize() to check that the redundant
      values match and repair/normalize the properties.
      
      Force the virtual interface name of the type-specific setting to be
      equal to NMSettingConnection:interface_name. This way, the depreacted
      field stays valid and backward compatible.
      
      NMSettingInfiniband is special, because it does not have a backing
      property for the interface name, although it implements
      get_virtual_iface_name(). To account for this, some special handling
      is needed in order not to change the behaviour of get_virtual_iface_name().
      Signed-off-by: Thomas Haller's avatarThomas Haller <thaller@redhat.com>
      2deaa539
    • Thomas Haller's avatar
      libnm-util: add function nm_connection_normalize · de5656a5
      Thomas Haller authored
      This function behaves like verify(), but it also performs some
      normalization/fixing of inconsistent connections.
      
      Contrary to verify(), this function might modify the settings.
      This will be mainly used, to repair connections from older versions
      and to fix deprecated options.
      Signed-off-by: Thomas Haller's avatarThomas Haller <thaller@redhat.com>
      de5656a5
  23. 19 Jun, 2014 3 commits
    • Dan Winship's avatar
      libnm-util: remove NMSetting* GParamSpec docs · cdc15cb2
      Dan Winship authored
      Remove all the GParamSpec docs, since everything now uses the gtk-doc
      docs instead, so there's no point in having two copies of each (which
      are often out of sync anyway).
      
      Since we're touching so many lines anyway, also fix up the indentation
      of the remaining property-installing lines, and add
      G_PARAM_STATIC_STRINGS to each paramspec (so the nick strings don't
      get strduped). Also, be consistent about starting a new line between
      "g_object_class_install_property" and its opening parenthesis.
      cdc15cb2
    • Dan Winship's avatar
      libnm-util: various NMSetting* property doc fixes/improvements · e8577083
      Dan Winship authored
      Fix up various issues with the docs for the NMSetting properties, and
      pull in text from the GParamSpec docs where the GParamSpec docs were
      better (or contained information that is necessary in the context of
      nm-settings.5).
      
      Also, consistently wrap all of the doc comments to the same width (80
      columns).
      e8577083
    • Dan Winship's avatar
      libnm-util, libnm-glib: be consistent about "Wi-Fi", "Ethernet", "InfiniBand" in docs · 8487a449
      Dan Winship authored
      We made the UIs consistent last year, but missed the documentation.
      Fix the docs to also consistently use "Wi-Fi" rather than "WiFi",
      "Wifi", "wifi", or "WiFI"; "Ethernet" rather than "ethernet"; and
      "InfiniBand" rather than "Infiniband".
      8487a449
  24. 27 May, 2014 1 commit
  25. 06 Mar, 2014 1 commit
  26. 24 Feb, 2014 1 commit
  27. 15 Jan, 2014 2 commits
  28. 12 Dec, 2013 1 commit
    • Thomas Haller's avatar
      libnm-util: refactor NMSetting name and register_settings · 9d319e6d
      Thomas Haller authored
      - refactor register_settings to allow lookup by GType and
        add the settings name to SettingInfo.
      
      - setting NM_SETTING_NAME is deprecated and should not be set anymore.
        Indeed it has always be a bug, to reset the name to a different value.
        The only valid place to set the name was in the _init() function of
        the derived class itself.
        This is now no longer needed/possible. Instead the name get's
        detected based on the registered setting types. This makes use of
        the registered metadata that is available anyway since every
        usable setting has to register itself.
      Signed-off-by: Thomas Haller's avatarThomas Haller <thaller@redhat.com>
      9d319e6d
  29. 09 Dec, 2013 1 commit
  30. 05 Dec, 2013 2 commits