summaryrefslogtreecommitdiff
path: root/src/network
diff options
context:
space:
mode:
authorLuca Boccassi <bluca@debian.org>2022-10-28 11:23:26 +0200
committerGitHub <noreply@github.com>2022-10-28 11:23:26 +0200
commit60e9a39ac7b9e1c0f48306669eda9f24e2dbda2f (patch)
tree6a1d35ef9e8d2e3b836e86add8d74c3046b7fc91 /src/network
parent2ffb134e783e3c6bdfbe2f7c55dd34610efbcf38 (diff)
parentb4f4f1191e52a77c14efaffc9c5802c55e3c7185 (diff)
downloadsystemd-60e9a39ac7b9e1c0f48306669eda9f24e2dbda2f.tar.gz
Merge pull request #25164 from yuwata/network-route-table-0
network: fix handling of route table 0
Diffstat (limited to 'src/network')
-rw-r--r--src/network/networkd-dhcp-common.c3
-rw-r--r--src/network/networkd-route-util.c4
-rw-r--r--src/network/networkd-route.c2
-rw-r--r--src/network/networkd-routing-policy-rule.c2
4 files changed, 6 insertions, 5 deletions
diff --git a/src/network/networkd-dhcp-common.c b/src/network/networkd-dhcp-common.c
index 6526d3378f..7b0b2dea85 100644
--- a/src/network/networkd-dhcp-common.c
+++ b/src/network/networkd-dhcp-common.c
@@ -15,6 +15,7 @@
#include "networkd-link.h"
#include "networkd-manager.h"
#include "networkd-network.h"
+#include "networkd-route-util.h"
#include "parse-util.h"
#include "socket-util.h"
#include "string-table.h"
@@ -529,7 +530,7 @@ int config_parse_dhcp_or_ra_route_table(
assert(IN_SET(ltype, AF_INET, AF_INET6));
assert(rvalue);
- r = safe_atou32(rvalue, &rt);
+ r = manager_get_route_table_from_string(network->manager, rvalue, &rt);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse RouteTable=%s, ignoring assignment: %m", rvalue);
diff --git a/src/network/networkd-route-util.c b/src/network/networkd-route-util.c
index 312f5f298a..0366382093 100644
--- a/src/network/networkd-route-util.c
+++ b/src/network/networkd-route-util.c
@@ -417,8 +417,8 @@ int manager_get_route_table_to_string(const Manager *m, uint32_t table, char **r
assert(m);
assert(ret);
- if (table == 0)
- return -EINVAL;
+ /* Unlike manager_get_route_table_from_string(), this accepts 0, as the kernel may create routes with
+ * table 0. See issue #25089. */
s = route_table_to_string(table);
if (!s)
diff --git a/src/network/networkd-route.c b/src/network/networkd-route.c
index 514845f7c5..d1f3bab092 100644
--- a/src/network/networkd-route.c
+++ b/src/network/networkd-route.c
@@ -2351,7 +2351,7 @@ int config_parse_route_table(
r = manager_get_route_table_from_string(network->manager, rvalue, &n->table);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
- "Could not parse route table number \"%s\", ignoring assignment: %m", rvalue);
+ "Could not parse route table \"%s\", ignoring assignment: %m", rvalue);
return 0;
}
diff --git a/src/network/networkd-routing-policy-rule.c b/src/network/networkd-routing-policy-rule.c
index 71c4360fa3..130ed5e0a7 100644
--- a/src/network/networkd-routing-policy-rule.c
+++ b/src/network/networkd-routing-policy-rule.c
@@ -1250,7 +1250,7 @@ int config_parse_routing_policy_rule_table(
r = manager_get_route_table_from_string(network->manager, rvalue, &n->table);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
- "Could not parse RPDB rule route table number \"%s\", ignoring assignment: %m", rvalue);
+ "Could not parse RPDB rule route table \"%s\", ignoring assignment: %m", rvalue);
return 0;
}