mirror of
https://github.com/systemd/systemd.git
synced 2025-01-09 01:18:19 +03:00
Merge pull request #18168 from yuwata/network-cleanups
network: several follow-ups for recently merged PRs
This commit is contained in:
commit
608ac76367
@ -1221,7 +1221,7 @@ int config_parse_rx_tx_queues(
|
||||
log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse %s=, ignoring assignment: %s.", lvalue, rvalue);
|
||||
return 0;
|
||||
}
|
||||
if (k > 4096) {
|
||||
if (k == 0 || k > 4096) {
|
||||
log_syntax(unit, LOG_WARNING, filename, line, 0, "Invalid %s=, ignoring assignment: %s.", lvalue, rvalue);
|
||||
return 0;
|
||||
}
|
||||
|
@ -1497,6 +1497,12 @@ int manager_rtnl_process_route(sd_netlink *rtnl, sd_netlink_message *message, Ma
|
||||
return 0;
|
||||
}
|
||||
|
||||
r = sd_netlink_message_read_u32(message, RTAX_ADVMSS, &tmp->advmss);
|
||||
if (r < 0 && r != -ENODATA) {
|
||||
log_link_warning_errno(link, r, "rtnl: received route message with invalid advmss, ignoring: %m");
|
||||
return 0;
|
||||
}
|
||||
|
||||
r = sd_netlink_message_exit_container(message);
|
||||
if (r < 0) {
|
||||
log_link_error_errno(link, r, "rtnl: Could not exit from RTA_METRICS container: %m");
|
||||
@ -2121,6 +2127,7 @@ int config_parse_tcp_advmss(
|
||||
|
||||
if (isempty(rvalue)) {
|
||||
n->advmss = 0;
|
||||
TAKE_PTR(n);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -36,6 +36,10 @@ InitialCongestionWindow=20
|
||||
Destination=192.168.1.2
|
||||
InitialAdvertisedReceiveWindow=30
|
||||
|
||||
[Route]
|
||||
Destination=192.168.1.3
|
||||
TCPAdvertisedMaximumSegmentSize=30
|
||||
|
||||
[Route]
|
||||
Type=blackhole
|
||||
Destination=202.54.1.2
|
||||
|
@ -2197,53 +2197,54 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
|
||||
print('### ip -6 route show dev dummy98')
|
||||
output = check_output('ip -6 route show dev dummy98')
|
||||
print(output)
|
||||
self.assertRegex(output, '2001:1234:5:8fff:ff:ff:ff:ff proto static')
|
||||
self.assertRegex(output, '2001:1234:5:8f63::1 proto kernel')
|
||||
self.assertIn('2001:1234:5:8fff:ff:ff:ff:ff proto static', output)
|
||||
self.assertIn('2001:1234:5:8f63::1 proto kernel', output)
|
||||
|
||||
print('### ip -6 route show default')
|
||||
output = check_output('ip -6 route show default')
|
||||
print(output)
|
||||
self.assertRegex(output, 'default')
|
||||
self.assertRegex(output, 'via 2001:1234:5:8fff:ff:ff:ff:ff')
|
||||
self.assertIn('default', output)
|
||||
self.assertIn('via 2001:1234:5:8fff:ff:ff:ff:ff', output)
|
||||
|
||||
print('### ip -4 route show dev dummy98')
|
||||
output = check_output('ip -4 route show dev dummy98')
|
||||
print(output)
|
||||
self.assertRegex(output, '149.10.124.48/28 proto kernel scope link src 149.10.124.58')
|
||||
self.assertRegex(output, '149.10.124.64 proto static scope link')
|
||||
self.assertRegex(output, '169.254.0.0/16 proto static scope link metric 2048')
|
||||
self.assertRegex(output, '192.168.1.1 proto static initcwnd 20')
|
||||
self.assertRegex(output, '192.168.1.2 proto static initrwnd 30')
|
||||
self.assertRegex(output, 'multicast 149.10.123.4 proto static')
|
||||
self.assertIn('149.10.124.48/28 proto kernel scope link src 149.10.124.58', output)
|
||||
self.assertIn('149.10.124.64 proto static scope link', output)
|
||||
self.assertIn('169.254.0.0/16 proto static scope link metric 2048', output)
|
||||
self.assertIn('192.168.1.1 proto static initcwnd 20', output)
|
||||
self.assertIn('192.168.1.2 proto static initrwnd 30', output)
|
||||
self.assertIn('192.168.1.3 proto static advmss 30', output)
|
||||
self.assertIn('multicast 149.10.123.4 proto static', output)
|
||||
|
||||
print('### ip -4 route show dev dummy98 default')
|
||||
output = check_output('ip -4 route show dev dummy98 default')
|
||||
print(output)
|
||||
self.assertRegex(output, 'default via 149.10.125.65 proto static onlink')
|
||||
self.assertRegex(output, 'default via 149.10.124.64 proto static')
|
||||
self.assertRegex(output, 'default proto static')
|
||||
self.assertIn('default via 149.10.125.65 proto static onlink', output)
|
||||
self.assertIn('default via 149.10.124.64 proto static', output)
|
||||
self.assertIn('default proto static', output)
|
||||
|
||||
print('### ip -4 route show table local dev dummy98')
|
||||
output = check_output('ip -4 route show table local dev dummy98')
|
||||
print(output)
|
||||
self.assertRegex(output, 'local 149.10.123.1 proto static scope host')
|
||||
self.assertRegex(output, 'anycast 149.10.123.2 proto static scope link')
|
||||
self.assertRegex(output, 'broadcast 149.10.123.3 proto static scope link')
|
||||
self.assertIn('local 149.10.123.1 proto static scope host', output)
|
||||
self.assertIn('anycast 149.10.123.2 proto static scope link', output)
|
||||
self.assertIn('broadcast 149.10.123.3 proto static scope link', output)
|
||||
|
||||
print('### ip route show type blackhole')
|
||||
output = check_output('ip route show type blackhole')
|
||||
print(output)
|
||||
self.assertRegex(output, 'blackhole 202.54.1.2 proto static')
|
||||
self.assertIn('blackhole 202.54.1.2 proto static', output)
|
||||
|
||||
print('### ip route show type unreachable')
|
||||
output = check_output('ip route show type unreachable')
|
||||
print(output)
|
||||
self.assertRegex(output, 'unreachable 202.54.1.3 proto static')
|
||||
self.assertIn('unreachable 202.54.1.3 proto static', output)
|
||||
|
||||
print('### ip route show type prohibit')
|
||||
output = check_output('ip route show type prohibit')
|
||||
print(output)
|
||||
self.assertRegex(output, 'prohibit 202.54.1.4 proto static')
|
||||
self.assertIn('prohibit 202.54.1.4 proto static', output)
|
||||
|
||||
print('### ip -6 route show type blackhole')
|
||||
output = check_output('ip -6 route show type blackhole')
|
||||
@ -2263,26 +2264,26 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
|
||||
print('### ip route show 192.168.10.1')
|
||||
output = check_output('ip route show 192.168.10.1')
|
||||
print(output)
|
||||
self.assertRegex(output, '192.168.10.1 proto static')
|
||||
self.assertRegex(output, 'nexthop via 149.10.124.59 dev dummy98 weight 10')
|
||||
self.assertRegex(output, 'nexthop via 149.10.124.60 dev dummy98 weight 5')
|
||||
self.assertIn('192.168.10.1 proto static', output)
|
||||
self.assertIn('nexthop via 149.10.124.59 dev dummy98 weight 10', output)
|
||||
self.assertIn('nexthop via 149.10.124.60 dev dummy98 weight 5', output)
|
||||
|
||||
print('### ip route show 192.168.10.2')
|
||||
output = check_output('ip route show 192.168.10.2')
|
||||
print(output)
|
||||
# old ip command does not show IPv6 gateways...
|
||||
self.assertRegex(output, '192.168.10.2 proto static')
|
||||
self.assertRegex(output, 'nexthop')
|
||||
self.assertRegex(output, 'dev dummy98 weight 10')
|
||||
self.assertRegex(output, 'dev dummy98 weight 5')
|
||||
self.assertIn('192.168.10.2 proto static', output)
|
||||
self.assertIn('nexthop', output)
|
||||
self.assertIn('dev dummy98 weight 10', output)
|
||||
self.assertIn('dev dummy98 weight 5', output)
|
||||
|
||||
print('### ip -6 route show 2001:1234:5:7fff:ff:ff:ff:ff')
|
||||
output = check_output('ip -6 route show 2001:1234:5:7fff:ff:ff:ff:ff')
|
||||
print(output)
|
||||
# old ip command does not show 'nexthop' keyword and weight...
|
||||
self.assertRegex(output, '2001:1234:5:7fff:ff:ff:ff:ff')
|
||||
self.assertRegex(output, 'via 2001:1234:5:8fff:ff:ff:ff:ff dev dummy98')
|
||||
self.assertRegex(output, 'via 2001:1234:5:9fff:ff:ff:ff:ff dev dummy98')
|
||||
self.assertIn('2001:1234:5:7fff:ff:ff:ff:ff', output)
|
||||
self.assertIn('via 2001:1234:5:8fff:ff:ff:ff:ff dev dummy98', output)
|
||||
self.assertIn('via 2001:1234:5:9fff:ff:ff:ff:ff dev dummy98', output)
|
||||
|
||||
copy_unit_to_networkd_unit_path('25-address-static.network')
|
||||
check_output(*networkctl_cmd, 'reload', env=env)
|
||||
@ -2329,17 +2330,17 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
|
||||
print('### ip route show type blackhole')
|
||||
output = check_output('ip route show type blackhole')
|
||||
print(output)
|
||||
self.assertRegex(output, 'blackhole 202.54.1.2 proto static')
|
||||
self.assertIn('blackhole 202.54.1.2 proto static', output)
|
||||
|
||||
print('### ip route show type unreachable')
|
||||
output = check_output('ip route show type unreachable')
|
||||
print(output)
|
||||
self.assertRegex(output, 'unreachable 202.54.1.3 proto static')
|
||||
self.assertIn('unreachable 202.54.1.3 proto static', output)
|
||||
|
||||
print('### ip route show type prohibit')
|
||||
output = check_output('ip route show type prohibit')
|
||||
print(output)
|
||||
self.assertRegex(output, 'prohibit 202.54.1.4 proto static')
|
||||
self.assertIn('prohibit 202.54.1.4 proto static', output)
|
||||
|
||||
print('### ip -6 route show type blackhole')
|
||||
output = check_output('ip -6 route show type blackhole')
|
||||
|
Loading…
Reference in New Issue
Block a user