summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2022-04-05 17:45:52 +0200
committerLuca Boccassi <luca.boccassi@gmail.com>2022-05-21 16:09:53 +0200
commit93a72170bd8a7001abde8c85b65cf0f456c8022e (patch)
tree8742d9fc17135c41acd39ffc91ba0c2a35b4855a
parentMerge pull request #23339 from poettering/sockaddr-size-limit (diff)
downloadsystemd-93a72170bd8a7001abde8c85b65cf0f456c8022e.tar.xz
systemd-93a72170bd8a7001abde8c85b65cf0f456c8022e.zip
network: drop support for old kernels which cannot set prefix route with non-main route table
Not sure when the issue was fixed. - kernel-3.10 on CentOS 7 has the issue, - kernel-4.18 on CentOS 8 works fine. Note, the workaround dropped by the commit is not incomplete: with an old kernel which has the issue, all non-prefix routes are configured on the specified route table, but the prefix route is configured on the main table. That should not work for most cases, hence, the workaround is mostly meaningless.
-rw-r--r--src/network/networkd-dhcp4.c46
-rw-r--r--src/network/networkd-link.h2
-rw-r--r--src/network/networkd-manager.h1
-rwxr-xr-xtest/test-network/systemd-networkd-tests.py8
4 files changed, 4 insertions, 53 deletions
diff --git a/src/network/networkd-dhcp4.c b/src/network/networkd-dhcp4.c
index d3fd2571e0..5770b48767 100644
--- a/src/network/networkd-dhcp4.c
+++ b/src/network/networkd-dhcp4.c
@@ -27,8 +27,6 @@
#include "strv.h"
#include "sysctl-util.h"
-static int dhcp4_request_address_and_routes(Link *link, bool announce);
-
void network_adjust_dhcp4(Network *network) {
assert(network);
@@ -157,26 +155,6 @@ int dhcp4_check_ready(Link *link) {
return 0;
}
-static int dhcp4_retry(Link *link) {
- int r;
-
- assert(link);
-
- r = dhcp4_remove_address_and_routes(link, /* only_marked = */ false);
- if (r < 0)
- return r;
-
- r = link_request_static_nexthops(link, true);
- if (r < 0)
- return r;
-
- r = link_request_static_routes(link, true);
- if (r < 0)
- return r;
-
- return dhcp4_request_address_and_routes(link, false);
-}
-
static int dhcp4_route_handler(sd_netlink *rtnl, sd_netlink_message *m, Request *req, Link *link, Route *route) {
int r;
@@ -184,31 +162,12 @@ static int dhcp4_route_handler(sd_netlink *rtnl, sd_netlink_message *m, Request
assert(link);
r = sd_netlink_message_get_errno(m);
- if (r == -ENETUNREACH && !link->dhcp4_route_retrying) {
-
- /* It seems kernel does not support that the prefix route cannot be configured with
- * route table. Let's once drop the config and reconfigure them later. */
-
- log_link_message_debug_errno(link, m, r, "Could not set DHCPv4 route, retrying later");
- link->dhcp4_route_failed = true;
- link->manager->dhcp4_prefix_root_cannot_set_table = true;
- } else if (r < 0 && r != -EEXIST) {
+ if (r < 0 && r != -EEXIST) {
log_link_message_warning_errno(link, m, r, "Could not set DHCPv4 route");
link_enter_failed(link);
return 1;
}
- if (link->dhcp4_messages == 0 && link->dhcp4_route_failed) {
- link->dhcp4_route_failed = false;
- link->dhcp4_route_retrying = true;
-
- r = dhcp4_retry(link);
- if (r < 0)
- link_enter_failed(link);
-
- return 1;
- }
-
r = dhcp4_check_ready(link);
if (r < 0)
link_enter_failed(link);
@@ -253,8 +212,7 @@ static int dhcp4_request_route(Route *in, Link *link) {
static bool link_prefixroute(Link *link) {
return !link->network->dhcp_route_table_set ||
- link->network->dhcp_route_table == RT_TABLE_MAIN ||
- link->manager->dhcp4_prefix_root_cannot_set_table;
+ link->network->dhcp_route_table == RT_TABLE_MAIN;
}
static int dhcp4_request_prefix_route(Link *link) {
diff --git a/src/network/networkd-link.h b/src/network/networkd-link.h
index d674001042..5174127413 100644
--- a/src/network/networkd-link.h
+++ b/src/network/networkd-link.h
@@ -120,8 +120,6 @@ typedef struct Link {
sd_dhcp_lease *dhcp_lease;
char *lease_file;
unsigned dhcp4_messages;
- bool dhcp4_route_failed:1;
- bool dhcp4_route_retrying:1;
bool dhcp4_configured:1;
char *dhcp4_6rd_tunnel_name;
diff --git a/src/network/networkd-manager.h b/src/network/networkd-manager.h
index fab2cfaf11..2191d0d955 100644
--- a/src/network/networkd-manager.h
+++ b/src/network/networkd-manager.h
@@ -95,7 +95,6 @@ struct Manager {
usec_t speed_meter_usec_new;
usec_t speed_meter_usec_old;
- bool dhcp4_prefix_root_cannot_set_table;
bool bridge_mdb_on_master_not_supported;
FirewallContext *fw_ctx;
diff --git a/test/test-network/systemd-networkd-tests.py b/test/test-network/systemd-networkd-tests.py
index 989020e0c6..51f379f26a 100755
--- a/test/test-network/systemd-networkd-tests.py
+++ b/test/test-network/systemd-networkd-tests.py
@@ -4638,17 +4638,13 @@ class NetworkdDHCPClientTests(unittest.TestCase, Utilities):
print('## ip route show table main dev veth99')
output = check_output('ip route show table main dev veth99')
print(output)
- # See issue #8726
- main_table_is_empty = output == ''
- if not main_table_is_empty:
- self.assertNotRegex(output, 'proto dhcp')
+ self.assertNotRegex(output, 'proto dhcp')
print('## ip route show table 211 dev veth99')
output = check_output('ip route show table 211 dev veth99')
print(output)
self.assertRegex(output, 'default via 192.168.5.1 proto dhcp')
- if main_table_is_empty:
- self.assertRegex(output, '192.168.5.0/24 proto dhcp')
+ self.assertRegex(output, '192.168.5.0/24 proto dhcp')
self.assertRegex(output, '192.168.5.1 proto dhcp scope link')
print('## dnsmasq log')