Merge pull request #25164 from yuwata/network-route-table-0

network: fix handling of route table 0
This commit is contained in:
Luca Boccassi
2022-10-28 11:23:26 +02:00
committed by GitHub
6 changed files with 43 additions and 36 deletions
+2 -1
View File
@@ -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);
+2 -2
View File
@@ -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)
+1 -1
View File
@@ -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;
}
+1 -1
View File
@@ -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;
}