diff options
author | Thomas Haller <thaller@redhat.com> | 2019-08-03 08:15:50 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2019-08-13 10:45:04 +0200 |
commit | c167e0140babcf1a045cee34ce4938f5087f8fe6 (patch) | |
tree | 7cac345d9e1fa2430ef5e27f2be5918935391ee6 /clients/common | |
parent | 539db43619e44d2ae1c268aab0cd2d0d562de1b7 (diff) | |
download | NetworkManager-c167e0140babcf1a045cee34ce4938f5087f8fe6.tar.gz |
all: allow configuring default-routes as manual, static routes
Up until now, a default-route (with prefix length zero) could not
be configured directly. The user could only set ipv4.gateway,
ipv4.never-default, ipv4.route-metric and ipv4.route-table to influence
the setting of the default-route (respectively for IPv6).
That is a problematic limitation. For one, whether a route has prefix
length zero or non-zero does not make a fundamental difference. Also,
it makes it impossible to configure all the routing attributes that one can
configure otherwise for static routes. For example, the default-route could
not be configured as "onlink", could not have a special MTU, nor could it be
placed in a dedicated routing table.
Fix that by lifting the restriction. Note that "ipv4.never-default" does
not apply to /0 manual routes. Likewise, the previous manners of
configuring default-routes ("ipv4.gateway") don't conflict with manual
default-routes.
Server-side this all the pieces are already in place to accept a default-route
as static routes. This was done by earlier commits like 5c299454b49b
('core: rework tracking of gateway/default-route in ip-config').
A long time ago, NMIPRoute would assert that the prefix length is
positive. That was relaxed by commit a2e93f2de4ac ('libnm: allow zero
prefix length for NMIPRoute'), already before 1.0.0. Using libnm from
before 1.0.0 would result in assertion failures.
Note that the default-route-metric-penalty based on connectivity
checking applies to all /0 routes, even these static routes. Be they
added due to DHCP, "ipv4.gateway", "ipv4.routes" or "wireguard.peer-routes".
I wonder whether doing that unconditionally is desirable, and maybe
there should be a way to opt-out/opt-in for the entire profile or even
per-routes.
https://bugzilla.redhat.com/show_bug.cgi?id=1714438
Diffstat (limited to 'clients/common')
-rw-r--r-- | clients/common/nm-meta-setting-desc.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/clients/common/nm-meta-setting-desc.c b/clients/common/nm-meta-setting-desc.c index 86682e2e76..9b13bd7540 100644 --- a/clients/common/nm-meta-setting-desc.c +++ b/clients/common/nm-meta-setting-desc.c @@ -367,7 +367,7 @@ _parse_ip_route (int family, } prefix = MAX_PREFIX; if (plen) { - if ((prefix = _nm_utils_ascii_str_to_int64 (plen, 10, 1, MAX_PREFIX, -1)) == -1) { + if ((prefix = _nm_utils_ascii_str_to_int64 (plen, 10, 0, MAX_PREFIX, -1)) == -1) { g_set_error (error, NM_UTILS_ERROR, NM_UTILS_ERROR_INVALID_ARGUMENT, _("invalid prefix '%s'; <1-%d> allowed"), plen, MAX_PREFIX); |