From f95fb19922a91d4bb5c19a522c489ad7b751d401 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Mon, 16 Jan 2023 14:31:58 +0900 Subject: [PATCH 1/3] network: introduce QuickAck= for [DHCPv4] and [IPv6AcceptRA] Closes #25906. --- man/systemd.network.xml | 20 ++++++++++++++++++-- src/network/networkd-dhcp4.c | 3 +++ src/network/networkd-ndisc.c | 3 +++ src/network/networkd-network-gperf.gperf | 2 ++ src/network/networkd-network.h | 2 ++ 5 files changed, 28 insertions(+), 2 deletions(-) diff --git a/man/systemd.network.xml b/man/systemd.network.xml index daa2c2e167..69b94adbe7 100644 --- a/man/systemd.network.xml +++ b/man/systemd.network.xml @@ -1645,8 +1645,8 @@ allow my_server_t localnet_peer_t:peer recv; QuickAck= - Takes a boolean. When true enables TCP quick ack mode for the route. When unset, the - kernel's default will be used. + Takes a boolean. When true, the TCP quick ACK mode for the route is enabled. When unset, + the kernel's default will be used. @@ -2046,6 +2046,14 @@ allow my_server_t localnet_peer_t:peer recv; + + QuickAck= + + Takes a boolean. When true, the TCP quick ACK mode is enabled for the routes configured by + the acquired DHCPv4 lease. When unset, the kernel's default will be used. + + + UseGateway= @@ -2546,6 +2554,14 @@ Token=prefixstable:2002:da8:1:: + + QuickAck= + + Takes a boolean. When true, the TCP quick ACK mode is enabled for the routes configured by + the received RAs. When unset, the kernel's default will be used. + + + UseMTU= diff --git a/src/network/networkd-dhcp4.c b/src/network/networkd-dhcp4.c index 43850e1e95..1d5e2975a8 100644 --- a/src/network/networkd-dhcp4.c +++ b/src/network/networkd-dhcp4.c @@ -183,6 +183,7 @@ static int dhcp4_request_route(Route *in, Link *link) { assert(route); assert(link); + assert(link->network); assert(link->dhcp_lease); r = sd_dhcp_lease_get_server_identifier(link->dhcp_lease, &server); @@ -200,6 +201,8 @@ static int dhcp4_request_route(Route *in, Link *link) { route->table = link_get_dhcp4_route_table(link); if (route->mtu == 0) route->mtu = link->network->dhcp_route_mtu; + if (route->quickack < 0) + route->quickack = link->network->dhcp_quickack; if (route_get(NULL, link, route, &existing) < 0) /* This is a new route. */ link->dhcp4_configured = false; diff --git a/src/network/networkd-ndisc.c b/src/network/networkd-ndisc.c index c7ed5fcfe1..ed9bb18599 100644 --- a/src/network/networkd-ndisc.c +++ b/src/network/networkd-ndisc.c @@ -173,6 +173,7 @@ static int ndisc_request_route(Route *in, Link *link, sd_ndisc_router *rt) { assert(route); assert(link); + assert(link->network); assert(rt); r = sd_ndisc_router_get_address(rt, &router); @@ -186,6 +187,8 @@ static int ndisc_request_route(Route *in, Link *link, sd_ndisc_router *rt) { ndisc_set_route_priority(link, route); if (!route->protocol_set) route->protocol = RTPROT_RA; + if (route->quickack < 0) + route->quickack = link->network->ipv6_accept_ra_quickack; is_new = route_get(NULL, link, route, NULL) < 0; diff --git a/src/network/networkd-network-gperf.gperf b/src/network/networkd-network-gperf.gperf index c205e56c62..59d352b4d1 100644 --- a/src/network/networkd-network-gperf.gperf +++ b/src/network/networkd-network-gperf.gperf @@ -221,6 +221,7 @@ DHCPv4.UseHostname, config_parse_bool, DHCPv4.UseDomains, config_parse_dhcp_use_domains, AF_INET, 0 DHCPv4.UseRoutes, config_parse_bool, 0, offsetof(Network, dhcp_use_routes) DHCPv4.UseGateway, config_parse_tristate, 0, offsetof(Network, dhcp_use_gateway) +DHCPv4.QuickAck, config_parse_bool, 0, offsetof(Network, dhcp_quickack) DHCPv4.RequestOptions, config_parse_dhcp_request_options, AF_INET, 0 DHCPv4.Anonymize, config_parse_bool, 0, offsetof(Network, dhcp_anonymize) DHCPv4.SendHostname, config_parse_bool, 0, offsetof(Network, dhcp_send_hostname) @@ -279,6 +280,7 @@ IPv6AcceptRA.UseMTU, config_parse_bool, IPv6AcceptRA.DHCPv6Client, config_parse_ipv6_accept_ra_start_dhcp6_client, 0, offsetof(Network, ipv6_accept_ra_start_dhcp6_client) IPv6AcceptRA.RouteTable, config_parse_dhcp_or_ra_route_table, AF_INET6, 0 IPv6AcceptRA.RouteMetric, config_parse_ipv6_accept_ra_route_metric, 0, 0 +IPv6AcceptRA.QuickAck, config_parse_bool, 0, offsetof(Network, ipv6_accept_ra_quickack) IPv6AcceptRA.RouterAllowList, config_parse_in_addr_prefixes, AF_INET6, offsetof(Network, ndisc_allow_listed_router) IPv6AcceptRA.RouterDenyList, config_parse_in_addr_prefixes, AF_INET6, offsetof(Network, ndisc_deny_listed_router) IPv6AcceptRA.PrefixAllowList, config_parse_in_addr_prefixes, AF_INET6, offsetof(Network, ndisc_allow_listed_prefix) diff --git a/src/network/networkd-network.h b/src/network/networkd-network.h index fbeec6072e..986e067902 100644 --- a/src/network/networkd-network.h +++ b/src/network/networkd-network.h @@ -146,6 +146,7 @@ struct Network { bool dhcp_use_mtu; bool dhcp_use_routes; int dhcp_use_gateway; + bool dhcp_quickack; bool dhcp_use_timezone; bool dhcp_use_hostname; bool dhcp_use_6rd; @@ -312,6 +313,7 @@ struct Network { bool ipv6_accept_ra_use_autonomous_prefix; bool ipv6_accept_ra_use_onlink_prefix; bool ipv6_accept_ra_use_mtu; + bool ipv6_accept_ra_quickack; bool active_slave; bool primary_slave; DHCPUseDomains ipv6_accept_ra_use_domains; From c972026888da86468abae1d9cd48124151e6c020 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Mon, 16 Jan 2023 14:36:53 +0900 Subject: [PATCH 2/3] NEWS: move one entry to the correct section --- NEWS | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/NEWS b/NEWS index 4358d0c48e..662257c7e2 100644 --- a/NEWS +++ b/NEWS @@ -48,13 +48,6 @@ CHANGES WITH 253 in spe: * systemd-fstab-generator now supports x-systemd.makefs option for /sysroot (in the initrd). - * The [DHCPv4] section in .network file gained new SocketPriority= - setting that assigns the Linux socket priority used by the DHCPv4 - raw socket. Can be used in conjuntion with the EgressQOSMaps=setting in - [VLAN] section of .netdev file to send the desired ethernet 802.1Q frame - priority for DHCPv4 initial packets. This cannot be achieved with - netfilter mangle tables because of the raw socket bypass. - Changes in udev: * The new net naming scheme "v253" has been introduced. In the new @@ -120,6 +113,13 @@ CHANGES WITH 253 in spe: Changes in systemd-networkd and related tools: + * The [DHCPv4] section in .network file gained new SocketPriority= + setting that assigns the Linux socket priority used by the DHCPv4 + raw socket. Can be used in conjuntion with the EgressQOSMaps=setting + in [VLAN] section of .netdev file to send the desired ethernet 802.1Q + frame priority for DHCPv4 initial packets. This cannot be achieved + with netfilter mangle tables because of the raw socket bypass. + * The RouteMetric= option (for DHCPv4, DHCPv6, and IPv6 advertised routes) now accepts three values, for high, medium, and low preference of the router (which can be set with the RouterPreference=) setting. From 1d00da37551835c3a4f5a8e2f144666891e555b2 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Mon, 16 Jan 2023 14:37:11 +0900 Subject: [PATCH 3/3] NEWS: mention QuickAck= --- NEWS | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/NEWS b/NEWS index 662257c7e2..fe5741610e 100644 --- a/NEWS +++ b/NEWS @@ -120,6 +120,11 @@ CHANGES WITH 253 in spe: frame priority for DHCPv4 initial packets. This cannot be achieved with netfilter mangle tables because of the raw socket bypass. + * The [DHCPv4] and [IPv6AcceptRA] sections in .network file gained new + QuickAck= boolean setting that enables the TCP quick ACK mode for the + routes configured by the aquired DHCPv4 lease or received router + advertisements (RAs). + * The RouteMetric= option (for DHCPv4, DHCPv6, and IPv6 advertised routes) now accepts three values, for high, medium, and low preference of the router (which can be set with the RouterPreference=) setting.