1. 12 Feb, 2019 2 commits
  2. 13 Nov, 2018 1 commit
    • Thomas Haller's avatar
      dhcp: don't pass duid to client ip6_start() and stop() · 7d55b134
      Thomas Haller authored
      We don't do that for ip4_start() either. The duid/client-id
      is stored inside the NMDhcpClient instance, and the function can
      access it from there.
      
      Maybe, it is often preferable to have stateless objects and not
      relying on ip4_start() to obtain the client ID from the client's
      state. However, the purpose of the NMDhcpClient object is to
      hold state about DHCP. To simplify the complexity of objects that
      inherrently have state, we should be careful about mutating the state.
      It adds little additional complexity of only reading the state when
      needed anyway. In fact, it adds complexity, because previously
      it wasn't enough to check all callers of nm_dhcp_client_get_client_id()
      to see where the client-id is used. Instead, one would also need to
      follow the @duid argument several layers of the call stack.
      7d55b134
  3. 13 Sep, 2018 2 commits
  4. 12 Sep, 2018 2 commits
  5. 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
  6. 20 Mar, 2018 1 commit
  7. 15 Feb, 2018 3 commits
    • Thomas Haller's avatar
      dhcp: refactor type of NMDhcpClient duid to be GBytes · 578c4af9
      Thomas Haller authored
      GBytes is immutable. It's better suited to contain the duid parameter
      then a GByteArray.
      578c4af9
    • Thomas Haller's avatar
      dhcp: cache info-only parameter in NMDhcpClient · 8ff962d9
      Thomas Haller authored
      Optimally, NMDhcpClient would be stateless and all paramters would
      be passed on as argument. Clearly that is not feasable, because there
      are so many paramters, and in many cases they need to be cached for the
      lifetime of the client instance.
      
      Instead of passing info_only paramter to ip6_start() and cache it
      both in NMDhcpClient and NMDhcpSystemd, keep it in NMDhcpClient at
      one place.
      
      In the next commit, we will initialize info-only only once during the
      constructor, so it is immutable and somewhat stateless.
      8ff962d9
    • Thomas Haller's avatar
      dhcp: chain up parent stop() for NMDhcpSystem client · badace72
      Thomas Haller authored
      The parent's stop() implementation does nothing interesting
      for NMDhcpSystem. Still, call it, it's just unexpected to
      not chain up the parent implementation, if all other subclasses
      do it.
      
      In general, if the parent's implementation is not suitable to be called
      by the derived class, that should be handled differently then just not
      chaining up. Otherwise it's inconsistent and confusing.
      badace72
  8. 07 Feb, 2018 1 commit
  9. 09 May, 2017 2 commits
    • Beniamino Galvani's avatar
      dhcp: allow FQDNs in ipv4.dhcp-hostname · 75884c3a
      Beniamino Galvani authored
      If users wrote a FQDN in ipv4.dhcp-hostname presumably it's because
      they really want to send the full value, not only the host part, so
      let's send it as-is.
      
      This obviously is a change in behavior, but only for users that have a
      FQDN in ipv4.dhcp-hostname, where it's not clear if they really want the
      domain to be stripped.
      
      When the property is unset, we keep sending only the host part of the
      system hostname to maintain backwards compatibility.
      
      This commit aligns NM behavior to initscripts.
      
      (cherry picked from commit cf5fab8f)
      75884c3a
    • Beniamino Galvani's avatar
      dhcp: simplify how hostname and FQDN are passed down to backends · 099b790d
      Beniamino Galvani authored
      Since they are mutually exclusive, pass a string and a boolean to
      indicate whether we want to use the hostname or the FQDN option.
      
      (cherry picked from commit d286aa9d)
      099b790d
  10. 04 May, 2017 2 commits
    • Beniamino Galvani's avatar
      dhcp: allow FQDNs in ipv4.dhcp-hostname · cf5fab8f
      Beniamino Galvani authored
      If users wrote a FQDN in ipv4.dhcp-hostname presumably it's because
      they really want to send the full value, not only the host part, so
      let's send it as-is.
      
      This obviously is a change in behavior, but only for users that have a
      FQDN in ipv4.dhcp-hostname, where it's not clear if they really want the
      domain to be stripped.
      
      When the property is unset, we keep sending only the host part of the
      system hostname to maintain backwards compatibility.
      
      This commit aligns NM behavior to initscripts.
      cf5fab8f
    • Beniamino Galvani's avatar
      dhcp: simplify how hostname and FQDN are passed down to backends · d286aa9d
      Beniamino Galvani authored
      Since they are mutually exclusive, pass a string and a boolean to
      indicate whether we want to use the hostname or the FQDN option.
      d286aa9d
  11. 21 Nov, 2016 1 commit
  12. 09 Nov, 2016 1 commit
  13. 04 Oct, 2016 1 commit
    • Thomas Haller's avatar
      dhcp: refactor loading of DHCP plugins · ad0f403f
      Thomas Haller authored
      The DHCP plugins are linked statically and don't have a plugin mechanism
      to be loaded from a shared library. Change the _nm_dhcp_client_register()
      mechanism to something more static.
      
      Also, only link the plugins into the binary if they are actually
      enabled. Previously, they would always be linked in (and always
      register themself). However, nm_dhcp_dh*_get_path() would return NULL
      which made the plugin unusable.
      
      The autoconf code to detect the DHCP plugins is still not stellar, but
      seems to work well enough for now. At least, we log the result of the
      detection at the end of the configure-script, so a user can at least
      notice what happend.
      ad0f403f
  14. 03 Oct, 2016 3 commits
  15. 01 Jul, 2016 1 commit
  16. 04 Mar, 2016 1 commit
  17. 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.
      ...
      8bace23b
  18. 23 Nov, 2015 3 commits
  19. 05 Aug, 2015 2 commits
  20. 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
  21. 12 Jul, 2015 1 commit
  22. 11 May, 2015 1 commit
  23. 19 Jan, 2015 2 commits
    • Dan Winship's avatar
      core: add nm_utils_setpgid(), and use it · fb792af7
      Dan Winship authored
      Add nm_utils_setpgid() as a g_spawn*() child setup function for
      calling setpgid(), and use it where appropriate rather than
      reimplementing it every time.
      fb792af7
    • Dan Winship's avatar
      core: use GUnixSignalWatchSource to simplify signal handling · c5b3e937
      Dan Winship authored
      Replace the pthread_sigwait()-based signal handling with
      g_unix_signal_add()-based handling, and get rid of all the
      now-unnecessary calls to nm_unblock_posix_signals() when spawning
      subprocesses.
      
      As a bonus, this also fixes the "^C in gdb kills NM too" bug.
      c5b3e937
  24. 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
  25. 07 Nov, 2014 3 commits