1. 12 Feb, 2019 2 commits
  2. 13 Nov, 2018 6 commits
    • Thomas Haller's avatar
      dhcp/trivial: wrap lines in calling client_start() · ce1cfd72
      Thomas Haller authored
      A possible issue is that client_start() has about 136 arguments.
      It doesn't get simpler by saving lines of code and writing them
      all in the same line.
      Wrap the lines.
      While at it, use "FALSE" for "enforce_duid" argument, instead of "0".
      It's a boolean.
    • Thomas Haller's avatar
    • Thomas Haller's avatar
    • 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.
    • Thomas Haller's avatar
      dhcp: refactor nm_dhcp_dhclient_save_duid() to accept original DUID · cd9e418f
      Thomas Haller authored
      There should be lower layers that are concerned with writing
      and reading dhclient configuration files. It's wrong to
      have a nm_dhcp_dhclient_save_duid() function which requires
      the caller to pre-escape the string to write. The caller shouldn't
      be concerned with the file format, that's why the function
      is used in the first place.
    • Thomas Haller's avatar
      dhcp: don't re-read DHCP client ID from configuration file for dhclient · 5411fb0c
      Thomas Haller authored
      Why would we do this? The configuration file we are reading back was
      written by NetworkManager in the first place.
      Maybe when assuming a connection after restart, this information could
      be interesting. It however is not actually relevant.
      Note how nm_dhcp_client_get_client_id() has only very few callers.
        - nm_device_spawn_iface_helper() in 'nm-device.c'. In this case,
          we either should use the client-id which we used when starting
          DHCP, or none at all.
        - ip4_start() in 'nm-dhcp-dhclient.c', but this is before starting
          DHCP client and before it was re-read from configuration file.
        - in "src/dhcp/nm-dhcp-systemd.c", but this has no effect for
          the dhclient plugin.
  3. 27 Sep, 2018 1 commit
  4. 18 Sep, 2018 1 commit
    • Lubomir Rintel's avatar
      config: add --configure-and-quit=initrd mode · c263f535
      Lubomir Rintel authored
      We need a mode that:
      * doesn't leave processes behind
      * doesn't force an internal dhclient
      * doesn't auto-generate default connections
      * doesn't write out files into libdir, only /run
      The original configure-and-quit mode doesn't really fit the initrd use. But
      it's proobably not a good idea to just change its behavior.
  5. 12 Sep, 2018 2 commits
  6. 10 Sep, 2018 2 commits
  7. 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
          $ git grep '\<\(char\|short\|int\|long\|float\|double\)\>' | wc -l
      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' \
  8. 20 Jun, 2018 2 commits
  9. 09 Jun, 2018 2 commits
    • Francesco Giudici's avatar
      dhcp: allow to skip DUID search from DHCP client global configuration · f054c3fc
      Francesco Giudici authored
      When the used client is dhclient we were used to search for DUID not
      only in the specific lease files generated by NetworkManager, but also
      in the global lease file generated outside NetworkManager.
      Keep this capability but allow to just search in the NM lease files if
      a value different from the default one is specified in dhcp-duid.
    • Francesco Giudici's avatar
      dhcp: remove fallback DUID-UUID generation from dhcp code · 0d841e74
      Francesco Giudici authored
      This commit centralizes the DUID generation in nm-device.c.
      As a consequence, a DUID is always provided when starting a
      DHCPv6 client. The DHCP client can override the passed DUID
      with the value contained in the client-specific lease file.
  10. 26 May, 2018 4 commits
  11. 30 Apr, 2018 1 commit
  12. 20 Mar, 2018 1 commit
  13. 15 Feb, 2018 4 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.
    • 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.
    • 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.
    • Thomas Haller's avatar
  14. 07 Feb, 2018 1 commit
  15. 10 Oct, 2017 1 commit
    • Thomas Haller's avatar
      core: rework tracking of gateway/default-route in ip-config · 5c299454
      Thomas Haller authored
      Instead of having 3 properties @gateway, @never_default and @has_gateway
      on NMIP4Config/NMIP6Config that determine the default-route, track the
      default-route as a regular route.
      The gateway setting is the configuration knob for the default-route.
      Since an NMIP4Config/NMIP6Config instance only has one gateway property,
      it cannot track more then one default-routes (see related bug rh#1445417).
      Especially with policy routing, it might be interesting to configure a
      default-route in multiple tables.
      Also, later it might be interesting to allow adding default-routes as
      regular static routes in a connection, so that the user can configure additional
      route parameters for the default-route or add default-routes in multiple tables.
      With this patch, default-routes now have a rt_source property according to their
      Also, the previous commits of this branch broke handling of the
      default-route :) . That should be working now again.
  16. 09 Oct, 2017 1 commit
  17. 06 Oct, 2017 1 commit
  18. 15 Sep, 2017 1 commit
    • Francesco Giudici's avatar
      dhcp: dhclient: remove the --timeout argument from the command line · 1cb4832f
      Francesco Giudici authored
      the --timeout command line option is a custom feature added in some
      linux distributions (fedora). Passing that command line argument will
      make dhclient fail if the binary does not support it, preventing
      activation of dhcp based connections.
      Worse, the option has just been recently changed from "-timeout", so
      that we are currently incompatibile with Centos, RedHat and older
      versions of Fedora too.
      Leverage the "timeout" option in dhclient config file: it will produce
      the expected behavior and will be universally supported.
      Fixes test: dhcp-timeout
      Fixes: fa467360
  19. 11 Sep, 2017 2 commits
    • Thomas Haller's avatar
      core/dhcp: use addr-family parameter for instead of boolean · 3c84dd15
      Thomas Haller authored
      In many cases we want to treat IPv4 and IPv6 generically. That looks nicer
      if we distingish by an @addr_family integer, instead of a boolean.
      Replace the @is_ipv6 boolean with an @addr_family paramter. The @is_ipv6
      boolean is inconsistent with other places where we use @is_ipv4 to
      indicate the opposite. Eventually, we should use @addr_family
      Also, at the call site it's not immediately clear what TRUE/FALSE means,
      here AF_INET/AF_INET6 is better.
    • Francesco Giudici's avatar
      dhcp: dhclient: fix daemon start when dhcp-timeout is specified · fa467360
      Francesco Giudici authored
      A typo in the new dhcp-timeout option caused the dhclient daemon to exit
      with error when the dhcp-timeout option was specified.
      This prevents dhcp connection to be upped.
      Fixes: 82ef497c
  20. 05 Jul, 2017 1 commit
    • Thomas Haller's avatar
      core: pass NMDedupMultiIndex instance to NMIP4Config and other · 89385bd9
      Thomas Haller authored
      NMIP4Config, NMIP6Config, and NMPlatform shall share one
      NMDedupMultiIndex instance.
      For that, pass an NMDedupMultiIndex instance to NMPlatform and NMNetns.
      NMNetns than passes it on to NMDevice, NMDhcpClient, NMIP4Config and NMIP6Config.
      So currently NMNetns is the access point to the shared NMDedupMultiIndex
      instance, and it gets it from it's NMPlatform instance.
      The NMDedupMultiIndex instance is really a singleton, we don't want
      multiple instances of it. However, for testing, instead of adding a
      singleton instance, pass the instance explicitly around.
  21. 09 May, 2017 1 commit
  22. 04 May, 2017 1 commit
  23. 03 May, 2017 1 commit