1. 09 Jun, 2018 3 commits
  2. 08 Jun, 2018 1 commit
    • Francesco Giudici's avatar
      libnm-core: add ipv6.dhcp-duid property · 7a0b6b17
      Francesco Giudici authored
      allow to specify the DUID to be used int the DHCPv6 client identifier
      option: the dhcp-duid property accepts either a hex string or the
      special values "lease", "llt", "ll", "stable-llt", "stable-ll" and
      "stable-uuid".
      
      "lease": give priority to the DUID available in the lease file if any,
               otherwise fallback to a global default dependant on the dhcp
               client used. This is the default and reflects how the DUID
               was managed previously.
      "ll": enforce generation and use of LL type DUID based on the current
            hardware address.
      "llt": enforce generation and use of LLT type DUID based on the current
             hardware address and a stable time field.
      "stable-ll": enforce generation and use of LL type DUID based on a
                   link layer address derived from the stable id.
      "stable-llt": enforce generation and use of LLT type DUID based on
                    a link layer address and a timestamp both derived from the
                    stable id.
      "stable-uuid": enforce generation and use of a UUID type DUID based on a
                     uuid generated from the stable id.
      7a0b6b17
  3. 07 Jun, 2018 4 commits
  4. 06 Jun, 2018 3 commits
  5. 05 Jun, 2018 10 commits
    • Thomas Haller's avatar
    • Thomas Haller's avatar
      clients/tests: test `nmcli con mod` command with different locale · 360f9523
      Thomas Haller authored
      Just to give it some variety. Also, note how the message from the
      server cannot be translated. Which is the case with real NetworkManager
      as well, and is a major usability issue.
      360f9523
    • Thomas Haller's avatar
      clients/tests: verify connections in test-networkmanager-service.py using libnm · f3dddcff
      Thomas Haller authored
      The real NetworkManager service has a clear understanding how a valid
      connection looks like. This is what nm_connection_verify() returns.
      
      Let also our stub-service verify connections the same way.
      
      Note that this is cumbersome, because the stub service uses python's
      dbus module, while libnm only accepts creating NMConnection instances
      from GVariant. Thus, we need to a cumbersome conversion first.
      
      It would be better if test-networkmanager-service.py would also expose
      normalized connections on D-Bus. But that requires the inverse converion
      from GVariant to python dbus.
      f3dddcff
    • Thomas Haller's avatar
      780af4cf
    • Thomas Haller's avatar
      tests: reorder definitions in test-networkmanager-service.py · ef612b8e
      Thomas Haller authored
      Define all custom exception types together.
      ef612b8e
    • Thomas Haller's avatar
      tests: use libnm defines for NM test stub · e862e67f
      Thomas Haller authored
      These names are unique and well-known.
      e862e67f
    • Thomas Haller's avatar
      tests: rename local variables in NM test stub (2) · 78576794
      Thomas Haller authored
      lso, the name "connection" and "con" is overused.
      
      Use "con_inst" where we mean an instance of a "Connection" class,
      that is, the object exposed on D-Bus.
      78576794
    • Thomas Haller's avatar
      tests: rename local variables in NM test stub (1) · 9cc1876f
      Thomas Haller authored
      - don't use "hash" for a local variable in python.
        The editor highlights it like a special python name.
      
      - don't use "settings" for Connection.settings. Name it
        Connection.con_hash. The name "settings" is over-used already.
        "con_hash" really is the nested dictionary that we expose/receive
        from D-Bus. If we would use libnm for it, it would be an
        NMSimpleConnection instance, but we don't.
      9cc1876f
    • Thomas Haller's avatar
      dns: change main.rc-manager=file behavior to always follow symlink · 644aa42f
      Thomas Haller authored
      With "main.rc-manager=file", if /etc/resolv.conf is a symlink, NetworkManager
      would follow the symlink and update the file instead.
      
      However, note that realpath() only returns a target, if the file actually
      exists. That means, if /etc/resolv.conf is a dangling symlink, NetworkManager
      would replace the symlink with a file.
      
      This was the only case in which NetworkManager would every change a symlink
      resolv.conf to a file. I think this is undesired behavior.
      
      This is a change in long established behavior. Although note that there were several
      changes regarding rc-manager settings in the past. See for example commit [1] and [2].
      
      Now, first still try using realpath() as before. Only if that fails, try
      to resolve /etc/resolv.conf as a symlink with readlink().
      
      Following the dangling symlink is likely not a problem for the user, it
      probably is even desired. The part that most likely can cause problems
      is if the destination file is not writable. That happens for example, if
      the destination's parent directories are missing. In this case, NetworkManager
      will now fail to write resolv.conf and log a warning. This has the potential of
      breaking existing setups, but it really is a mis-configuration from the user's
      side.
      
      This fixes for example the problem, if the user configures
      /etc/resolv.conf as symlink to /tmp/my-resolv.conf. At boot, the file
      would not exist, and NetworkManager would previously always replace the
      link with a plain file. Instead, it should follow the symlink and create
      the file.
      
      [1] 718fd224
      [2] 15177a34
      
      https://github.com/NetworkManager/NetworkManager/pull/127
      644aa42f
    • Beniamino Galvani's avatar
  6. 04 Jun, 2018 1 commit
  7. 03 Jun, 2018 1 commit
    • Beniamino Galvani's avatar
      settings: let connections keep NMSettings alive · 3fb4eed3
      Beniamino Galvani authored
      The NMSettings instance can't be disposed while there is any exported
      connection. Ideally we should unexport all connections on NMSettings'
      disposal, but for now leak @self on termination when there are
      connections alive.
      
      This fixes the following bug on shutdown:
      
       assertion failed: (c_list_is_empty (&priv->connections_lst_head))
       #0  raise () from target:/lib64/libc.so.6
       #1  abort () from target:/lib64/libc.so.6
       #2  g_assertion_message (domain=0x66cab2 "NetworkManager", file=0x6a5e48 "src/settings/nm-settings.c", line=1929)
       #3  g_assertion_message_expr () at gtestutils.c:2555
       #4  finalize (object=0x1dab170) at src/settings/nm-settings.c:1929
       #5  g_object_unref (_object=0x1dab170) at gobject.c:3340
       #6  dispose (object=0x1de50b0) at src/nm-manager.c:7139
       #7  g_object_unref (_object=0x1de50b0) at gobject.c:3303
       #8  _nm_singleton_instance_destroy () at src/nm-core-utils.c:138
       #9  _dl_fini () from target:/lib64/ld-linux-x86-64.so.2
       #10 __run_exit_handlers () from target:/lib64/libc.so.6
       #11 exit () from target:/lib64/libc.so.6
       #12 main (argc=<optimized out>, argv=<optimized out>) at src/main.c:460
      
      https://bugzilla.redhat.com/show_bug.cgi?id=1579858
      3fb4eed3
  8. 02 Jun, 2018 1 commit
    • Beniamino Galvani's avatar
      dhcp: fix handling of failure events · bd63d392
      Beniamino Galvani authored
      DHCPv4 can fail for two reasons:
      
       (a) the client failed to contact server and to get an initial lease
      
       (b) the client failed to renew the lease after it was successfully
           acquired
      
      For (a) the client generates a TIMEOUT event, for (b) an EXPIRED
      event.  Currently we fail the IP method immediately after (a), but
      this doesn't work well when the carrier flickers and we restart the
      client because if the server goes temporarily down, the IP method
      fails and DHCP is never restarted.
      
      Let's change this, and determine whether to fail IP configuration only
      by looking at the current IP state: when it's IP_CONF then we are
      getting the initial lease and a failure means that IP configuration
      must fail; otherwise any other state means that the lease expired or
      could not be renewed and thus we keep the client running for the grace
      period.
      
      https://bugzilla.redhat.com/show_bug.cgi?id=1573780
      bd63d392
  9. 01 Jun, 2018 14 commits
    • Beniamino Galvani's avatar
      cli: fix active connections color · 0aa2d252
      Beniamino Galvani authored
      Fixes: a1b25a47
      0aa2d252
    • Beniamino Galvani's avatar
      device: don't try to change MTU on a disconnected device · e86ea024
      Beniamino Galvani authored
      ip_config_merge_and_apply() can be called without an applied
      connection, but then it calls nm_device_set_ip_config() and tries to
      retrieve the configured MTU, throwing an assertion if the applied
      connection is NULL.
      
      src/devices/nm-device.c: line 8080 (nm_device_get_configured_mtu_for_wired): should not be reached
      
      Since it doesn't make sense apply a MTU from the connection when there
      is no connection, add a check against this.
      e86ea024
    • Thomas Haller's avatar
    • Thomas Haller's avatar
      cli/trivial: move code · 5d716def
      Thomas Haller authored
      5d716def
    • Thomas Haller's avatar
      cli: rework printing of general active-connection properties · 68fa68b3
      Thomas Haller authored
      use nmc_print() for the job.
      
      Also, localize non-terse output.
      
      Also, fix bug with
      
        $ nmcli c s /org/freedesktop/NetworkManager/ActiveConnection/1
      
      if active connection #1 is invisible to the user.
      
      Also, previously, fill_output_active_connection() wrongly tries to
      write to a field that doesn't exist:
      
        set_val_strc (arr, 13-idx_start, s_con ? nm_setting_connection_get_slave_type (s_con) : NULL);
      68fa68b3
    • Thomas Haller's avatar
      cli: sort active-connection for `nmcli connection show $PROFILE` output · b990cee0
      Thomas Haller authored
      There might be multiple active connections. Output them in a defined order.
      b990cee0
    • Thomas Haller's avatar
      cli: rework printing of `nmcli connection` for multiple active connections · a1b25a47
      Thomas Haller authored
      The output of `nmcli connection show` contains also information about
      whether the profile is currently active, for example the device and
      the current (activation) state.
      
      Even when a profile can be activated only once (without supporting
      mutiple activations at the same time), there are moments when a
      connection is activating and still deactivating on another device.
      NetworkManager ensures in the case with single activations that
      a profile cannot be in state "activated" multiple times. But that
      doesn't mean, that one profile cannot have multiple active connection
      which reference it. That was already handled wrongly before, because
      `nmcli connection show` would only search the first matching
      active-connection. That is, it would arbitrarily pick an active
      connection in case there were multiple and only show activation
      state about one.
      Furthermore, we will soon also add the possibility, that a profile can be
      active multiple times (at the same time). Especially then, we need to
      extend the output format to show all the devices on which the profile is
      currently active.
      
      Rework printing the connection list to use nmc_print(), and fix various
      issues.
      
      - as discussed, a profile may have multiple active connections at each time.
        There are only two possibilities: if a profile is active multiple
        times, show a line for each activation, or otherwise, show the
        information about multiple activations combined in one line, e.g. by
        printing "DEVICE eth0,eth1". This patch, does the former.
        We will now print a line for each active connection, to show
        all the devices and activation states in multiple lines.
        Yes, this may result in the same profile being printed multiple times.
        That is a change in behavior, and inconvenient if you do something
        like
      
           for UUID in $(nmcli connection show | awk '{print$2}'); do ...
      
        However, above is anyway wrong because it assumes that there are no
        spaces in the connection name. The proper way to do this is like
      
           for UUID in $(nmcli -g UUID connection show); do ...
      
        In the latter case, whenever a user selects a subset of fields
        (--fields, --get) which don't print information about active connections,
        these multiple lines are combined. So, above still works as expected,
        never returning duplicate UUIDs.
      
      - if a user has no permissions to see a connection, we previously
        would print "<invisible> $NAME". No longer do this but just print
        the ID was it is reported by the active-connection. If the goal
        of this was to prevent users from accidentally access the non-existing
        connection by $NAME, then this was a bad solution, because a script
        would instead try to access "<invisible> $NAME". This is now solved
        better by hiding the active connection if the user selects "-g NAME".
      
      - the --order option now sorts according to how the fields are shown.
        For example, with --terse mode, it will evaluate type "802-11-wireless"
        but with pretty mode it will consider "wifi". This may change the
        ordering in which connections are shown. Also, for sorting the name,
        we use g_utf8_collate() because it's unicode.
      a1b25a47
    • Thomas Haller's avatar
    • Thomas Haller's avatar
      clients/tests: add test for showing invisible connection in nmcli · 3645be64
      Thomas Haller authored
      It also shows how we handle invisible connections wrongly, when we have
      multiple active-connections that reference them.
      3645be64
    • Thomas Haller's avatar
      46b7d521
    • Thomas Haller's avatar
    • Beniamino Galvani's avatar
      settings: fix plugins loading · a1f1b13f
      Beniamino Galvani authored
      Since load_plugin() modifies the list, we must pass its address.
      
      Fixes: fd86a1ae
      a1f1b13f
    • Thomas Haller's avatar
      man: clarify main.rc-manager=file behavior for resolv.conf as dangling symlink · bc28a2b1
      Thomas Haller authored
      It's not clear whether this was desired behavior. However, it was
      behavior for a long time, so we probably should not change it.
      
      Just document what happens with dangling symlinks.
      bc28a2b1
    • Thomas Haller's avatar
  10. 31 May, 2018 2 commits