NetworkManager/src/devices
Thomas Haller c9f89cafdf platform: adding onlink gateway route for manual addresses
Kernel does not all allow to configure a route via a gateway, if the
gateway is not directly reachable.

For non-manually added routes (e.g. from DHCP), we ignore them as a
server configuration errors. For manually added routes, we try to work
around them.

Note that if the user adds a manual route that references a gateway,
maybe he should be required to also add a matching onlink route for
the gateway (or an address that results in a device-route), otherwise
the configuration could be considered invalid. That was however not
done historically, and also, it seems a rather unhelpful behavior.
NetworkManage should just make it work, not not assume anything is
wrong with the configuration. Similarly, for IPv4, the user could
configure the route as onlink, however, that still requires extra
configuration of which the user might not be aware.

This would apply for example, when a connection has method=auto,
and would obtain the routes automatically. It seems sensible to
allow the user to add a route via the gateway, if he ~knows~ that
this particular network will provide such a configuration via DHCP.

In the past however, we tried not to automatically add a device route,
but instead see whether we will get a suitable route via DHCP. If we
wouldn't get such a route, we would however fail the connection.
However, this is really very hard to get right.
We call ip_config_merge_and_apply() possibly before receiving automatic
IP configuration (commit 7070d17ced, "device: reset
@con_ip6_config on failure before RA"). In this case, we could not yet
configure the route. Instead, we also cannot fail (yet), because we should
wait whether we will receive a route that makes this configuration
feasable.
That is hard to get right. How long should we wait? If we get a DHCP lease
and still cannot add the route, should we fail the IP configuration or wait
longer for another lease? Worse, if we decide to fail the IP configuration,
it might not fail the entire activation. Instead, we would only mark the
current address family as failed. If we later get a DHCP lease, should we
retry to add the route again? -- probably yes. If we still fail, we would
need to keep the IP configuration in failed state, regardless that DHCP
succeeded. Part of the problem is, that we are bad at tracking the
failed state per IP method. So, if manual configuration fails but DHCP
succeeds, we get the state wrong. That should be fixed separately, but it
just shows how hard it is to have this route that we currently cannot
add, and wanting to wait for something that might never come, but still
fail at some point.

Instead, if we cannot add a route due to a missing onlink gateway,
just retry and add the /32 or /128 direct route ourself.

Note that for IPv6 routes that have a "src" address which is still
TENTATIVE, we also cannot currently add the route and retry later.
However, that is fundamentally different, because:
  - the configuration here is correct, it's only that the address
    didn't yet pass IPv6 DAD and kernel is being unhelpful (rh#1457196).
  - we only have to wait a few seconds for DAD to complete or fail.
    So, it's easy to implement this sensibly.
2018-04-04 14:57:07 +02:00
..
adsl core: avoid clone of all-connections list for nm_utils_complete_generic() 2018-03-20 15:08:18 +01:00
bluetooth core: avoid clone of all-connections list for nm_utils_complete_generic() 2018-03-20 15:08:18 +01:00
ovs all: avoid calling g_free on a const pointer with g_clear_pointer() 2018-03-19 15:45:46 +01:00
team core: avoid clone of all-connections list for nm_utils_complete_generic() 2018-03-20 15:08:18 +01:00
tests core/platform: add support for TUN/TAP netlink support and various cleanup 2018-03-20 11:59:52 +01:00
wifi device/trival: rename NMIwdManagerPrivate.nm_manager field to "manager" 2018-04-04 14:02:13 +02:00
wwan core: avoid clone of all-connections list for nm_utils_complete_generic() 2018-03-20 15:08:18 +01:00
meson.build build: add initial support for meson build system 2017-12-13 15:48:50 +01:00
nm-arping-manager.c all: use nm_direct_hash() instead of g_direct_hash() 2017-11-16 11:49:52 +01:00
nm-arping-manager.h core: refactor private data in "src" 2016-10-04 09:50:56 +02:00
nm-device-bond.c core: avoid clone of all-connections list for nm_utils_complete_generic() 2018-03-20 15:08:18 +01:00
nm-device-bond.h core: refactor private data in "src" 2016-10-04 09:50:56 +02:00
nm-device-bridge.c core: avoid clone of all-connections list for nm_utils_complete_generic() 2018-03-20 15:08:18 +01:00
nm-device-bridge.h bridge: move the Bluetooth NAP logic to bridge device 2017-06-01 11:57:42 +02:00
nm-device-dummy.c core: avoid clone of all-connections list for nm_utils_complete_generic() 2018-03-20 15:08:18 +01:00
nm-device-dummy.h core: add support for dummy devices 2017-02-22 21:05:04 +01:00
nm-device-ethernet-utils.c device: use NMSettings directly instead of NMConnectionProvider in subclasses 2016-05-24 12:35:58 +02:00
nm-device-ethernet-utils.h device: use NMSettings directly instead of NMConnectionProvider in subclasses 2016-05-24 12:35:58 +02:00
nm-device-ethernet.c core: avoid clone of all-connections list for nm_utils_complete_generic() 2018-03-20 15:08:18 +01:00
nm-device-ethernet.h all: replace non-leading tabs with spaces 2018-02-07 13:32:04 +01:00
nm-device-factory.c device: split per-directory factory function 2018-01-10 11:01:46 +01:00
nm-device-factory.h core: device-factory: implement match_connection() 2017-08-05 08:03:16 +02:00
nm-device-generic.c core/dbus: rework D-Bus implementation to use lower layer GDBusConnection API 2018-03-12 18:37:08 +01:00
nm-device-generic.h core: refactor private data in "src" 2016-10-04 09:50:56 +02:00
nm-device-infiniband.c core: avoid clone of all-connections list for nm_utils_complete_generic() 2018-03-20 15:08:18 +01:00
nm-device-infiniband.h core: refactor private data in "src" 2016-10-04 09:50:56 +02:00
nm-device-ip-tunnel.c core: avoid clone of all-connections list for nm_utils_complete_generic() 2018-03-20 15:08:18 +01:00
nm-device-ip-tunnel.h core/dbus: rework D-Bus implementation to use lower layer GDBusConnection API 2018-03-12 18:37:08 +01:00
nm-device-logging.h Revert "device: log device type too" 2017-10-31 18:48:41 +01:00
nm-device-macsec.c core/dbus: rework D-Bus implementation to use lower layer GDBusConnection API 2018-03-12 18:37:08 +01:00
nm-device-macsec.h core/dbus: rework D-Bus implementation to use lower layer GDBusConnection API 2018-03-12 18:37:08 +01:00
nm-device-macvlan.c core: avoid clone of all-connections list for nm_utils_complete_generic() 2018-03-20 15:08:18 +01:00
nm-device-macvlan.h core/dbus: rework D-Bus implementation to use lower layer GDBusConnection API 2018-03-12 18:37:08 +01:00
nm-device-ppp.c core/dbus: rework D-Bus implementation to use lower layer GDBusConnection API 2018-03-12 18:37:08 +01:00
nm-device-ppp.h device: add NMDevicePPP 2017-08-05 08:03:15 +02:00
nm-device-private.h all: replace non-leading tabs with spaces 2018-02-07 13:32:04 +01:00
nm-device-tun.c core: avoid clone of all-connections list for nm_utils_complete_generic() 2018-03-20 15:08:18 +01:00
nm-device-tun.h core: refactor private data in "src" 2016-10-04 09:50:56 +02:00
nm-device-veth.c core/dbus: rework D-Bus implementation to use lower layer GDBusConnection API 2018-03-12 18:37:08 +01:00
nm-device-veth.h all: cleanup includes in header files 2016-08-17 19:51:17 +02:00
nm-device-vlan.c core: avoid clone of all-connections list for nm_utils_complete_generic() 2018-03-20 15:08:18 +01:00
nm-device-vlan.h core/dbus: rework D-Bus implementation to use lower layer GDBusConnection API 2018-03-12 18:37:08 +01:00
nm-device-vxlan.c core: avoid clone of all-connections list for nm_utils_complete_generic() 2018-03-20 15:08:18 +01:00
nm-device-vxlan.h core/dbus: rework D-Bus implementation to use lower layer GDBusConnection API 2018-03-12 18:37:08 +01:00
nm-device.c platform: adding onlink gateway route for manual addresses 2018-04-04 14:57:07 +02:00
nm-device.h core: track devices in manager via embedded CList 2018-03-27 09:49:43 +02:00
nm-lldp-listener.c all: use nm_utils_hash_keys_to_array() 2018-03-27 09:58:00 +02:00
nm-lldp-listener.h core: refactor private data for NMExportedObject and others 2016-10-03 12:04:14 +02:00