1. 20 Nov, 2014 6 commits
  2. 19 Nov, 2014 34 commits
    • Thomas Haller's avatar
      policy: merge branch 'th/bgo735512_route_metric_v2' · 5338178d
      Thomas Haller authored
      Further fixes to NMDefaultRouteManager.
    • Thomas Haller's avatar
    • Thomas Haller's avatar
      policy: fix handling managed devices without default route · 308a5e79
      Thomas Haller authored
      Before, we would only track a device in NMDefaultRouteManager
      if it had a default route. Otherwise the entry for the device
      was removed.
      That was wrong, because having no entry meant that the interface
      is assumed and hence we would not touch the interface. Instead we must
      esplicitly track devices without default route to know when an interface
      has no default route.
      Signed-off-by: Thomas Haller's avatarThomas Haller <thaller@redhat.com>
    • Thomas Haller's avatar
      policy: sort default routes by metrics before adding them · 815e67a6
      Thomas Haller authored
      It's better to add the more important routes first. Otherwise there
      might be a short time when a lower priority route has precedence.
      Signed-off-by: Thomas Haller's avatarThomas Haller <thaller@redhat.com>
    • Thomas Haller's avatar
      policy: pick up externally configured default routes for managed interfaces · 1f5f576c
      Thomas Haller authored
      The previous commit made NM enforce the default route on interfaces for
      which NM manages a default route.
      For interfaces that are configured never-default, NM will now pick up
      any externally configured default route, as if it was managed by NM.
      This is important, because NMDefaultRouteManager needs a notion of which
      is the best device. Without this change, it was agnostic to default routes
      on managed, never-default interfaces.
      Signed-off-by: Thomas Haller's avatarThomas Haller <thaller@redhat.com>
    • Thomas Haller's avatar
      policy: resync routes on platform change events · 16b0ddb6
      Thomas Haller authored
      Monitor default routes from platform, and resync the default routes
      on changes.
      For one, this fixes the following use-case: have an assumed device em1
      with two routes of metric 20 and 21. Activate em2, which will get effective
      metric 22.
      When externally removing route em1/20, em2 would resync the effective metric to
      20. This is correct and already worked before. However, when deleting em1/21,
      nothing happened. With this change, em2 would resync to metric 21 to fill the gap.
      However this commit has much bigger effects: whenever the user externally adds
      a default route to an interface for which NM manages an default route, NM will
      delete it.
      Also, when deleting the default route (managed by NM), NM would readd
      it. Effectivly, the user can no longer mess with the default route on
      interfaces for which it manages the default route.
      If the connection is configured never-default, the user still can add
      default routes and NM will not touch them.
      Obviously, this has no effect for assumed devices either and the user
      can externally add and remove default routes as he wishes.
      Signed-off-by: Thomas Haller's avatarThomas Haller <thaller@redhat.com>
    • Thomas Haller's avatar
      policy: consider additional assumed routes when synchronizing the default route · b4b67c47
      Thomas Haller authored
      Don't only consider the best route of assumed devices when syncing the route
      metrics. This fixes the following scenario:
      Have em1 assumed, with two default routes (metric 20 and 21).
      When activating em2, NMDefaultRouteManager would  have determined
      21 as the effective metric, thus replacing the assumed route of em1.
      Since we don't want to touch assumed interfaces, it is wrong to
      replace their default routes.
      Instead, keep track of all the assumed default routes and consider their
      metrics when choosing effective_metric.
      Signed-off-by: Thomas Haller's avatarThomas Haller <thaller@redhat.com>
    • Thomas Haller's avatar
    • Thomas Haller's avatar
      device: only add default route when having any addresses · 57dd4a12
      Thomas Haller authored
      This fixes the failure to add a default route because no
      addresses are configured yet.
      Signed-off-by: Thomas Haller's avatarThomas Haller <thaller@redhat.com>
    • Thomas Haller's avatar
      policy: remove redundant remove_default_route() functions from NMDefaultRouteManager · 462456f2
      Thomas Haller authored
      When calling update_default_route(), NMDefaultRouteManager will look at the
      source, and determine whether it has a default route or not. For example
      for device sources, this means calling nm_device_get_ip4_default_route().
      If the source indicates that it has no default route, the effect of
      calling update_default_route() is the same as calling
      remove_default_route() (hence, remove() can be replaced by update()).
      If the source however still indicates a default route, the behavior
      would be different. This case would be an undesired inconsistancy,
      because source and NMDefaultRouteManager would disagree of whether
      the source has a default route.
      Source must always properly indicate whether it has a default route
      or not, hence this situation does not arise.
      Hence it is always better to call update().
      Signed-off-by: Thomas Haller's avatarThomas Haller <thaller@redhat.com>
    • Thomas Haller's avatar
    • Thomas Haller's avatar
      policy: minor fix when having multiple default routes with metric MAXUINT32 · 825885d5
      Thomas Haller authored
      The case of having a metric MAXUINT32 is special, because in face of
      multiple default routes with the same metric, NMDefaultRouteManager
      cannot reduce the effective metric (because there is no lower priority
      This case works already correct, just when adding such a default route,
      ensure that we add it to the *first* entry.
      Signed-off-by: Thomas Haller's avatarThomas Haller <thaller@redhat.com>
    • Thomas Haller's avatar
    • Thomas Haller's avatar
    • Dan Winship's avatar
      Merge branch 'dhcp-fixes' · 9f5cff0b
      Dan Winship authored
    • Dan Winship's avatar
      man: document the "internal" DHCP client · 93799e68
      Dan Winship authored
    • Dan Winship's avatar
      dhcp: Simplify nm-dhcp-systemd lease-handling code · 4f2c5531
      Dan Winship authored
      An sd_dhcp_lease will always have an associated address, netmask, and
      lifetime, so we don't have to check for errors when fetching them.
      (The systemd code will fill in a default netmask if the server didn't
      provide one; nm-dhcp-systemd's code to do that itself was redundant
      and unused.)
      Also, log the expiration time and NTP servers, for consistency with
      everything else.
    • Dan Winship's avatar
      dhcp: fix startup warnings with dhcp=internal · 7bf7ebc4
      Dan Winship authored
      If asked to read a file that doesn't exist, sd_dhcp_lease_load()
      returns 0 (success) without setting the out lease argument. So we need
      to check both the return status and the lease before proceeding.
    • Dan Winship's avatar
      dhcp: fix systemd-dhcp's writing of routes in lease file · 71b67659
      Dan Winship authored
      inet_ntoa() uses a static buffer, so you can't call it twice in the
      same fprintf() call.
    • Dan Winship's avatar
      dhcp: update system-dhcp code from upstream · 44eb50d1
      Dan Winship authored
    • Dan Winship's avatar
      dhcp: update nm-dhcp-systemd code for system-dhcp re-import · e30b0714
      Dan Winship authored
      Some of the patches we proposed were committed in slightly different
    • Dan Winship's avatar
    • Dan Winship's avatar
      Merge branch 'master' into dhcp-merge · 1ea0dd41
      Dan Winship authored
    • Jiří Klimeš's avatar
    • Dan Winship's avatar
      dhcp: update systemd DHCP code · e2e4637c
      Dan Winship authored
      This is a direct dump from systemd git on 2014-11-19, git commit
      a4962513.  Only relevant files were included.
             cd "$SYSTEMD_DIR"
             git checkout "$COMMIT"
             git clean -fdx
          /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/dhcp-internal.h ./src/dhcp-manager/systemd-dhcp/src/libsystemd-network/dhcp-internal.h
          /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/dhcp-lease-internal.h ./src/dhcp-manager/systemd-dhcp/src/libsystemd-network/dhcp-lease-internal.h
          /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/dhcp-network.c ./src/dhcp-manager/systemd-dhcp/src/libsystemd-network/dhcp-network.c
          /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/dhcp-option.c ./src/dhcp-manager/systemd-dhcp/src/libsystemd-network/dhcp-option.c
          /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/dhcp-packet.c ./src/dhcp-manager/systemd-dhcp/src/libsystemd-network/dhcp-packet.c
          /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/dhcp-protocol.h ./src/dhcp-manager/systemd-dhcp/src/libsystemd-network/dhcp-protocol.h
          /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/dhcp6-internal.h ./src/dhcp-manager/systemd-dhcp/src/libsystemd-network/dhcp6-internal.h
          /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/dhcp6-lease-internal.h ./src/dhcp-manager/systemd-dhcp/src/libsystemd-network/dhcp6-lease-internal.h
          /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/dhcp6-network.c ./src/dhcp-manager/systemd-dhcp/src/libsystemd-network/dhcp6-network.c
          /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/dhcp6-option.c ./src/dhcp-manager/systemd-dhcp/src/libsystemd-network/dhcp6-option.c
          /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/dhcp6-protocol.h ./src/dhcp-manager/systemd-dhcp/src/libsystemd-network/dhcp6-protocol.h
          /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/network-internal.c ./src/dhcp-manager/systemd-dhcp/src/libsystemd-network/network-internal.c
          /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/network-internal.h ./src/dhcp-manager/systemd-dhcp/src/libsystemd-network/network-internal.h
          /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/sd-dhcp-client.c ./src/dhcp-manager/systemd-dhcp/src/libsystemd-network/sd-dhcp-client.c
          /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/sd-dhcp-lease.c ./src/dhcp-manager/systemd-dhcp/src/libsystemd-network/sd-dhcp-lease.c
          /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/sd-dhcp6-client.c ./src/dhcp-manager/systemd-dhcp/src/libsystemd-network/sd-dhcp6-client.c
          /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/sd-dhcp6-lease.c ./src/dhcp-manager/systemd-dhcp/src/libsystemd-network/sd-dhcp6-lease.c
          /bin/cp "$SYSTEMD_DIR"/src/shared/async.h ./src/dhcp-manager/systemd-dhcp/src/shared/async.h
          /bin/cp "$SYSTEMD_DIR"/src/shared/fileio.c ./src/dhcp-manager/systemd-dhcp/src/shared/fileio.c
          /bin/cp "$SYSTEMD_DIR"/src/shared/fileio.h ./src/dhcp-manager/systemd-dhcp/src/shared/fileio.h
          /bin/cp "$SYSTEMD_DIR"/src/shared/list.h ./src/dhcp-manager/systemd-dhcp/src/shared/list.h
          /bin/cp "$SYSTEMD_DIR"/src/shared/macro.h ./src/dhcp-manager/systemd-dhcp/src/shared/macro.h
          /bin/cp "$SYSTEMD_DIR"/src/shared/refcnt.h ./src/dhcp-manager/systemd-dhcp/src/shared/refcnt.h
          /bin/cp "$SYSTEMD_DIR"/src/shared/siphash24.c ./src/dhcp-manager/systemd-dhcp/src/shared/siphash24.c
          /bin/cp "$SYSTEMD_DIR"/src/shared/siphash24.h ./src/dhcp-manager/systemd-dhcp/src/shared/siphash24.h
          /bin/cp "$SYSTEMD_DIR"/src/shared/socket-util.h ./src/dhcp-manager/systemd-dhcp/src/shared/socket-util.h
          /bin/cp "$SYSTEMD_DIR"/src/shared/sparse-endian.h ./src/dhcp-manager/systemd-dhcp/src/shared/sparse-endian.h
          /bin/cp "$SYSTEMD_DIR"/src/shared/strv.c ./src/dhcp-manager/systemd-dhcp/src/shared/strv.c
          /bin/cp "$SYSTEMD_DIR"/src/shared/strv.h ./src/dhcp-manager/systemd-dhcp/src/shared/strv.h
          /bin/cp "$SYSTEMD_DIR"/src/shared/time-util.c ./src/dhcp-manager/systemd-dhcp/src/shared/time-util.c
          /bin/cp "$SYSTEMD_DIR"/src/shared/time-util.h ./src/dhcp-manager/systemd-dhcp/src/shared/time-util.h
          /bin/cp "$SYSTEMD_DIR"/src/shared/utf8.c ./src/dhcp-manager/systemd-dhcp/src/shared/utf8.c
          /bin/cp "$SYSTEMD_DIR"/src/shared/utf8.h ./src/dhcp-manager/systemd-dhcp/src/shared/utf8.h
          /bin/cp "$SYSTEMD_DIR"/src/shared/util.c ./src/dhcp-manager/systemd-dhcp/src/shared/util.c
          /bin/cp "$SYSTEMD_DIR"/src/shared/util.h ./src/dhcp-manager/systemd-dhcp/src/shared/util.h
          /bin/cp "$SYSTEMD_DIR"/src/shared/unaligned.h ./src/dhcp-manager/systemd-dhcp/src/shared/unaligned.h
          /bin/cp "$SYSTEMD_DIR"/src/shared/in-addr-util.c ./src/dhcp-manager/systemd-dhcp/src/shared/in-addr-util.c
          /bin/cp "$SYSTEMD_DIR"/src/shared/in-addr-util.h ./src/dhcp-manager/systemd-dhcp/src/shared/in-addr-util.h
          /bin/cp "$SYSTEMD_DIR"/src/systemd/_sd-common.h ./src/dhcp-manager/systemd-dhcp/src/systemd/_sd-common.h
          /bin/cp "$SYSTEMD_DIR"/src/systemd/sd-dhcp-client.h ./src/dhcp-manager/systemd-dhcp/src/systemd/sd-dhcp-client.h
          /bin/cp "$SYSTEMD_DIR"/src/systemd/sd-dhcp-lease.h ./src/dhcp-manager/systemd-dhcp/src/systemd/sd-dhcp-lease.h
          /bin/cp "$SYSTEMD_DIR"/src/systemd/sd-dhcp6-client.h ./src/dhcp-manager/systemd-dhcp/src/systemd/sd-dhcp6-client.h
          /bin/cp "$SYSTEMD_DIR"/src/systemd/sd-dhcp6-lease.h ./src/dhcp-manager/systemd-dhcp/src/systemd/sd-dhcp6-lease.h
          /bin/cp "$SYSTEMD_DIR"/src/systemd/sd-event.h ./src/dhcp-manager/systemd-dhcp/src/systemd/sd-event.h
          /bin/cp "$SYSTEMD_DIR"/src/systemd/sd-id128.h ./src/dhcp-manager/systemd-dhcp/src/systemd/sd-id128.h
    • Thomas Haller's avatar
    • Lubomir Rintel's avatar
      cli: Watch for device as well as AC state changes when activating · 653b7e48
      Lubomir Rintel authored
      The signals might be delivered in no particular order and we need to wait for
      the device to reach stable state (whether it's successfully conntected or not)
      as well as the active connection to leave ACTIVATING state.
    • Jiří Klimeš's avatar
    • Jiří Klimeš's avatar
    • Jiří Klimeš's avatar
      dispatcher: introduce new env variables for gateway address (bgo #740363) · 9a133787
      Jiří Klimeš authored
      We still put gateway into IP[46]_ADDRESS_N for backward compatibility.
    • Lubomir Rintel's avatar
      libnm-core: Add missing type cast · c30379e0
      Lubomir Rintel authored
      Fixes testing on 32-bit arches:
      (./test-general:29331): GLib-GObject-WARNING **: g_object_set_valist: object class `NMSettingConnection' has no property named `$?\xff\xff\x89t$0\x89|$4\xe8\u001c\x98\xff\xff\x85\xc0tM\x83\xf8\xfft3\x8dT$(\xc7D$\u0008'
      /bin/sh: line 5: 29331 Trace/breakpoint trap   ${dir}$tst
      FAIL: test-general
      Fixes: 093a3c88
    • Dan Winship's avatar
      tui: refresh the "nmtui connect" list when connections are added/removed · 8473bb31
      Dan Winship authored
      We were refreshing the list when the set of available devices changed,
      or the set of active connections changed, but not when the set of
      available connections changed.
    • Dan Winship's avatar
    • Jiří Klimeš's avatar