From f95fb19922a91d4bb5c19a522c489ad7b751d401 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Mon, 16 Jan 2023 14:31:58 +0900 Subject: 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; -- cgit v1.2.1